Ledger API¶
Double-entry general ledger: accounts, journal entries, sub-ledger views, and financial reports.
Base permission: IsViewerOrAbove (read), IsAdminOrAbove (write)
Accounts¶
| Method | Path | Description | Permission |
|---|---|---|---|
GET |
/ledger/accounts |
List GL accounts | IsViewerOrAbove |
GET |
/ledger/accounts/{id} |
Get account | IsViewerOrAbove |
POST |
/ledger/accounts |
Create account | IsAdminOrAbove |
GET |
/ledger/accounts/{id}/balance |
Get account balance | IsViewerOrAbove |
Create Account¶
{
"code": "1200",
"name": "Loans Receivable - Consumer",
"account_type": "asset",
"parent_id": "550e8400-e29b-41d4-a716-446655440000",
"description": "Outstanding consumer loan principal"
}
Account Types¶
| Type | Normal Balance | Description |
|---|---|---|
asset |
Debit | Resources owned (cash, receivables) |
liability |
Credit | Obligations owed |
equity |
Credit | Owner's equity |
revenue |
Credit | Income earned |
expense |
Debit | Costs incurred |
Get Account Balance¶
Returns the derived balance computed from all journal entry lines.
Response:
{
"account_id": "550e8400-e29b-41d4-a716-446655440000",
"code": "1100",
"name": "Cash",
"balance": "125000.00",
"as_of": "2026-01-15T23:59:59Z"
}
Note
Account balances are always derived from journal entry lines, never stored directly. This is a core ledger invariant.
Journal Entries¶
| Method | Path | Description | Permission |
|---|---|---|---|
GET |
/ledger/entries |
List journal entries | IsViewerOrAbove |
GET |
/ledger/entries/{id} |
Get journal entry | IsViewerOrAbove |
POST |
/ledger/entries |
Create journal entry | IsAdminOrAbove |
POST |
/ledger/entries/{id}/post |
Post journal entry | IsAdminOrAbove |
POST |
/ledger/entries/{id}/reverse |
Reverse journal entry | IsAdminOrAbove |
Create Journal Entry¶
{
"entry_date": "2026-01-15",
"description": "Manual adjustment",
"reference_type": "manual",
"lines": [
{
"account_id": "...",
"debit": "100.00",
"credit": "0.00",
"description": "Debit adjustment"
},
{
"account_id": "...",
"debit": "0.00",
"credit": "100.00",
"description": "Credit adjustment"
}
]
}
Ledger Invariants
- Every journal entry must balance:
SUM(debits) = SUM(credits) - Posted entries are immutable --- corrections must use reversing entries
- The API validates balance before accepting the entry
Post Journal Entry¶
Changes entry status from draft to posted. Posted entries cannot be modified.
Reverse Journal Entry¶
Creates a new entry with mirror debits/credits, linked to the original.
Preconditions: Entry must be in posted status.
Ledger Reports¶
Sub-Ledger¶
View all GL entries for a specific loan.
Response:
[
{
"id": "...",
"entry_date": "2026-01-15",
"description": "Loan disbursement",
"reference_type": "disbursement",
"lines": [
{"account": "Loans Receivable", "debit": "10000.00", "credit": "0.00"},
{"account": "Cash", "debit": "0.00", "credit": "10000.00"}
]
}
]
Trial Balance¶
Response:
{
"as_of_date": "2026-01-31",
"accounts": [
{"code": "1100", "name": "Cash", "debit": "125000.00", "credit": "0.00"},
{"code": "1200", "name": "Loans Receivable", "debit": "850000.00", "credit": "0.00"},
{"code": "4100", "name": "Interest Income", "debit": "0.00", "credit": "12500.00"}
],
"total_debits": "975000.00",
"total_credits": "975000.00"
}
GL Detail¶
Returns all journal entry lines for a specific account within a date range.
System-Generated Entries¶
Most GL entries are created automatically by business operations:
| Event | Debit | Credit |
|---|---|---|
| Loan disbursement | Loans Receivable | Cash |
| Payment (principal) | Cash | Loans Receivable |
| Payment (interest) | Cash | Interest Income |
| Payment (fees) | Cash | Fee Income |
| Interest accrual | Interest Receivable | Interest Income |
| Fee assessment | Fees Receivable | Fee Income |
| Fee waiver | Fee Income | Fees Receivable |
| Payment reversal | Reverse of original | Reverse of original |
| Charge-off | Charge-Off Expense | Loans Receivable |
| Collateral liquidation | Cash | Loans Receivable |
See Also¶
- General Ledger --- Accounting principles, invariants, account hierarchy
- GL Chart of Accounts --- Default account codes and types
- Payments API --- Payment processing GL entries
- Disbursements API --- Disbursement GL entries