Query purchase orders, supplier information, delivery status, and validation workflow.
Example Query:
GraphQL
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 }
}
}
}
GraphQL
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 }
}
}
}
Field Type Description idInt Unique identifier. labelString Purchase order number. statusPurchaseStatus Current status. dated_atDate Document date. created_atDateTime Creation time. updated_atDateTime Last update time. shipping_atDate Expected delivery date. total_unitsFloat Total quantity ordered. total_units_aggregateFloat Sum of units for filtered orders. update_incomingBoolean True if items update incoming stock levels. update_stockBoolean True if this purchase updates stock levels. notesString Public notes for documents. internal_notesString Private notes. for_the_attention_ofString Specific recipient name. external_referenceString Merchant internal reference. tax_typeTaxType Tax calculation method (Exclusive/Inclusive). discount_typeDiscountType Global discount type (Fixed/Percentage). total_without_taxFloat Total excluding taxes. total_ecotaxFloat Total environmental tax. subtotalFloat Value before taxes and discounts. totalFloat Grand total. exchange_rateFloat Currency exchange rate. currencyCurrency Document currency. supplierSupplier Linked supplier. line_items[LineItemPurchase] List of items. location_labelString Source/Target location label. drop_shippingBoolean True if drop shipping is active. committed_quantityFloat Quantity committed to stock. uncommitted_quantityFloat Quantity awaiting commitment. reserved_quantityFloat Quantity currently reserved. delivered_quantityFloat Quantity physically delivered. remaining_shipping_costFloat Unallocated shipping costs. integrations[Integration] Linked external platforms. purchase_receipts_countInt Number of linked purchase receipts. purchase_receipts[PurchaseReceipt] Linked receipts history. orders_countInt Number of linked sales orders. orders[Order] Linked sales orders. has_batch_numbersBoolean True if items have batch tracking. tracking_completedBoolean True if all tracking info is entered. stock_allocation_statusStockAllocationStatus Stock commitment progress. delivery_statusDeliveryStatus Physical reception progress. custom_fields[EntityCustomField] Custom fields for this entity. validation_rules_steps[DocumentValidationRuleStep] Approval workflow progress.
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, season_id, 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:
Field Example 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 }season_id{ "column": "SEASON_ID", "operator": "EXISTS", "value": 200001 }delivery_status{ "column": "DELIVERY_STATUS", "operator": "EQ", "value": "partially_delivered" }
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
You can group purchase orders using the groupBy parameter for reports:
Field Description idGroup by internal ID. yearGroup by year of dated_at. monthGroup by month of dated_at. dayGroup by day of dated_at.
Field Type Description idInt! Unique identifier. labelString! Rule name. descriptionString Detailed description. document_typeString Applies to this document type (e.g. Purchase). amount_minInt Minimum amount threshold. amount_maxInt Maximum amount threshold. send_alertBoolean Whether to send an alert on trigger. users[UserProfile] Users assigned to this rule. steps[ValidationRuleStep] Approval steps.
Field Type Description messageString! Warning message describing the validation failure. document_idInt ID of the related document, if applicable. validation_rules[[ValidationRule!]!] List of validation rules that triggered this warning.
Value Description 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.
Value Description not_allocatedNo stock impact yet. partially_allocatedSome items confirmed in stock. allocatedFull order quantity confirmed in stock.
Value Description not_deliveredNo items received yet. partially_deliveredPartial reception processed. deliveredAll items physically received.
Value Description amountFixed discount amount. percentagePercentage-based discount.
Value Description exclusiveTax calculated on top of the net price. inclusiveTax included in the displayed price.
Represents a validation step attached to a document.
Field Type Description idInt Validation step ID. statusString Current status of the validation step. validation_rules_stepValidationRuleStep Step definition linked to this document step.
Field Type Description idInt Unique identifier. stepInt Step number in the validation workflow. validers[ValidationRuleStepValider] Users who can validate this step. send_alertBoolean Whether to send alerts for this step.
Field Type Description user_profile_idInt User profile ID. user_profileUserProfile Associated user profile.