Skip to main content

Update draft purchase order line items

PATCH 

/v1/entities/:entity_id/purchase_orders/:uuid

Adds, updates, or removes line items on a draft purchase order, and sets its lifecycle dates.

Requires the purchase_orders:write scope. The key's shop must also be linked to {entity_id}, else 403 — see the API key scheme on the Authentication page. The only keys accepted under purchase_order are line_items_attributes, order_placed_date, order_shipped_date, and order_cancelled_date; any other key — including currency, destination_location_id, supplier_id, supplier_name, metadata, note, and tags — is forbidden on PATCH and returns 422 (merchants change those through the Bookkeep app). Only works while status is draft — once the merchant marks the purchase order ordered, PATCH returns 422.

Include id on a line to update it, omit id to add a new line, and set _destroy: true on a line to remove it. A line sent without id but carrying a client_line_id that already exists on this purchase order updates that existing line rather than adding one, so reuse a client_line_id only when you mean to update. Removing a line whose stock has already been received is refused with 422.

Request

Responses

Purchase order updated.