Line Items Queries

Access line items from documents with pricing and tax details.

LineItem — Returns a single line item based on the id provided

query GetLineItem($id: ID) {
  LineItem(id: $id) {
    id
    line_itemable { id label }
    line_itemable_type
    sku
    label
    variant_type
    barcode
    variant { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    weight
    drop_shipping
    parent_id
    origin_id
    delivered
    committed
    on_hand
    available
    incoming
    shipped
    reserved
    description
    kit_line_item_id
    type
    batch_numbers { id }
  }
}
{
  "id": 100012
}

LineItemCreditNote — Returns line items for credit notes

query GetLineItemCreditNotes(
  $where: QueryLineItemCreditNotesWhereWhereConditions,
  $orderBy: [QueryLineItemCreditNotesOrderByOrderByClause!],
  $groupBy: QueryLineItemCreditNotesGroupByGroupByClause
) {
  LineItemCreditNote(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    discount
    discount_type
    ecotax
    total
    customer { id label }
    tax_codes { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    calculate_price_from_components
    weight
    drop_shipping
    on_hand
    available
    incoming
    uncredited_quantity
    description
    replace_label
    kit_line_item_id
    type
    parent_id
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "CUSTOMER_ID", "operator": "EQ", "value": 100001 }
    ]
  },
  "orderBy": [
    { "column": "LABEL", "order": "ASC" }
  ]
}

LineItemEstimates — Returns line items for estimates

query GetLineItemEstimates(
  $where: QueryLineItemEstimatesWhereWhereConditions,
  $orderBy: [QueryLineItemEstimatesOrderByOrderByClause!],
  $groupBy: QueryLineItemEstimatesGroupByGroupByClause
) {
  LineItemEstimates(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    estimate_number
    customer { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    calculate_price_from_components
    weight
    drop_shipping
    on_hand
    available
    incoming
    transformed_quantity
    billed_quantity
    unbilled_quantity
    paid_quantity
    unpaid_quantity
    ordered_quantity
    unordered_quantity
    description
    replace_label
    kit_line_item_id
    discount_type
    discount
    tax_amount
    ecotax
    total
    tax_codes { id label }
    type
    parent_id
    origin_id
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "BILLED_QUANTITY", "operator": "GT", "value": 0 }
    ]
  },
  "orderBy": [
    { "column": "BILLED_QUANTITY", "order": "DESC" }
  ]
}

LineItemPurchases — Returns line items for purchases

query GetLineItemPurchases(
  $where: QueryLineItemPurchasesWhereWhereConditions,
  $orderBy: [QueryLineItemPurchasesOrderByOrderByClause!],
  $groupBy: QueryLineItemPurchasesGroupByGroupByClause
) {
  LineItemPurchases(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    supplier { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    weight
    drop_shipping
    on_hand
    available
    incoming
    reserved
    delivered
    uncommitted
    committed
    description
    kit_line_item_id
    type
    parent_id
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "DELIVERED", "operator": "GT", "value": 0 }
    ]
  },
  "orderBy": [
    { "column": "DELIVERED", "order": "DESC" }
  ]
}

LineItemPurchaseReceipts — Returns line items for purchase receipts

query GetLineItemPurchaseReceipts(
  $where: QueryLineItemPurchaseReceiptsWhereWhereConditions,
  $orderBy: [QueryLineItemPurchaseReceiptsOrderByOrderByClause!],
  $groupBy: QueryLineItemPurchaseReceiptsGroupByGroupByClause
) {
  LineItemPurchaseReceipts(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    weight
    drop_shipping
    parent_id
    on_hand
    available
    incoming
    delivered
    reserved
    uncommitted
    committed
    description
    kit_line_item_id
    type
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "DELIVERED", "operator": "GT", "value": 0 }
    ]
  },
  "orderBy": [
    { "column": "DELIVERED", "order": "DESC" }
  ]
}

LineItemProductReturns — Returns line items for product returns

query GetLineItemProductReturns(
  $where: QueryLineItemProductReturnsWhereWhereConditions,
  $orderBy: [QueryLineItemProductReturnsOrderByOrderByClause!],
  $groupBy: QueryLineItemProductReturnsGroupByGroupByClause
) {
  LineItemProductReturns(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    customer { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    weight
    drop_shipping
    parent_id
    on_hand
    available
    incoming
    shipped
    committed
    reserved
    description
    kit_line_item_id
    type
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "SHIPPED", "operator": "GT", "value": 0 }
    ]
  },
  "orderBy": [
    { "column": "COMMITTED", "order": "DESC" }
  ]
}

