Purchases Queries

Query purchase orders, supplier information, delivery status, and validation workflow.

Purchase — Returns a single purchase order by id

Example Query:

query GetPurchase($id: ID!) {
  Purchase(id: $id) {
    id
    label
    status
    dated_at
    shipping_at
    total_units
    update_incoming
    subtotal
    total
    currency { id label }
    supplier { id label }
    line_items {
      id
      variant { id label }
      quantity
      price
    }
    purchase_receipts {
      paginatorInfo { total }
      data { id label }
    }
  }
}

Purchases — Returns a paginated list of purchase orders with sorting and filters

query Purchases(
  $where: QueryPurchasesWhereWhereConditions,
  $orderBy: [QueryPurchasesOrderByOrderByClause!],
  $search: String,
  $first: Int,
  $page: Int
) {
  Purchases(
    where: $where,
    orderBy: $orderBy,
    search: $search,
    first: $first,
    page: $page
  ) {
    paginatorInfo {
      total
      currentPage
    }
    data {
      id
      label
      status
      dated_at
      supplier { id label }
    }
  }
}

Available fields

FieldTypeDescription
idIntUnique identifier.
labelStringPurchase order number.
statusPurchaseStatusCurrent status.
dated_atDateDocument date.
created_atDateTimeCreation time.
updated_atDateTimeLast update time.
shipping_atDateExpected delivery date.
total_unitsFloatTotal quantity ordered.
total_units_aggregateFloatSum of units for filtered orders.
update_incomingBooleanTrue if items update incoming stock levels.
notesStringPublic notes for documents.
internal_notesStringPrivate notes.
for_the_attention_ofStringSpecific recipient name.
external_referenceStringMerchant internal reference.
tax_typeTaxTypeTax calculation method (Exclusive/Inclusive).
discount_typeDiscountTypeGlobal discount type (Fixed/Percentage).
total_without_taxFloatTotal excluding taxes.
total_ecotaxFloatTotal environmental tax.
subtotalFloatValue before taxes and discounts.
totalFloatGrand total.
exchange_rateFloatCurrency exchange rate.
currencyCurrencyDocument currency.
supplierSupplierLinked supplier.
line_items[LineItemPurchase]List of items.
location_labelStringSource/Target location label.
drop_shippingBooleanTrue if drop shipping is active.
committed_quantityFloatQuantity committed to stock.
uncommitted_quantityFloatQuantity awaiting commitment.
reserved_quantityFloatQuantity currently reserved.
delivered_quantityFloatQuantity physically delivered.
remaining_shipping_costFloatUnallocated shipping costs.
integrations[Integration]Linked external platforms.
purchase_receipts_countIntNumber of linked purchase receipts.
purchase_receipts[PurchaseReceipt]Linked receipts history.
orders_countIntNumber of linked sales orders.
orders[Order]Linked sales orders.
has_batch_numbersBooleanTrue if items have batch tracking.
tracking_completedBooleanTrue if all tracking info is entered.
stock_allocation_statusStockAllocationStatusStock commitment progress.
delivery_statusDeliveryStatusPhysical reception progress.
custom_fields[EntityCustomField]Custom fields for this entity.
validation_rules_steps[DocumentValidationRuleStep]Approval workflow progress.

Filters

The following fields can be used in the where parameter:

id, label, status, total_units, update_incoming, dated_at, created_at, updated_at, supplier_id, currency, shipping_at, committed_quantity, uncommitted_quantity, delivered_quantity, reserved_quantity, orders_count, purchase_receipts_count, variant_id, variant_label, variant_sku, location_id, drop_shipping, batch_number_id, has_batch_numbers, tracking_completed, valider, stock_allocation_status, delivery_status.

Example Filters:

FieldExample
status{ "column": "STATUS", "operator": "EQ", "value": "active" }
supplier_id{ "column": "SUPPLIER_ID", "operator": "EQ", "value": 100002 }
variant_id{ "column": "VARIANT_ID", "operator": "EXISTS", "value": 200050 }
delivery_status{ "column": "DELIVERY_STATUS", "operator": "EQ", "value": "partially_delivered" }

Sorting

You can sort results using the orderBy parameter:

  • id
  • label
  • notes
  • status
  • dated_at
  • created_at
  • shipping_at
  • total_units
  • update_incoming
  • exchange_rate
  • currency
  • supplier_id
  • supplier_label
  • location_label
  • committed_quantity
  • uncommitted_quantity
  • delivered_quantity
  • reserved_quantity

Grouping Options

You can group purchase orders using the groupBy parameter for reports:

FieldDescription
idGroup by internal ID.
yearGroup by year of dated_at.
monthGroup by month of dated_at.
dayGroup by day of dated_at.

Data Types

ValidationRuleWarning

FieldTypeDescription
messageString!Warning message describing the validation failure.
document_idIntID of the related document, if applicable.
validation_rules[[ValidationRule!]!]List of validation rules that triggered this warning.

Enums

PurchaseStatus

ValueDescription
unpublishedDraft status (hidden).
draftDocument created, awaiting internal processing.
validationAwaiting supervisor validation.
rejectedDocument rejected by supervisor.
activePublished and confirmed.
completedAll items fully received and processed.
archivedMoved to long-term storage.
cancelledDocument voided.

StockAllocationStatus

ValueDescription
not_allocatedNo stock impact yet.
partially_allocatedSome items confirmed in stock.
allocatedFull order quantity confirmed in stock.

DeliveryStatus

ValueDescription
not_deliveredNo items received yet.
partially_deliveredPartial reception processed.
deliveredAll items physically received.

DiscountType

ValueDescription
amountFixed discount amount.
percentagePercentage-based discount.

TaxType

ValueDescription
exclusiveTax calculated on top of the net price.
inclusiveTax included in the displayed price.

Data Types

DocumentValidationRuleStep

Represents a validation step attached to a document.

FieldTypeDescription
idIntValidation step ID.
statusStringCurrent status of the validation step.
validation_rules_stepValidationRuleStepStep definition linked to this document step.

ValidationRuleStep

FieldTypeDescription
idIntUnique identifier.
stepIntStep number in the validation workflow.
validers[ValidationRuleStepValider]Users who can validate this step.
send_alertBooleanWhether to send alerts for this step.

ValidationRuleStepValider

FieldTypeDescription
user_profile_idIntUser profile ID.
user_profileUserProfileAssociated user profile.