Stock Counts Queries

Access stock count/inventory audit sessions and their line items.

StockCount — Returns a single stock count by id

Example Query:

query GetStockCount($id: ID!) {
  StockCount(id: $id) {
    id
    label
    status
    dated_at
    notes
    valuation_diff
    location { id label }
    stock_count_line_items {
      paginatorInfo { total }
      data { id new_on_hand }
    }
  }
}

StockCounts — Returns a paginated list of stock counts with sorting and filters

Example Query:

query StockCounts(
  $where: QueryStockCountsWhereWhereConditions,
  $orderBy: [QueryStockCountsOrderByOrderByClause!],
  $first: Int,
  $page: Int
) {
  StockCounts(
    where: $where,
    orderBy: $orderBy,
    first: $first,
    page: $page
  ) {
    paginatorInfo {
      total
      currentPage
    }
    data {
      id
      label
      status
      dated_at
    }
  }
}

StockCountBarcodeMatches — Looks up line items by barcode in a stock count

query StockCountBarcodeMatches($id: ID!, $barcode: String!) {
  StockCountBarcodeMatches(id: $id, barcode: $barcode) {
    id
    stock_count_id
    variant_id
    batch_number_id
    new_on_hand
    variant { id label sku }
  }
}

Arguments:

ArgumentTypeDescription
idID!Stock count ID.
barcodeString!Barcode to search for.

Available fields

FieldTypeDescription
idIntUnique identifier.
labelStringStock count label or reference number.
statusStockCountStatusCurrent status.
dated_atDateDocument date.
notesStringNotes.
valuation_diffFloatTotal difference in stock valuation.
locationLocationWarehouse where the count occurs.
stock_count_line_items[StockCountLineItem]Items counted.

Filters

The following fields can be used in the where parameter:

id, label, status.

Example Filters:

FieldExample
id{ "column": "ID", "operator": "EQ", "value": 200050 }
label{ "column": "LABEL", "operator": "LIKE", "value": "%SC-2025%" }
status{ "column": "STATUS", "operator": "EQ", "value": "in_progress" }

Sorting

You can sort results using the orderBy parameter:

  • id
  • label
  • status
  • created_at
  • updated_at
  • dated_at
  • location_label

StockCountLineItem — Returns a single stock count line item by id

Example Query:

query GetStockCountLineItem($id: ID!) {
  StockCountLineItem(id: $id) {
    id
    stock_count_id
    variant_id
    batch_number_id
    stock_count {
      id
      label
      status
    }
    variant {
      id
      label
      sku
    }
    batch_number {
      id
      label
    }
    bin_location
    new_on_hand
    on_hand
    variance
    updated_at
  }
}
FieldTypeDescription
idID!Unique identifier.
stock_count_idIDID of the parent stock count.
variant_idIDID of the product variant.
batch_number_idIDID of the batch number (if applicable).
stock_countStockCountParent stock count relationship.
variantVariantProduct variant relationship.
batch_numberBatchNumberBatch number relationship.
bin_locationStringBin location within the location.
new_on_handFloatNew counted quantity.
on_handFloatCurrent system quantity.
varianceFloatDifference between counted and system quantity.
updated_atDateTimeLast update timestamp.

Data Types

StockCountSerialNumberLineItem

FieldTypeDescription
stock_count_line_item_idIDID of the parent stock count line item.
labelStringSerial number label.

Enums

StockCountStatus

ValueDescription
in_progressCount is currently in progress.
stock_update_in_progressStock is being updated based on the count.
completedStock update finished and count is completed.
cancelledDocument voided.