Update PO Line
PATCH/api/purchase-order-lines/:purchase_order_line
Update a single purchase order line. Designed for the PO grid's inline-edit interactions (tax rate, quantity, unit cost, discount, description, FOC toggle, nominal code).
purchase-orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Concurrency: Shares the per-PO Redis lock used by PATCH /api/purchase-orders/:purchase_order so concurrent edits on the same purchase order serialize rather than collide. The endpoint will wait up to 10 seconds for the lock; if it cannot acquire it, returns 409.
Request body (all fields optional — only sent fields are touched):
quantity(numeric, min 0, < 10000000): new ordered quantity. Validated againstreceived_quantityandinvoice_total— cannot drop below either.amount(numeric, min 0, < 10000000): unit cost.description(nullable string, max 255): free-text override for the product name on this line.tax_rate_id(nullable integer, exists intax_rates): set or clear the tax rate. When cleared,tax_allocationis reset to 0.discount(nullable numeric, 0–100): percentage discount. Stored asdiscount_rate(e.g. 25 → 0.25).nominal_code_id(nullable integer, exists innominal_codes).is_free_of_charge(boolean): toggle the FOC flag.free_of_charge_reason(nullable enum, required whenis_free_of_charge=true): the reason the line is free of charge.country_of_origin(nullable ISO 3166-1 alpha-2): line-level country of origin for the customs duty estimate; overrides the product's country of origin. Null falls back to the product.claims_preference(boolean): claim a preferential (trade-agreement) duty rate for this line when one exists for its code and origin.
Changing country_of_origin or claims_preference marks the line's duty estimate stale so it is recalculated.
Side effects:
- Recomputes
tax_allocationwhenever the tax rate or any subtotal input (quantity/amount/discount) changes. - Recomputes the parent PO's
total_costandtotal_quantity. - Refreshes the PO's
receipt_statuswhen the quantity changes. - When the quantity is reduced, excess awaiting-receipt inventory allocations on this line are reverted so the next coverage sync can rebalance them.
Returns the refreshed purchase order line object.
Requires permission: purchase_orders.update
Request
Responses
- 200
- 401
- 403
- 404
- 409
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden
Response Headers
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Conflict
Unprocessable Entity
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.