Create a bill

Creates a draft purchase bill; approving it is a separate action that posts it to the ledger. Each line names the account it posts to by account_id (the chart-of-accounts id from the chart of accounts list: use it when the account has no code) or by account_code; when both are sent they must name the same account. An account_id that is not an active expense, cost of sales or asset account of the company, or that is a control account (accounts receivable, accounts payable, VAT, a bank account's ledger), is refused with 422 bill_line_account_unavailable, naming the line in error.fields. Each line names its tax rule by tax_rule_id (the id from the tax rules list: use it when the rule has no code) or by tax_code, and the rate is always the rule's own; when both are sent they must name the same rule. A tax_rule_id that is not a purchase or no-VAT tax rule of the company is refused with 422 bill_line_tax_rule_unavailable; a tax_rule_id and tax_code that name different rules with 422 bill_line_tax_rule_mismatch. attachment_ids (up to 5) copies files the caller attached in Cybooks AI, in their own conversations, onto the new bill as its documents; it needs the access_ask_cybooks permission (403 cybooks_ai_access_required), and an id that is not such a file of the caller is refused with 404 attachment_not_found. Idempotency-Key is required and stores the terminal response for 24 hours. Requires the bills:write OAuth scope.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

Fields accepted to create a bill. The schema identifies required and optional values.

uuid
required
uuid
required
string
enum
required
Allowed:
date
required
date | null
date | null
date | null
string | null
string | null
string | null
string | null
uuid | null
uuid | null
uuid | null

Where the stock goes; the main warehouse when empty.

attachment_ids
array of uuids | null
attachment_ids
line_items
array of objects
required
length ≥ 1
line_items*
Headers
string
required
length ≤ 191

Required unique key whose request hash and terminal response are stored durably for 24 hours.

Responses

Language
Credentials
OAuth2
Missing 1 required scope
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json
*/*