Skip to main content
Build an order-tracking view from stable order and line IDs. One order can have several shipments, and one shipment can contain lines from several orders. Shipment plans, physical receipts, invoices, and payments are separate records. Before you start, set your API key and brand, save amber-client.mjs, and use Node.js 22 or later.
1

Choose the order

Pick a returned id and set ORDER_ID. Replace the example order number with yours, or use externalOrderCode for your ERP reference. Combine status and supplierId filters to narrow the result. See business identifier lookups.
2

Join order lines to shipment lines

Use /order-shipments?orderId= to find the shipments; /shipments does not accept orderId. Filter each shipment’s lines by their orderItemId so another order’s quantities are not attributed to this order.
track-order.mjs
An order with no shipments or receipts still produces a valid result with empty arrays. Shipment items without a matching order-line link are omitted from this order’s items; do not guess their ownership from a SKU or name.
3

Interpret the result

Use order.details for source dates, terms, custom fields, and exact decimal totals. /order-items preserves unitPrice as a decimal string; the order’s compact lineItems summary uses numeric prices.Shipment estimatedArrivalDate is a forecast; actualArrivalDate records arrival. Goods-receipt lines expose qtyReceived separately. Do not add received quantities from both shipment items and goods receipts as though they were independent deliveries.

Add production and packing details

All collection paths below use the same brand prefix and pagination helper: Retain retraction and revision metadata when building a current-state view; source history is not necessarily a list of additive quantities.

Add invoices and payment records

/payments returns obligations, not proof that money moved. Preserve settlement track, currency, cancellation, and hold metadata; do not infer a paid balance by summing every record indiscriminately. Amounts on these source resources are decimal strings. Use document downloads for invoice or receipt files attached to the order or payment. For a warehouse-wide export, page each collection once and join locally to reduce request volume. Follow recurring export guidance instead of assuming that an order timestamp covers changes to every child.