Skip to main content
POST
Requires the invoices:write scope and an Idempotency-Key. See Authentication and Bill a customer once.

Authorizations

Authorization
string
header
required

An API key. Its scopes decide what it may call: customers:read (List and look up customers.) customers:write (Create customers, and Xero contacts where the organisation allows it.) catalogue:read (List plans and charges.) subscriptions:read (List and look up subscriptions.) subscriptions:write (Create subscriptions, change units, end and restore them.) invoices:read (List and look up invoices.) invoices:write (Bill a customer once for charges, without a subscription.) credit_notes:read (List and look up credit notes, and where their credit was applied.) usage:write (Send usage events, which are billed to the subscription they name.)

Headers

Idempotency-Key
string
required

1 to 255 printable characters. A retry with the same key and body returns the first response.

Required string length: 1 - 255
Example:

"bill_2026-10_acme"

Body

application/json
charges
object[]
required

What to bill, once. All in one currency, each charge at most once.

Required array length: 1 - 50 elements
customer
string

The Saasybill customer id. Give this or customer_code.

Required string length: 1 - 100
customer_code
string

The organisation's own reference for the customer. Unique per organisation.

reference
string | null
Maximum string length: 255

Response

The invoice was created. If Xero refused it, xero.sync_status is failed and the invoice still exists.

id
string
required
object
string
required
Allowed value: "invoice"
customer
string
required
subscription
string | null
required
number
string | null
required

Xero's invoice number, once it is in Xero.

reference
string | null
required
status
enum<string>
required
Available options:
draft,
awaiting_approval,
approved,
paid,
voided,
deleted,
not_in_external
currency
string
required
invoice_date
string<date-time>
required

ISO 8601, UTC.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
due_date
string<date-time> | null
required

ISO 8601, UTC.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
subtotal
string
required

Excluding tax.

total
string
required

Including tax, as Xero returns it.

credit_note_amount
string
required

A decimal string, e.g. "19.9900".

amount_paid
string | null
required

A decimal string, e.g. "19.9900".

sent
boolean
required
xero
object
required
created
string<date-time>
required

ISO 8601, UTC.

Pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
lines
object[]