Create invoice
Creates a new customer invoice in the organisation. Set isDraft to false to immediately post the invoice and create the underlying transactions.
Documentation Index
Fetch the complete documentation index at: https://docs.infinity.swiss/llms.txt
Use this file to discover all available pages before exploring further.
Creating a customer invoice
Invoices belong to a template and are addressed to a contact (or a free-text recipient). They are made up of an ordered list of positions, each of which has a discriminatortype:
product— a standard billable line with aquantity,singleAmount, andcontraAccountdiscount— reduces the preceding positions, by either apercentageor an absoluteamount(exactly one of the two must be set)text— a non-billable text linesubtotal— renders the running subtotal of the preceding positions
Draft vs. posted
TheisDraft flag controls whether the new invoice is posted immediately:
isDraft: true— saves the invoice as a draft. No accounting transactions are created.isDraft: false— posts the invoice and creates the underlying transactions onopeningDate. The transaction date must fall within an editable fiscal year and VAT period.
Foreign-currency invoices
To issue an invoice in a non-primary currency, provide bothoriginalCurrency (3-character ISO 4217 code) and exchangeRate. The currency must already be enabled in the organisation, and the rate is expressed as 1 originalCurrency = X primaryCurrency (e.g. 0.98 if 1 EUR = 0.98 CHF). The two fields must always be set together or omitted together.
Example
The following payload creates a posted CHF invoice with two product lines and a 10% discount:Authorizations
API token for authentication. Obtain from your Infinity account settings.
Body
The invoice payload.
Request body for creating a customer invoice.
The id of the invoice template to render the document with.
The opening date (issue date) of the document in YYYY-MM-DD format. For invoices, this is also the date used for the posted accounting transactions.
The ordered list of positions on the document. At least one position is required, and discount positions must specify exactly one of percentage or amount.
A standard billable line item with a quantity, single amount, and contra account. Most invoice and estimate positions are of this type.
- ProductPosition
- DiscountPosition
- TextPosition
- SubtotalPosition
When true the invoice is created in draft state and no transactions are posted. Set to false to immediately post the invoice.
The id of the contact this document is addressed to. Required unless customRecipientText is provided.
An ad-hoc recipient text used when no contact is associated with the document.
2000Optional document title displayed on the rendered output.
128Payment terms for this document in days from the opening date. Defaults to 30 on create.
0 <= x <= 365Text rendered above the positions.
2000Text rendered below the positions.
2000Whether position amounts are entered gross (including VAT) or net (excluding VAT).
gross, net The language used to render the document.
de, en, fr, it The columns to render in the positions table. If not provided the template default is used.
A column that can be shown on the rendered invoice or estimate.
quantity, unit, articleNumber, name, date, vatDebt, vatRate, singleAmount, totalAmount, discountRate, positionNumber, customTextColumn1, customTextColumn2, customTextColumn3 For foreign-currency documents: the 3-character ISO 4217 currency code the document is denominated in. Must be provided together with exchangeRate. Must be a currency code that is enabled in the organisation.
3For foreign-currency documents: the conversion rate from the original currency to the primary accounting currency, expressed as 1 originalCurrency = X primaryCurrency. Must be provided together with originalCurrency.
When true the document is rendered as a QR-bill (Swiss QR-Rechnung). Defaults to false.
Response
The invoice was created successfully.
The full representation of a customer invoice.