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.
purchase-orders:writeGrant 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
- 200
- 401
- 403
- 404
- 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 — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
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.