Skip to main content
An Allocation settles one debit line against one credit line on an Open-Item Account. The match endpoint lets you auto-allocate a selection of lines. This page covers the full CRUD for Allocations plus the match operation.
Source: apps/erp-backend/src/ledger-core/reconciliation/reconciliation.controller.ts.

GET /api/entities/:entityId/ledger/allocations

List Allocations for a specific Ledger Entry Line. Returns all reconciliationAllocationSchema rows where either the debit or credit side matches the given line.
  • Path param: entityId (UUID)
  • Query param: lineId (UUID, required)
  • Success response: Array of reconciliationAllocationSchema
  • Status: 200

POST /api/entities/:entityId/ledger/allocations

Create a single Allocation between two lines. The caller supplies the idempotency id. The debit line must be on the debit side, the credit line on the credit side, both must belong to the same Open-Item Account, and the amount must not exceed either line’s open amount.
  • Path param: entityId (UUID)
  • Body: CreateReconciliationAllocationDto (from createReconciliationAllocationSchema)
  • Success response: reconciliationAllocationSchema
  • Status: 201

DELETE /api/entities/:entityId/ledger/allocations/:allocationId

Delete an Allocation. This restores the open amounts of the two lines it settled.
  • Path params: entityId (UUID), allocationId (UUID)
  • Success response: reconciliationAllocationSchema (the deleted allocation)
  • Status: 200

POST /api/entities/:entityId/ledger/allocations/match

Auto-match a selection of Open-Item lines. The server splits the selection by side, greedily decomposes into debit/credit pairs, and creates every Allocation in one transaction. The selection must contain at least two lines, at least one debit and one credit, and all lines must belong to the same Open-Item Account.
  • Path param: entityId (UUID)
  • Body: MatchLinesDto (from matchLinesSchema)
  • Success response: matchLinesResultSchema{ allocations, settledLines, openTotal }
  • Status: 201

Domain error codes

Status codes