LineItemInvoices — Returns line items for invoices

query GetLineItemInvoices(
  $where: QueryLineItemInvoicesWhereWhereConditions,
  $orderBy: [QueryLineItemInvoicesOrderByOrderByClause!],
  $groupBy: QueryLineItemInvoicesGroupByGroupByClause
) {
  LineItemInvoices(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    customer { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    calculate_price_from_components
    weight
    drop_shipping
    on_hand
    available
    incoming
    unbilled_quantity
    unpaid_quantity
    returned_quantity
    unreturned_quantity
    credited_quantity
    uncredited_quantity
    parent { id }
    description
    discount_type
    discount
    tax_amount
    ecotax
    total
    tax_codes { id label }
    replace_label
    kit_line_item_id
    type
    parent_id
    origin_id
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "RETURNED_QUANTITY", "operator": "GT", "value": 0 }
    ]
  },
  "orderBy": [
    { "column": "RETURNED_QUANTITY", "order": "DESC" }
  ]
}

LineItemShippingOrders — Returns line items for shipping orders

query GetLineItemShippingOrders(
  $where: QueryLineItemShippingOrdersWhereWhereConditions,
  $orderBy: [QueryLineItemShippingOrdersOrderByOrderByClause!],
  $groupBy: QueryLineItemShippingOrdersGroupByGroupByClause
) {
  LineItemShippingOrders(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    weight
    drop_shipping
    parent_id
    origin_id
    on_hand
    available
    incoming
    committed
    uncommitted
    shipped
    reserved
    delivered
    description
    kit_line_item_id
    type
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "SHIPPED", "operator": "GT", "value": 0 }
    ]
  },
  "orderBy": [
    { "column": "QUANTITY_AGGREGATE", "order": "DESC" }
  ]
}

LineItemStockAdjustments — Returns line items for stock adjustments

query GetLineItemStockAdjustments(
  $where: QueryLineItemStockAdjustmentsWhereWhereConditions,
  $orderBy: [QueryLineItemStockAdjustmentsOrderByOrderByClause!],
  $groupBy: QueryLineItemStockAdjustmentsGroupByGroupByClause
) {
  LineItemStockAdjustments(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    weight
    drop_shipping
    parent_id
    origin_id
    description
    on_hand
    available
    incoming
    kit_line_item_id
    type
    batch_numbers { id }
  }
}
{
  "orderBy": [
    { "column": "ID", "order": "DESC" }
  ]
}

LineItemRefund — Returns line items for refunds

query GetLineItemRefund(
  $where: QueryLineItemRefundWhereWhereConditions,
  $orderBy: [QueryLineItemRefundOrderByOrderByClause!],
  $groupBy: QueryLineItemRefundGroupByGroupByClause
) {
  LineItemRefund(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    customer { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    calculate_price_from_components
    weight
    drop_shipping
    on_hand
    available
    incoming
    uncredited_quantity
    description
    replace_label
    kit_line_item_id
    type
    parent_id
    origin_id
    discount
    discount_type
    ecotax
    total
    tax_codes { id label }
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "CUSTOMER_ID", "operator": "EQ", "value": 100001 }
    ]
  },
  "orderBy": [
    { "column": "LABEL", "order": "ASC" }
  ]
}

LineItemOrders — Returns line items for orders

query GetLineItemOrders(
  $where: QueryLineItemOrdersWhereWhereConditions,
  $orderBy: [QueryLineItemOrdersOrderByOrderByClause!],
  $groupBy: QueryLineItemOrdersGroupByGroupByClause
) {
  LineItemOrders(
    where: $where
    orderBy: $orderBy
    groupBy: $groupBy
  ) {
    id
    sku
    label
    variant_type
    barcode
    variant { id label }
    status
    shipping_at
    order_number
    customer { id label }
    line_itemable { id label }
    location { id label }
    quantity
    quantity_aggregate
    price
    weight
    drop_shipping
    on_hand
    available
    incoming
    shipped
    committed
    reserved
    delivered
    description
    kit_line_item_id
    type
    parent_id
    batch_numbers { id }
  }
}
{
  "where": {
    "AND": [
      { "column": "RESERVED", "operator": "GT", "value": 0 }
    ]
  },
  "orderBy": [
    { "column": "COMMITTED", "order": "DESC" }
  ]
}

