Skip to main content
PATCH
Modify a ledger entry

Editing a ledger entry

Only the fields you provide are changed. For example, the following payload changes the text, the income account and the tax code of an entry:
  • The entry keeps its id and its attached receipts.
  • When the booking changes, the VAT is booked again and the balances of the accounts involved are recalculated.
  • To remove the VAT, set taxCode to "" or null.
The response contains the edited entry as ledgerEntry, in the same shape as when you get a ledger entry.

What can be changed

Which fields can be changed depends on the source of the entry:
  • manual: every field except reviewState.
  • bank: only description, taxCode, reviewState and the contra account. The date, amount and currency come from the bank transaction, and the bank account side may only be sent unchanged.
To change the currency, also send the new amount. exchangeRate and baseAmount work as when posting a ledger entry; changing only the exchange rate keeps the foreign amount and recalculates the CHF amount. Sending a field that cannot be changed is rejected with 400 Bad Request and the error code ledger/entry-field-not-editable. The response lists the refused fields in fields and the source of the entry.

Reviewing bank entries

Entries posted from a bank transaction by AI accounting carry a review state. Set reviewState to reviewed to confirm an entry, or to ai-proposed to mark it as awaiting review again. Editing other fields does not change the review state.

Entries that cannot be edited

Editing is refused with 403 Forbidden and one of these error codes:
  • ledger/entry-not-editable if the source of the entry is neither manual nor bank. The response also carries the source of the entry, so you know which part of Infinity it has to be changed in.
  • ledger/entry-reversed if the entry has already been reversed (Storno).
  • fiscal-year/closed if the current or new date lies in a closed fiscal year.
  • transactions/from-closed-vat-period if the current or new date lies in a closed VAT period.

Authorizations

x-api-token
string
header
required

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

Path Parameters

ledgerEntryId
string
required

The id of the ledger entry

Body

application/json

Provide the changes to save to the ledger entry in the request body. Any fields that are not provided are left unchanged.

date
string<date>

The new date in YYYY-MM-DD format. Only for entries with the source manual. Both the current and the new date must lie in an open fiscal year and outside a closed VAT period.

Example:

"2025-01-30"

description
string

The new single-line text of the ledger entry.

Required string length: 1 - 128
debitAccount
integer

The account number of the new debit account. For entries with the source bank, only the contra account can be changed; the bank account may only be sent unchanged.

Required range: 1000 <= x <= 9999
creditAccount
integer

The account number of the new credit account. For entries with the source bank, only the contra account can be changed; the bank account may only be sent unchanged.

Required range: 1000 <= x <= 9999
amount
integer

The new gross amount in cents, in the currency of the entry. Only for entries with the source manual. Required when currency changes.

Required range: x >= 1
Example:

12030

currency
string

The new 3-character currency code (ISO 4217). Only for entries with the source manual. Must be a currency enabled in the organisation; CHF turns a foreign currency entry into a CHF entry. If neither exchangeRate nor baseAmount is given, the exchange rate set for the currency in Infinity applies.

Required string length: 3
Example:

"EUR"

exchangeRate
number

The new exchange rate as 1 unit of the foreign currency = X CHF. Only for entries with the source manual, and ignored for entries in CHF. Changing only the rate keeps the foreign amount and recalculates the CHF amount.

baseAmount
integer

The CHF amount in cents, as an alternative to exchangeRate. Only for entries with the source manual.

Sending baseAmount together with exchangeRate, or for an entry in CHF, is rejected with 400 Bad Request and the error code general/missing-fields.

Required range: x >= 1
Example:

9800

taxCode

The new VAT tax code. Changing it re-books the VAT of the entry.

Which codes are accepted depends on the VAT settings of the organisation and on the date of the entry. Use GET /v1/tax-codes to list the codes available for a date.

Available options:
UN81,
UN77,
UR26,
UR25,
US38,
US37,
UO81,
UO77,
BZB81,
BZB77,
BZM81,
BZM77,
VM81,
VM38,
VM26,
VB81,
VB38,
VB26,
VM77,
VM37,
VM25,
VB77,
VB37,
VB25,
ES81,
ES26,
ES77,
ES25,
UNO,
UEX,
ULA,
ZOLLM,
ZOLLB
Example:

"UN81"

reviewState
enum<string>

Only for entries with a review state, i.e. entries posted from a bank transaction. reviewed confirms the entry, ai-proposed marks it as awaiting review again. Editing other fields does not change the review state.

Available options:
ai-proposed,
reviewed
Example:

"reviewed"

Response

Changes saved successfully.

ledgerEntry
LedgerEntry · object
required

A ledger entry is a single booking in the ledger: one amount, posted from a debit to a credit account on a date.

Infinity books the VAT of an entry as a separate VAT transaction internally, but the API never returns it on its own: it is folded into the vat property of the entry it belongs to.