Skip to main content

Save Bill with Lines

PUT 

/api/bills/:bill/with-lines

Save a bill's header and its lines together, in one database transaction under the bill lock. The bill editor's Save uses it: if any part is refused, nothing is written, so a failed save never leaves a new supplier, currency or date over the old lines.

Required scope: purchase-orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Lines are written first, then the header, so the header update (which rebuilds a landed cost bill's allocations) sees the final subtotal.

Body: the Update Bill fields (supplier_id, invoice_number, invoice_date, due_date, currency_id, currency_rate, payment_term_id, duplicate_acknowledged, ...) plus lines, the Update Bill Lines array (id null for a new line, delete: true to remove one).

Refused with 422, and nothing saved, for any reason either endpoint refuses: a line lowered below or removed while that much is tracked (lines.{index}.amount / lines.{index}), a line without an expense account, a goods supplier, an unacknowledged duplicate number, a currency change once costs are tracked, or a bill booked in Xero / QuickBooks Online.

Returns the saved bill.

Authentication: Requires Bearer token. Permission: edit bills (bills.update, or purchase_orders.update). Scope: purchase-orders (read/write).

Request​

Responses​

OK

Response Headers
    Content-Type