Preview Receipt Import
POST/api/purchase-orders/:purchase_order/receipt-import/preview
Validate the rows of a receipt spreadsheet against a purchase order and get back the receive payload. Changes nothing, so it is safe to call again right before posting to catch receipts recorded in the meantime.
purchase-orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token with permission to receive purchase orders.
Request body:
file_name(string, optional, max 255) — echoed back.inbound_shipment_id(integer, optional) — match only this shipment's lines; Pending is what the shipment still expects.rows(array, required, 1–5000) — one object per spreadsheet row:row_number(integer, required),line(purchase order line ID, optional),sku,supplier_sku,barcode,quantity,bin,lot_number,expiry_date,manufacture_date,received_date(all optional strings).
Matching: line first, then SKU, then the order supplier's supplier SKU, then barcode (trimmed, case-insensitive). A SKU-column value is also tried as a supplier SKU and a barcode. When a product is on several lines, rows fill the first line that still has quantity pending.
Row status: ready, warning (posts; e.g. lot columns on a product that is not lot-tracked), skipped (blank or zero quantity) or error (not on the order, bad quantity, over-receipt, unknown or non-receivable bin, lot-tracked product without lot number and expiry, serialized product, a line mixing binned and un-binned rows). Over-receipt is checked on the total per line; every row of a line with an error is left out.
receipt_lines is ready to send as-is to Receive Shipment (POST /api/inbound-shipments/receive) with purchase_order_id, received_at and optionally inbound_shipment_id and source_file_name. Each line carries expected_received_quantity, so the receive is refused (422 receipt_lines_stale) if the line was received in the meantime. received_date is the file's received date when every dated row agrees, else null with a message.
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Content
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.