Deletes up to 100 ledgers, i.e. general ledger (GL) accounts, from the organization's chart of accounts, by ledger ID. To find ledger IDs, use getBooksLedgers. Ledgers are deleted one at a time in request order, so list each child ledger before its parent: a parent listed before its child still has that child when it is reached and is not deleted. A repeated ID is processed once, at its first position. This operation never deletes journal entries.
Per-item results. The response has one result per distinct requested ID, in request order: its ledgerId and deleted: true, or deleted: false with an error that has 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.
Per-item error codes (error.code) and how to fix them:
deletingLedgerWithActivity: the ledger has activity, such as line entries. Move or delete its journal entries first; this operation won't delete them.deletingParentLedger: the ledger still has child ledgers. Delete its children first, or list them before the parent in the same request.deletingLinkedLedger: the ledger is linked to a bank or other source account. Unlink the account first.deletingRequiredLedger: the chart of accounts requires this ledger. It cannot be deleted.integrationMapped: an accounting, invoicing, commerce, or Plaid integration is mapped to the ledger. Remove the mapping first.unknownError: the ledger could not be deleted for another reason. Readmessage; retry, or treat any code not listed here the same way.
Request errors. These are returned as an HTTP error status, and nothing is deleted: the token lacks the scope to delete ledgers; a ledger is outside the Books instance or read-only (linked to a Mercury account); the list is empty; or it has more than 100 distinct IDs.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
400Invalid body or booksId

