Ledga

Accounts

The chart of accounts. Every entry posts to one account; balances are read per account or by code.

Endpoints

MethodPathDescription
GET /accounts List all accounts in a ledger
POST /accounts Create a new account
GET /accounts/{accountId} Get a specific account
PUT /accounts/{accountId} Update an account
DELETE /accounts/{accountId} Delete an account
GET /accounts/{accountId}/balance-history Get account balance history
POST /accounts/initialize-defaults Initialize default chart of accounts for a ledger
GET /accounts/{accountId}/entries Get all entries for an account with rolling balance
GET /accounts/code/{code} Get a specific account by its code
GET /accounts/code/{code}/balance Get account balance by code with layer details
GET /accounts/{accountId}/balance Get account balance with layer details
GET /accounts/{accountId}/balance/point-in-time Get an account point-in-time balance for a single layer
GET /accounts/code/{code}/balance/point-in-time Get an account point-in-time balance for a single layer, by code

Create an account

code is unique within the ledger. type sets the normal balance side unless normal_balance overrides it. category is system for internal/GL accounts or customer for end-user balances.

curl -X POST https://ledga.io/api/v1/accounts \
  -H "Authorization: Bearer sk_xxxxxxxx_your_secret" \
  -H "Content-Type: application/json" \
  -d '{ "code": "2100", "name": "Customer wallet", "type": "liability", "category": "customer" }'

Rules