Skip to main content
POST
/
graphql#ListProducts
List products
curl --request POST \
  --url 'https://clarus-api.com/graphql#ListProducts' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'X-Clarus-Subdomain: <api-key>' \
  --data '
{
  "query": "query($filter: ProductsFilterType) { products { all(filter: $filter) { edges { node { id code barcode description long_description product_type units_per_case shelf_life_min shelf_life_max commodity_code country_of_manufacture } } } } }"
}
'
{
  "data": {
    "products": {
      "all": {
        "edges": [
          {
            "node": {
              "id": "1",
              "code": "SKU-001",
              "barcode": "5012345678901",
              "description": "Widget Blue Large",
              "long_description": "Blue large widget for industrial use",
              "product_type": "standard",
              "units_per_case": 12,
              "shelf_life_min": null,
              "shelf_life_max": null,
              "commodity_code": "8471300000",
              "country_of_manufacture": "GB"
            }
          }
        ]
      }
    }
  }
}

Query Structure

query($filter: ProductsFilterType) {
  products {
    all(filter: $filter) {
      edges {
        node {
          id
          code
          barcode
          description
          long_description
          product_type
          units_per_case
          shelf_life_min
          shelf_life_max
          commodity_code
          country_of_manufacture
        }
      }
    }
  }
}

Filter Argument

All filters are passed inside the filter argument. Each filter field accepts an input object with operators:
{
  "filter": {
    "code": {
      "ilike": "SKU-001"
    }
  }
}

Available Filters

FilterInput TypeOperatorsDescription
codeStringInputTypeeq, ilike, like, in, betweenProduct code
barcodeStringInputTypeeq, ilike, like, in, betweenProduct barcode
all_codesStringInputTypeeq, ilike, like, in, betweenSearch across all code/barcode fields (exact match)
descriptionStringInputTypeeq, ilike, like, in, betweenProduct description
account_idIdInputTypeeq, gt, gteq, lt, lteq, in, filledFilter by account ID
product_typeStringInputTypeeq, ilike, like, in, betweenProduct type

Filter Operators

Input TypeOperators
StringInputTypeeq (exact), ilike (case-insensitive partial), like (case-sensitive partial), in (array match), between (range)
IntegerInputTypeeq, gt, gteq, lt, lteq, between
DatetimeInputTypeeq, from, to, between
BooleanInputTypeeq (required)
IdInputTypeeq, gt, gteq, lt, lteq, in, filled
More fields and filters available via GraphQL introspection.

Authorizations

Authorization
string
header
required

OAuth 2.0 authentication. Use the client credentials or authorization code flow to obtain an access token.

X-Clarus-Subdomain
string
header
required

The subdomain/tenant name identifying which tenant's data to access. Required for all API requests.

Body

application/json
query
string<textarea>
required

GraphQL query string

Example:

"query($filter: ProductsFilterType) { products { all(filter: $filter) { edges { node { id code barcode description long_description product_type units_per_case shelf_life_min shelf_life_max commodity_code country_of_manufacture } } } } }"

variables
object

Query variables including the filter object

Example:
{
"filter": { "code": { "ilike": "SKU-001" } }
}

Response

Successful GraphQL response

data
object

Query result data

errors
object[]

GraphQL errors, if any