Skip to main content
PATCH
/
v1
/
invoices
/
{invoiceId}
Modify invoice
curl --request PATCH \
  --url https://api.infinity.swiss/v1/invoices/{invoiceId} \
  --header 'Content-Type: application/json' \
  --header 'x-api-token: <api-key>' \
  --data '
{
  "template": "<string>",
  "openingDate": "2023-12-25",
  "positions": [
    {
      "name": "<string>",
      "singleAmount": 12000,
      "quantity": 2,
      "contraAccount": 5499,
      "unit": "<string>",
      "articleNumber": "<string>",
      "description": "<string>",
      "date": "<string>",
      "discountRate": 50,
      "customTextColumns": {
        "customTextColumn1": "<string>",
        "customTextColumn2": "<string>",
        "customTextColumn3": "<string>"
      }
    }
  ],
  "recipient": "<string>",
  "customRecipientText": "<string>",
  "title": "<string>",
  "payableInDays": 182,
  "introductoryText": "<string>",
  "closingText": "<string>",
  "columns": [],
  "originalCurrency": "<string>",
  "exchangeRate": 123,
  "isDraft": true,
  "isQrInvoice": true
}
'
{
  "invoice": {
    "id": "<string>",
    "isDraft": true,
    "number": "<string>",
    "organisation": "<string>",
    "template": "<string>",
    "openingDate": "2023-12-25",
    "dueDate": "2023-12-25",
    "positions": [
      {
        "name": "<string>",
        "singleAmount": 12000,
        "quantity": 2,
        "contraAccount": 5499,
        "id": "<string>",
        "unit": "<string>",
        "articleNumber": "<string>",
        "description": "<string>",
        "date": "<string>",
        "discountRate": 50,
        "customTextColumns": {
          "customTextColumn1": "<string>",
          "customTextColumn2": "<string>",
          "customTextColumn3": "<string>"
        },
        "totalAmount": 123,
        "vatDebt": 123,
        "originalCurrency": "<string>",
        "exchangeRate": 123
      }
    ],
    "totalAmount": 123,
    "totalNetAmount": 123,
    "totalVatDebt": 123,
    "isQrInvoice": true,
    "totalAmountPaid": 123,
    "totalRestAmount": 123,
    "isPaid": true,
    "isOverpaid": true,
    "isAnnulled": true,
    "recipient": "<string>",
    "customRecipientText": "<string>",
    "title": "<string>",
    "payableInDays": 123,
    "introductoryText": "<string>",
    "closingText": "<string>",
    "originalCurrency": "<string>",
    "exchangeRate": 123,
    "columns": [],
    "emailDeliveries": [
      {
        "recipientEmail": "jsmith@example.com",
        "status": "<string>",
        "timestamp": "2023-11-07T05:31:56Z"
      }
    ],
    "publicPdfUrl": "<string>"
  }
}

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.

Modifying an invoice

Only the fields provided in the request body are updated. Any field that is omitted is left unchanged.

Posting and unposting

Transitioning the isDraft flag drives the underlying transactions:
  • truefalse — posts the invoice and creates the transactions on the invoice’s openingDate.
  • falsetrue — unposts the invoice and removes the transactions.
  • falsefalse — recalculates and updates the existing transactions to reflect the new values.
In every case, the relevant fiscal year and VAT period must be editable.

Authorizations

x-api-token
string
header
required

API token for authentication. Obtain from your Infinity account settings.

Path Parameters

invoiceId
string
required

The id of the specific invoice.

Body

application/json

The fields to update.

Request body for modifying a customer invoice. All fields are optional; omitted fields are left unchanged.

template
string

The id of the invoice template to render the document with.

openingDate
string<date>

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.

positions
(ProductPosition · object | DiscountPosition · object | TextPosition · object | SubtotalPosition · object)[]

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.

recipient
string

The id of the contact this document is addressed to. Required unless customRecipientText is provided.

customRecipientText
string

An ad-hoc recipient text used when no contact is associated with the document.

Maximum string length: 2000
title
string

Optional document title displayed on the rendered output.

Maximum string length: 128
payableInDays
integer

Payment terms for this document in days from the opening date. Defaults to 30 on create.

Required range: 0 <= x <= 365
introductoryText
string

Text rendered above the positions.

Maximum string length: 2000
closingText
string

Text rendered below the positions.

Maximum string length: 2000
amountMode
enum<string>

Whether position amounts are entered gross (including VAT) or net (excluding VAT).

Available options:
gross,
net
language
enum<string>

The language used to render the document.

Available options:
de,
en,
fr,
it
columns
enum<string>[]

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.

Available options:
quantity,
unit,
articleNumber,
name,
date,
vatDebt,
vatRate,
singleAmount,
totalAmount,
discountRate,
positionNumber,
customTextColumn1,
customTextColumn2,
customTextColumn3
originalCurrency
string

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.

Required string length: 3
exchangeRate
number

For 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.

isDraft
boolean

Transitioning from true to false posts the invoice and creates transactions. Transitioning from false to true unposts them.

isQrInvoice
boolean

Response

Changes saved successfully.

invoice
Invoice · object

The full representation of a customer invoice.