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 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_name, metadata, note and tags, returns 422; the merchant changes those in the Bookkeep app. PATCH works only while status is draft. Once the merchant marks the purchase order as 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. The id comes from the line items of an earlier response, including include=line_items on the read endpoints. An id that is not a line of this purchase order returns 422. 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. Two lines in one request with the same client_line_id return 422. A new line sent with only a sku is matched to a product the same way as on create, and a SKU that matches no product, or more than one, returns 422. Removing a line whose stock has already been received is refused with 422.

When lines change, subtotal, tax_amount and total are calculated again from the lines.

Request​

Responses​

Purchase order updated.