Record a retailer's purchase order, or apply onDuplicate to the one with its externalId in the channel

The retailer's PO identity is externalId within the channel: a transaction advisory lock on it is taken before the lookup, so concurrent deliveries resolve to one purchase order. onDuplicate update (the default) changes the fields sent and answers unchanged when nothing differs; skip answers the stored PO; error is 409 duplicate. Lines resolve their product by id, externalId in the channel, sku, barcode; a line whose product does not resolve is kept unmapped with a warning (accept refuses until it is mapped). Totals are recomputed: a mismatch is 422 totals_mismatch with the computed values.

Scope: purchase-orders:write, channel:write or admin.

Idempotency: send Idempotency-Key; a retry with the same key replays the first answer.

Rate limit: write class, 1,200 requests per minute per tenant by default (read class 6,000). Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; a refusal is 429 rate_limited with Retry-After.

Body Params
string
^(?:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}|[0-9a-fA-F]{24})$

Sales channel id: a uuid, or a legacy 24-hex id.

string
required
length between 1 and 255

The integration's own id for the document, unique within its channel.

string
length between 1 and 100
^[0-9]{4}-[0-9]{2}-[0-9]{2}$

YYYY-MM-DD (anchored at 12:00 UTC) or an ISO-8601 timestamp.


A date: stored at 12:00 UTC.

enum

The EDI provider that delivered the PO; default unknown.

customer
object
string
length between 1 and 100
string
length between 1 and 100
string
length between 1 and 255
string
length between 1 and 100
string
length between 1 and 255
shipTo
object
billTo
object
items
array of objects
required
length between 1 and 1000
items*
string
length between 1 and 100
product
object
string
length between 1 and 100

The retailer's item code, kept when the product does not resolve.

string
length between 1 and 255

Kept when the product does not resolve; a product line takes the product name.

integer
required
0 to 1000000
required
length ≤ 24
^[0-9]{1,14}(\.[0-9]{1,8})?$

A non-negative decimal amount in currency units ("12.50"); numbers are accepted.

length ≤ 24
^[0-9]{1,14}(\.[0-9]{1,8})?$

A non-negative decimal amount in currency units ("12.50"); numbers are accepted.

discounts
array of objects
length ≤ 50
discounts
boolean
string
length ≤ 10000
metadata
object

Keys 1 to 100 characters, values up to 1000.

totals
object
required

Recomputed by the server: subtotal from the lines, total from subtotal + shipping + salesTax + dutyTax + vat - discount. A mismatch is 422 totals_mismatch with the computed values.

discounts
array of objects
length ≤ 50
discounts
^[0-9]{4}-[0-9]{2}-[0-9]{2}$

YYYY-MM-DD (anchored at 12:00 UTC) or an ISO-8601 timestamp.


A date: stored at 12:00 UTC.

^[0-9]{4}-[0-9]{2}-[0-9]{2}$

YYYY-MM-DD (anchored at 12:00 UTC) or an ISO-8601 timestamp.


A date: stored at 12:00 UTC.

^[0-9]{4}-[0-9]{2}-[0-9]{2}$

YYYY-MM-DD (anchored at 12:00 UTC) or an ISO-8601 timestamp.


A date: stored at 12:00 UTC.

string
length between 1 and 100
integer
0 to 3650
string
length between 1 and 255
string
length between 1 and 255
thirdPartyBilling
object
metadata
object

Keys 1 to 100 characters, values up to 1000.

string
length ≤ 10000
enum

What a POST does when the document already exists. Default 'update' (D7).

Headers
string
length between 7 and 50

Any string of 7 to 50 characters that identifies this request (an order number, a webhook id). A retry with the same key and the same body answers the first result with Idempotent-Replayed: true; the same key with a different body is 422 idempotency_key_reused; a concurrent request with the same key is 409 in_progress with Retry-After. Recommended on every write.

Responses

Language
Credentials
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json