Available fields by content type

Common fields (all line item types)

FieldTypeDescription
idIntUnique identifier of the line item.
skuStringSKU of the variant.
labelStringLabel of the variant.
variant_typeStringType of the variant.
barcodeStringBarcode of the variant.
variantVariantLinked variant entity.
locationLocationLinked location entity.
quantityFloatQuantity of the line item.
quantity_aggregateFloatAggregated quantity.
priceFloatPrice of the line item.
weightIntWeight of the line item (its display order; higher weight → lower position).
drop_shippingIntDrop shipping flag.
parent_idIntParent line item ID.
origin_idIntOrigin line item ID.
descriptionStringDescription of the line item.
kit_line_item_idIDKit line item ID.
typeLineItemTypeLine item type. Default: normal.
adjustment_typeStringAdjustment type (for stock adjustments).
batch_numbers[BatchNumber]Linked batch numbers.

Stock level fields (all types)

FieldTypeDescription
on_handFloatStock on hand.
availableFloatAvailable stock.
incomingFloatIncoming stock.
committedFloatCommitted stock.
reservedFloatReserved stock.

Credit Note specific fields

FieldTypeDescription
discountFloatDiscount amount.
discount_typeDiscountTypeType of discount.
ecotaxFloatEco-tax amount.
totalFloatTotal amount.
customerCustomerLinked customer.
tax_codes[TaxCode]Linked tax codes.
uncredited_quantityFloatUncredited quantity.

Estimate specific fields

FieldTypeDescription
estimate_numberStringEstimate number.
customerCustomerLinked customer.
calculate_price_from_componentsBooleanCalculate price from components.
transformed_quantityFloatTransformed quantity.
billed_quantityFloatBilled quantity.
unbilled_quantityFloatUnbilled quantity.
paid_quantityFloatPaid quantity.
unpaid_quantityFloatUnpaid quantity.
ordered_quantityFloatOrdered quantity.
unordered_quantityFloatUnordered quantity.
discount_typeDiscountTypeType of discount.
discountFloatDiscount amount.
tax_amountFloatTax amount.
ecotaxFloatEco-tax amount.
totalFloatTotal amount.
tax_codes[TaxCode]Linked tax codes.

Purchase specific fields

FieldTypeDescription
supplierSupplierLinked supplier.
deliveredFloatDelivered quantity.
uncommittedFloatUncommitted quantity.

Purchase Receipt specific fields

FieldTypeDescription
deliveredFloatDelivered quantity.
uncommittedFloatUncommitted quantity.

Product Return specific fields

FieldTypeDescription
customerCustomerLinked customer.
shippedFloatShipped quantity.

Order specific fields

FieldTypeDescription
customerCustomerLinked customer.
shippedFloatShipped quantity.
deliveredFloatDelivered quantity.
returned_quantityFloatReturned quantity.
unreturned_quantityFloatUnreturned quantity.
unbilled_quantityFloatUnbilled quantity (requires accounting.invoices capability).

Invoice specific fields

FieldTypeDescription
unbilled_quantityFloatUnbilled quantity.
unpaid_quantityFloatUnpaid quantity.
returned_quantityFloatReturned quantity.
unreturned_quantityFloatUnreturned quantity.
credited_quantityFloatCredited quantity.
uncredited_quantityFloatUncredited quantity.
discount_typeDiscountTypeType of discount.
discountFloatDiscount amount.
tax_amountFloatTax amount.
ecotaxFloatEco-tax amount.
totalFloatTotal amount.
tax_codes[TaxCode]Linked tax codes.
replace_labelBooleanReplace label flag.

Shipping Order specific fields

FieldTypeDescription
committedFloatCommitted quantity.
uncommittedFloatUncommitted quantity.
shippedFloatShipped quantity.
reservedFloatReserved quantity.
deliveredFloatDelivered quantity.
unbilled_quantityFloatUnbilled quantity (requires accounting.invoices capability).

Stock Adjustment specific fields

