Skip to main content
The Chart of Accounts is the full tree of Account Groups and Ledger Accounts for an Entity. You can initialize it from a template, create groups and accounts individually, and read the whole chart in one call. This page also covers the Ledger Account endpoints under entities/:entityId/ledger/accounts.
Sources: apps/erp-backend/src/ledger-core/chart-of-accounts/chart-of-accounts.controller.ts and apps/erp-backend/src/ledger-core/ledger/ledger.controller.ts.

GET /api/entities/:entityId/ledger/chart-templates

List the available chart templates that can be used to initialize an Entity’s Chart of Accounts.
  • Success response: Array of chartTemplateSummarySchema
  • Status: 200

GET /api/entities/:entityId/ledger/chart-of-accounts

Read the full Chart of Accounts for an Entity in one document. The response contains all Account Groups and all Ledger Accounts, with derived facts computed on read.
  • Path param: entityId (UUID)
  • Success response: chartOfAccountsSchema{ groups, accounts }
  • Status: 200
Each account in accounts carries:

POST /api/entities/:entityId/ledger/chart-initializations

Initialize the Chart of Accounts from a template. The Entity must have an empty chart. The response is the full chartOfAccountsSchema.
  • Path param: entityId (UUID)
  • Body: InitializeChartFromTemplateDto (from initializeChartFromTemplateSchema)
  • Success response: chartOfAccountsSchema
  • Status: 201

POST /api/entities/:entityId/ledger/account-groups

Create a new Account Group within the Chart of Accounts.
  • Path param: entityId (UUID)
  • Body: CreateLedgerAccountGroupDto (from createLedgerAccountGroupSchema)
  • Success response: createLedgerAccountGroupResultSchema{ group }
  • Status: 201

GET /api/entities/:entityId/ledger/accounts

List all Ledger Accounts for an Entity.
  • Path param: entityId (UUID)
  • Success response: Array of ledgerAccountSchema
  • Status: 200

POST /api/entities/:entityId/ledger/accounts

Create a new Ledger Account.
  • Path param: entityId (UUID)
  • Body: CreateLedgerAccountDto (from createLedgerAccountSchema)
  • Success response: createLedgerAccountResultSchema{ account } (with derived facts)
  • Status: 201
normalSide is derived from type by the database. Do not send it in the payload.

PATCH /api/entities/:entityId/ledger/accounts/:accountId

Edit an existing Ledger Account. At least one field must be provided. Accounts with entries can only change type within compatible groups (for example, income to other_income, or operating_expense to cost_of_goods_sold).
  • Path params: entityId (UUID), accountId (UUID)
  • Body: UpdateLedgerAccountDto (from updateLedgerAccountSchema)
  • Success response: updateLedgerAccountResultSchema{ account }
  • Status: 200

DELETE /api/entities/:entityId/ledger/accounts/:accountId

Delete a Ledger Account. The account must have no blocking foreign keys (no lines, no Bank Account, no Partner default purchase account).
  • Path params: entityId (UUID), accountId (UUID)
  • Success response: deleteLedgerAccountResultSchema{ deletedAccountId }
  • Status: 200

Domain error codes

Status codes