API Reference

Available queries

Variant - Returns a single variant based on the id provided

query {
  Variant (id: 100012) {
    id
    label
    on_hand
    available
    incoming
    valuation
  }
}

Variants - Returns a list of variants based on the filter define

query {
  Variants {
    data {
    	id
    	label
        sku
    }
  }
}


Available fields

id - Int
Unique identifier of the variant
label - String
Name of the variant
sku - String
Sku of the variant
suppliers - Array of Supplier - Subquery
Suppliers for the variant
barcode - String
Barcode of the variant
type - String
Type of the variant (normal, kit, assembly, packaging)
track_inventory - Boolean
If true, the inventory is tracked (changed based on documents, adjustments, ...)
initial_cost - Float
Initial cost of the variant
unit_cost - Float
Current cost of the variant
last_cost - Float
Last cost used for the variant
purchase_price_amount - Float
Purchase price of the variant
purchase_price_currency - String
Currency of the purchase price (GBP, USD, ...)
weight_amount - Float
Weight of the variant
weight_unit - String
Unit for the variant's weight (kg, g, lb, oz)
active - Boolean
If false, the product is inactive, and can not be added in documents
created_at - DateTime
Creation date of the variant
updated_at - DateTime
Date of the latest modification of the variant
attribute1 - Attribute
Variant attribute for the first option of the product (ex: "red" for Color option)
attribute2 - Attribute
Variant attribute for the second option of the product (ex: "XL" for Size option)
attribute3 - Attribute
Variant attribute for the third option of the product (ex: "iron" for Material option)
product - Product
Product of the variant
shipped_this_month - Float
Quantity of this variant shipped this month
stock_levels - Array of StockLevel
Stock levels of the variant on the locations
on_hand - Float
On hand quantity in stocks for the variant
available - Float
Available quantity of the variant
incoming - Float
Incoming quantity for the variant (quantity purchased but not delivered)
reserved - Float
Reserved quantity for the variant (quantity sold but not delivered)
valuation - Float
Valuation of the variant (value of the on hand quantity)
components - Array of Variant
List of the components of the variant for a kit or an assembly
component_of - Array of Variant
List of the kit or assembly that have this variant as component
packagings - Array of Variant
List of the packagings of this variant
has_batch_numbers - Boolean
If true, the variant has batches
batch_number_stock_levels - Array of [BatchNumberStockLevel]
Stock levels by location for the batches of the variant
batch_numbers - Array of [BatchNumber]
Batch numbers of the variant


Filters

You can create filters based on following fields

label
Example:{ "column" : "LABEL", "operator" : "LIKE", "value" : "%011%" }
sku
Example: { "column" : "SKU", "operator" : "LIKE", "value" : "DE889%" }
barcode
Example: { "column" : "BARCODE", "operator" : "LIKE", "value" : "111212887%" }
type
Example: { column": "TYPE", "operator": "EQ", "value": "kit"
on_hand
Example:{ "column": "ON_HAND", "operator": "LT", "value": 5 }
available
Example:{ "column": "AVAILABLE", "operator": "LT", "value": 10 }
incoming
Example:{ "column": "INCOMING", "operator": "GT", "value": 100 }
reserved
Example:{ "column": "RESERVED", "operator": "GT", "value": 5 }
track_inventory
Example :{ column": "TRACK_INVENTORY", "operator": "EQ", "value": true }
location_id
Example: { "column": "LOCATION_ID", "operator": "EQ", "value": 1000012 }
bin_location
Example: { "column": "BIN_LOCATION", "operator": "EQ", "value": "loc12" }
supplier_id
Example: { column": "SUPPLIER_ID", "operator": "EQ", "value": 212562 }
supplier_sku
Example: { "column": "SUPPLIER_SKU", "operator": "EQ", "value": "12B5621" }
product_id
Example: { "column": "PRODUCT_ID", "operator": "EQ", "value": 310291 }
shipped_this_month
Example: { "column": "SHIPPED_THIS_MONTH", "operator": "GT", "value": 200 }

Sorting

You can sort data based on following fields : id, label, sku, product_id, barcode, track_inventory, initial_cost, unit_cost, purchase_price_amount, purchase_price_currency, weight_amount, weight_unit, active, created_at, updated_at, shipped_this_month, on_hand, available, incoming, reserved

query Variants(
  $orderBy: [QueryVariantsOrderByOrderByClause!], 
  $first: Int = 50, 
  $page: Int
) {
  Variants(
    orderBy: $orderBy
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
    }
    data {
      id
      sku
      type
      label
      on_hand
      track_inventory
    }
  }
}
{
  "orderBy": [
    {
      "column": "UNIT_COST",
      "order": "DESC"
    },
  ],
  "first": 50,
  "page": 1,
}

Example of a query

query Variants(
  $where: QueryVariantsWhereWhereConditions, 
  $first: Int = 50, 
  $page: Int
) {
  Variants(
    where: $where
    first: $first
    page: $page
  ) {
    paginatorInfo {
      total
      count
      currentPage
      perPage
    }
    data {
      id
      type
      product {
        id
      }
      label
      sku
      on_hand
      available
      reserved
      incoming
    }
  }
}
{
  "first": 50,
  "page": 1,
  "where": {
    "AND": [
      {
        "AND": [
          {
            "column": "TRACK_INVENTORY",
            "operator": "EQ",
            "value": true
          },
          {
            "column": "ACTIVE",
            "operator": "EQ",
            "value": true
          },
          {
            "column": "TYPE",
            "operator": "NEQ",
            "value": "packaging"
          }
        ]
      },
      {
        "AND": [
          {
            "column": "LABEL",
            "operator": "LIKE",
            "value": "%asics coat%"
          },
          {
            "column": "SKU",
            "operator": "LIKE",
            "value": "%j%"
          }
        ]
      }
    ]
  }
}

Example of data returned

{
  "data": {
    "Variants": {
      "paginatorInfo": {
        "total": 2,
        "count": 2,
        "currentPage": 1,
        "perPage": 50
      },
      "data": [
        {
          "id": 100053,
          "type": "normal",
          "product": {
            "id": 100014
          },
          "label": "Impressive Asics Coat - Black - L",
          "sku": "wk831kx8Jt",
          "on_hand": null,
          "available": null,
          "reserved": null,
          "incoming": null
        },
        {
          "id": 100054,
          "type": "normal",
          "product": {
            "id": 100014
          },
          "label": "Impressive Asics Coat - White - XL",
          "sku": "iyy32NjImQ",
          "on_hand": null,
          "available": null,
          "reserved": null,
          "incoming": null
        }
      ]
    }
  }
}