Update ledgers (general ledger accounts)

Updates up to 100 existing ledgers, i.e. general ledger (GL) accounts, in the organization's live chart of accounts: rename (name), renumber (sortCode, the account number), re-parent (parentId), or retype (type, subType, debitCredit) them. To find ledger IDs, use getBooksLedgers. Each item names a ledgerId and only the fields to change; omitted fields are left unchanged. To remove a ledger's parent, list parentId in clearFields (and don't also set parentId). Each ledgerId may appear at most once.

Chart-of-accounts rules. Teal validates each update: subType must belong to type (see the type and subType fields of a ledger, as returned by getBooksLedgers); a child ledger has the same type and sub-type as its parent, so a sub-ledger can't be retyped in place; a parent can't be the ledger itself or one of its descendants; names and sort codes must be unique; required ledgers allow changes only to name, sortCode, and parentId; expense and revenue ledgers can't be cash-flow ledgers, so a cash-flow ledger can't be retyped to either; and ledgers linked to a financial account may refuse some changes.

Per-item results. The response has exactly one result per requested update, in request order: the updated ledger, in the same shape as getBooksLedgers returns, or an error with a stable code and a message saying how to fix it. A ledger that fails does not fail the request or the other ledgers, so the status is 200 whatever the item outcomes. The response's failedCount is 0 exactly when every item succeeded, and succeededCount plus failedCount equals the number of results; when failedCount is above 0, check each result's error. Error codes include invalidLedger, missingParameters, duplicateName, duplicateSortCode, invalidLedgerType, invalidLedgerParent, invalidLedgerReportCashFlow, modifyingRequiredLedger, and unknownError; treat any code not listed here as unknownError.

Request errors. These are returned as an HTTP error status, and nothing is updated: the token lacks the scope to update ledgers; a ledger or new parent ledger is outside the Books instance or read-only (linked to a Mercury account); the list is empty; it has more than 100 updates; or a ledgerId is repeated.

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

The Books instance to act on. Must be the token organization's own instance, which it defaults to.

Body Params

Request to update general ledgers.

ledgers
array of objects
required

The ledger updates to apply, from 1 to 100 ('maxBooksAPILedgerWrites'), processed in order. Each ledgerId may appear at most once.

ledgers*
Responses

400

Invalid body or booksId

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json