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
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 fullchartOfAccountsSchema.
- Path param:
entityId(UUID) - Body:
InitializeChartFromTemplateDto(frominitializeChartFromTemplateSchema)
- 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(fromcreateLedgerAccountGroupSchema)
- 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(fromcreateLedgerAccountSchema)
- 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(fromupdateLedgerAccountSchema)
- 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