Skip to main content

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.

Required scope: purchase-orders:write

Grant 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​

OK

Response Headers
    Content-Type