FieldTypeDescription
descriptionStringDescription for adjustment.
priceFloatPrice value on adjustment.
drop_shippingIntDrop shipping flag.

Filters

You can create filters based on following fields (common to all types)

FieldTypeExample
idInt{ "column": "ID", "operator": "EQ", "value": 100012 }
skuString{ "column": "SKU", "operator": "LIKE", "value": "%ABC%" }
labelString{ "column": "LABEL", "operator": "LIKE", "value": "%Product%" }
variant_typeString{ "column": "VARIANT_TYPE", "operator": "EQ", "value": "product" }
barcodeString{ "column": "BARCODE", "operator": "EQ", "value": "123456789" }
line_itemable_idInt{ "column": "LINE_ITEMABLE_ID", "operator": "EQ", "value": 100001 }
quantityFloat{ "column": "QUANTITY", "operator": "GT", "value": 0 }
priceFloat{ "column": "PRICE", "operator": "GT", "value": 10.0 }
weightInt{ "column": "WEIGHT", "operator": "GT", "value": 100 }
drop_shippingInt{ "column": "DROP_SHIPPING", "operator": "EQ", "value": 1 }
parent_idInt{ "column": "PARENT_ID", "operator": "EQ", "value": 100010 }
origin_idInt{ "column": "ORIGIN_ID", "operator": "EQ", "value": 100005 }
committedFloat{ "column": "COMMITTED", "operator": "GT", "value": 0 }
reservedFloat{ "column": "RESERVED", "operator": "GT", "value": 0 }
shippedFloat{ "column": "SHIPPED", "operator": "GT", "value": 0 }
deliveredFloat{ "column": "DELIVERED", "operator": "GT", "value": 0 }
variant_idInt{ "column": "VARIANT_ID", "operator": "EQ", "value": 100001 }
on_handFloat{ "column": "ON_HAND", "operator": "GT", "value": 0 }

Sorting

You can sort data based on following fields: id, label, sku, variant_type, barcode, line_itemable_id, quantity, variant_id, on_hand, incoming, available, kit_line_item_id, price, weight, drop_shipping, location_id, committed, reserved

query SortLineItems(
  $where: QueryLineItemsWhereWhereConditions
) {
  LineItems(
    where: $where
    orderBy: [{ column: LABEL, order: ASC }]
  ) {
    id
    label
    sku
    quantity
    price
    on_hand
    available
  }
}

Example of data returned

{
  "data": {
    "LineItemEstimates": [
      {
        "id": 100001,
        "sku": "PROD-001",
        "label": "Product Name",
        "variant_type": "product",
        "barcode": "123456789",
        "quantity": 5.0,
        "price": 25.50,
        "on_hand": 100.0,
        "available": 95.0,
        "incoming": 0.0,
        "billed_quantity": 3.0,
        "unbilled_quantity": 2.0,
        "paid_quantity": 1.0,
        "unpaid_quantity": 4.0,
        "ordered_quantity": 0.0,
        "unordered_quantity": 5.0,
        "discount_type": "percentage",
        "discount": 10.0,
        "tax_amount": 2.55,
        "ecotax": 0.0,
        "total": 127.50
      }
    ]
  }
}

Data Types

DocumentTaxRate

FieldTypeDescription
idIntTax rate ID.
tax_amountFloatAmount of tax applied.
tax_rateTaxRateTax rate details (label, rate).

BatchNumberLineItemInput

FieldTypeDescription
idIDBatch number line item ID (for updates).
quantityFloatQuantity for this batch.
batch_numberBatchNumberInputBatch number details.
serial_numbers[SerialNumberLineItemInput]Serial numbers for this batch.
serial_number_textStringSerial number text.

LineItemsFilter

FieldTypeDescription
columnStringColumn name to filter on.
operatorStringFilter operator (e.g., "EQ", "LIKE", "GT").
valueMixedFilter value.

DocumentWeight

FieldTypeDescription
amountFloatWeight amount.
unitStringWeight unit (e.g. kg, lb).

Enums

DiscountType

ValueDescription
amountFixed discount amount.
percentagePercentage-based discount.

LineItemType

ValueDescription
normalStandard product line item (default).
kitKit/bundle line item.
custom_productCustom product (variant_id = -1).
depositDeposit line item.
shipping_costShipping cost line item.
global_discountGlobal discount line item.
packagingPackaging line item.