# products query


`products` is a GraphQL query of the Chameleoon MAX API. Send it as `POST https://max-api.chameleoon.sk/api/v1/graphql` with your API key, see [Chameleoon MAX](/chameleoon-max).

Returns a page of products that match a filter, sorted by `sortKey`, then by id. Use it to
browse the catalogue or to sync it incrementally.

- Requires the `item.read` permission.
- Archived products are returned only with `filter.includeArchived`.
- Each list in the filter names at most 250 values. An empty list matches nothing.
- The connection has no total count.

#### Paging

Pass exactly one of `first` or `last`, from 1 to 250. `first` (with `after`) pages forward;
`last` (with `before`) pages backward. `last` alone returns the last page. Every edge carries
its own cursor, which belongs to the `sortKey` it was read under.

A page costs 2 + first (or last) × the cost of one node.

## Arguments

- `filter`: [`ProductFilter`](/chameleoon-max/type/product-filter)
- `sortKey`: [`ProductSortKey`](/chameleoon-max/type/product-sort-key) = `CODE`
- `first`: `Int`
- `after`: `String`
- `last`: `Int`
- `before`: `String`

## Returns

[`ProductConnection!`](/chameleoon-max/type/product-connection): a page of [`Product`](/chameleoon-max/type/product).

## Example

**Query**

```graphql
query products($first: Int) {
  products(first: $first) {
    edges {
      cursor
    }
    nodes {
      id
      code
      name
      baseUnit
      vatRateCode
      setMode
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
  }
}
```

**Variables**

```json
{
  "first": 10
}
```

**Response**

```json
{
  "data": {
    "products": {
      "edges": [
        {
          "cursor": "example"
        }
      ],
      "nodes": [
        {
          "id": "00000000-0000-4000-8000-000000000001",
          "code": "example",
          "name": "example",
          "baseUnit": "example",
          "vatRateCode": "example",
          "setMode": "ASSEMBLED"
        }
      ],
      "pageInfo": {
        "hasNextPage": true,
        "hasPreviousPage": true,
        "startCursor": "example",
        "endCursor": "example"
      }
    }
  }
}
```

Values are illustrative: replace IDs and codes with your own before you send the call.
