Stock Levels Queries

View current inventory quantities, valuations, and reorder thresholds by location.

StockLevels — Returns a paginated list of stock levels with sorting and filters

Note: Querying a single StockLevel by ID is not publicly supported. Use this query to retrieve inventory levels.

Example Query:

query StockLevels(
  $where: QueryStockLevelsWhereWhereConditions,
  $orderBy: [QueryStockLevelsOrderByOrderByClause!],
  $first: Int,
  $page: Int
) {
  StockLevels(
    where: $where,
    orderBy: $orderBy,
    first: $first,
    page: $page
  ) {
    paginatorInfo {
      total
      currentPage
    }
    data {
      id
      on_hand
      available
      incoming
      reserved
      reorder_point
      bin_location
      to_reorder
      location { id label }
      variant { id label sku }
    }
  }
}

StockLevel — Returns a single stock level by id

Example Query:

query GetStockLevel($id: ID!) {
  StockLevel(id: $id) {
    id
    on_hand
    available
    incoming
    reserved
    bin_location
    location { id label }
    variant { id label sku }
  }
}

Available fields

FieldTypeDescription
idIntUnique identifier.
on_handFloatPhysical quantity on hand.
availableFloatQuantity available for sale (on_hand - reserved).
incomingFloatQuantity ordered from suppliers (e.g. Purchase Orders).
reservedFloatQuantity reserved in active documents (e.g. Sales Orders).
reorder_pointFloatReorder point configured for this location/variant.
bin_locationStringBin location.
to_reorderFloatCalculated quantity to reorder.
locationLocationAssociated location/warehouse.
variantVariantAssociated product variant.
on_hand_aggregateFloatTotal on hand across all filtered levels.
available_aggregateFloatTotal available across all filtered levels.
incoming_aggregateFloatTotal incoming across all filtered levels.
reserved_aggregateFloatTotal reserved across all filtered levels.
valuationValuationHistoryCurrent valuation of the stock level.
last_sold_dateStringDate of last sale.

Filters

The following fields can be used in the where parameter:

id, on_hand, available, incoming, bin_location, reorder_point, reserved, to_reorder, last_sold_date, location_id, location_active, location_type, variant_id, variant_label, variant_sku, variant_active, variant_type, supplier_id.

Example Filters:

FieldExample
id{ "column": "ID", "operator": "EQ", "value": 200050 }
location_id{ "column": "LOCATION_ID", "operator": "EQ", "value": 100 }
variant_id{ "column": "VARIANT_ID", "operator": "EQ", "value": 5001 }
variant_sku{ "column": "VARIANT_SKU", "operator": "EQ", "value": "SKU-RED" }
on_hand{ "column": "ON_HAND", "operator": "GT", "value": 0 }
available{ "column": "AVAILABLE", "operator": "LT", "value": 10 }
bin_location{ "column": "BIN_LOCATION", "operator": "LIKE", "value": "%A1%" }
supplier_id{ "column": "SUPPLIER_ID", "operator": "EXISTS", "value": 3001 }

Sorting

You can sort results using the orderBy parameter:

  • id
  • on_hand
  • available
  • incoming
  • reorder_point
  • bin_location
  • to_reorder
  • reserved
  • last_sold_date
  • location_id
  • location_label
  • location_type
  • variant_id
  • variant_sku
  • variant_label
  • variant_active

Data Types

InventoryLog

FieldTypeDescription
idIntLog entry ID.
locationLocationAssociated location.
line_itemLineItemAssociated line item.
skuStringVariant SKU.
argumentsStringLog arguments/details.
variantVariantAssociated variant.
userUserUser who performed the action.
on_handFloatStock on hand after change.
availableFloatAvailable stock after change.
incomingFloatIncoming stock after change.
on_hand_diffFloatChange in on-hand quantity.
available_diffFloatChange in available quantity.
incoming_diffFloatChange in incoming quantity.
costFloatUnit cost at time of change.
valuationFloatTotal valuation at time of change.
typeStringType of inventory change.
created_atDateTimeTimestamp of the log entry.
dated_atStringDate of the inventory change.
timeline_atStringTimeline date.
sourceStringSource of the change (e.g., "sale", "purchase").
document_idIntRelated document ID.
order_typeStringOrder type.
contextStringContext of the change.
variant_skuStringVariant SKU (enhanced field).
variant_labelStringVariant label (enhanced field).
variant_typeStringVariant type (enhanced field).
batch_number_idIntBatch number ID.
batch_number_labelStringBatch number label.
has_batch_numbersBooleanWhether this log has batch numbers.
batch_number_inventory_logs[BatchNumberInventoryLog]Batch number details.

Grouping Options

You can group results using the groupBy parameter for reports:

FieldDescription
variant_idGroup by internal variant ID.

Data Types

BatchNumberStockLevelInput

FieldTypeDescription
idIDStock level ID (for updates).
quantityFloatQuantity to allocate.
variantVariantInputVariant details.
locationLocationInputLocation details.
batch_numberBatchNumberInputBatch number details.

StockCountLineItemInput

FieldTypeDescription
idIDLine item ID (for updates).
variantVariantInputVariant details.
batch_numberBatchNumberInputBatch number details.
new_on_handFloatNew on-hand quantity after count.
on_handFloatOriginal on-hand quantity.

AutoAllocateTraceabilityResult

FieldTypeDescription
batch_numbers[AutoAllocatedBatchNumberLineItem]Allocated batch numbers.
serial_numbers[SerialNumber]Allocated serial numbers.

AutoAllocatedBatchNumberLineItem

FieldTypeDescription
quantityFloatQuantity allocated to this batch.
batch_numberBatchNumberAssociated batch number.
serial_numbers[SerialNumber]Serial numbers for this batch.