Manage financial ledgers, account balances, and ledger-related operations in the accounting system.
/api/ledger
The Ledger API provides endpoints for managing financial records including ledger entry creation, retrieval, balance tracking, and export functionality. Supports comprehensive financial reporting and reconciliation.
Creates a new ledger entry for financial transaction.
{
"customerId": "cust_123",
"transactionDate": "2026-06-02T10:30:00Z",
"documentType": "invoice",
"documentId": "inv_789",
"description": "Invoice payment received",
"debit": 329.98,
"credit": 0,
"balance": 329.98,
"currency": "USD",
"reference": "INV-2026-001"
}
{
"id": "ledger_1234",
"customerId": "cust_123",
"transactionDate": "2026-06-02T10:30:00Z",
"debit": 329.98,
"balance": 329.98,
"createdAt": "2026-06-02T10:30:00Z"
}
Gets ledger entry details by ID.
| Parameter | Type |
|---|---|
| id | string |
{
"id": "ledger_1234",
"customerId": "cust_123",
"transactionDate": "2026-06-02T10:30:00Z",
"documentType": "invoice",
"documentId": "inv_789",
"description": "Invoice payment received",
"debit": 329.98,
"credit": 0,
"balance": 329.98,
"currency": "USD",
"reference": "INV-2026-001",
"createdAt": "2026-06-02T10:30:00Z"
}
Gets all ledger entries with filtering and pagination.
| Parameter | Type | Description |
|---|---|---|
| $filter | string | OData filter expression |
| $orderby | string | Sort by columns |
| $skip | integer | Skip n records |
| $top | integer | Take n records |
{
"value": [
{
"id": "ledger_1234",
"customerId": "cust_123",
"transactionDate": "2026-06-02T10:30:00Z",
"documentType": "invoice",
"debit": 329.98,
"balance": 329.98,
"reference": "INV-2026-001"
}
],
"count": 500
}
Exports ledger transactions to CSV or Excel format.
{
"format": "csv",
"filters": {
"customerId": "cust_123",
"startDate": "2026-01-01",
"endDate": "2026-06-02"
},
"columns": ["id", "transactionDate", "documentType", "description", "debit", "credit", "balance"]
}
File download (CSV/Excel)
Gets current account balance for a customer.
| Parameter | Type |
|---|---|
| customerId | string |
{
"customerId": "cust_123",
"currentBalance": 1234.56,
"currency": "USD",
"lastUpdateDate": "2026-06-02T10:30:00Z",
"totalDebits": 5000.00,
"totalCredits": 3765.44
}
Gets all available ledger document types.
{
"documentTypes": [
{
"id": "invoice",
"name": "Invoice",
"description": "Sales invoice ledger entries"
},
{
"id": "receipt",
"name": "Receipt",
"description": "Payment receipt ledger entries"
},
{
"id": "credit_memo",
"name": "Credit Memo",
"description": "Credit memo ledger entries"
},
{
"id": "debit_memo",
"name": "Debit Memo",
"description": "Debit memo ledger entries"
}
]
}
| Code | HTTP Status | Description |
|---|---|---|
| LEDGER_ENTRY_NOT_FOUND | 404 | Ledger entry does not exist |
| CUSTOMER_NOT_FOUND | 404 | Customer does not exist |
| INVALID_AMOUNT | 400 | Invalid debit or credit amount |
| INVALID_DOCUMENT_TYPE | 400 | Invalid document type |