Cancel purchase order
PATCH/v1/entities/:entity_id/purchase_orders/:uuid/cancel
Cancels a purchase order that has not started receiving stock.
Requires the purchase_orders:write scope.
A purchase order can be cancelled while its status is draft or ordered, it has no
receipts, and none of its incoming stock has been updated in Shopify yet. Otherwise the
request returns 422. The is_cancellable field says whether a purchase order can be
cancelled now. An API key can cancel a purchase order, but cannot mark one as ordered,
receive it or delete it.
An in_transit purchase order can be cancelled while none of its Shopify transfers has
been created in Shopify. The response is 200 with status still in_transit; it changes
to cancelled once the transfers are withdrawn, shortly after. Sending the cancel again in
the meantime returns the same 200. If a transfer already exists in Shopify, the request
returns 422 and you cancel the transfer in Shopify instead; if the transfers are still
syncing, it returns 422 and you try again shortly.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 422
- 429
- 504
Purchase order cancelled. For an in_transit purchase order, the cancel was accepted and status stays in_transit until the transfers are withdrawn.
Missing or malformed changed_by.
The Authorization header is missing, is not HTTP Basic, or does not carry a valid API key. Create and manage keys under Settings → API keys in the Bookkeep section of the Bookkeep app.
The key does not hold purchase_orders:write, or the key's store is not linked to {entity_id}.
No purchase order with that uuid for the key's store, or it has been deleted.
The purchase order cannot be cancelled, for example because its status is not draft, ordered or in_transit, it has receipts, some of its incoming stock has already been updated in Shopify, or, for an in_transit purchase order, a transfer already exists in Shopify or the transfers are still syncing. The error says why.
Rate limit reached. The inventory endpoints share one limit of 60 requests per minute per source IP address, counted across Purchase Orders, Suppliers, Receipts and Bills. The count resets at the start of each minute. No Retry-After header is sent. The body is JSON only when the request sends Accept: application/json; otherwise it is an HTML page.
The service did not respond in time. The cancellation may or may not have been applied. Fetch the purchase order before you retry.