> ## Documentation Index
> Fetch the complete documentation index at: https://docs.panoqore.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ledgers and accounts

> How the chart of accounts is laid out, and what an account code means.

## Ledgers

A tenant has one ledger per currency. `GET /v1/ledgers` lists them, with their `scale`, the account `modules` on, and totals per account group. An account can only be opened in a currency that has a ledger, otherwise the answer is `LEDGER_MISSING`.

Account modules decide which internal accounts a tenant has: `lending` adds the loan accounts, for example. `GET /v1/account-modules` is the catalogue with what is on, and `GET /v1/internal-accounts` lists your non-wallet accounts. A tenant admin switches a module on from the console, and a second person approves.

## Account codes

Every account has a code in the form `TYPE:GROUP:CCY[:PARTY]`.

```text theme={null}
LIA:WAL:NGN:0001
 │   │   │   └── party or sequence, optional
 │   │   └────── currency, must match `currency`
 │   └────────── group
 └────────────── type
```

The first segment sets the type, and the type sets the side the balance grows on.

| Prefix | Type | Normal side |
| - | - | - |
| `AST` | `ASSET` | `DEBIT` |
| `EXP` | `EXPENSE` | `DEBIT` |
| `LIA` | `LIABILITY` | `CREDIT` |
| `EQ` | `EQUITY` | `CREDIT` |
| `INC` | `INCOME` | `CREDIT` |

Some common groups:

| Code | Holds |
| - | - |
| `LIA:WAL:NGN:0001` | A customer wallet |
| `AST:SET:NGN:SHV` | A mirror of what a partner holds for you |
| `LIA:SUS:NGN:SHV` | Credits that could not be placed |
| `AST:FXP:USD` | FX position |
| `INC:FEE:NGN` | Fee income |

Codes are unique on a tenant, and a repeat gets `ACCOUNT_EXISTS`.

## Which accounts are balance-checked

Three groups can never go below zero: `WAL` holds customer money, and `LON` and `INT` are what a borrower owes. A posting that would take one below zero is refused with `INSUFFICIENT_FUNDS`, whichever endpoint it comes through, and a database constraint enforces it. Anything else can go either way, because settlement and internal accounts have to move in both directions. Reconciliation is what checks those.

## Balances

| Field | Meaning |
| - | - |
| `posted` | Settled value on the account's normal side. |
| `pending` | Value in flight, either direction. |
| `available` | What can be spent: `posted`, less pending reductions, plus `overdraftLimit`. |
| `version` | Goes up with each change. |

`pending` counts both directions, while `available` is reduced only by what takes money out. A pending credit shows in `pending` and adds nothing to `available` until it posts.

```json theme={null}
{ "posted": "460000", "pending": "1000", "available": "459000", "version": "9" }
```

`GET /v1/accounts/{account_id}/postings` is an account's history, with `balanceAfter` on each line.

## Status

An account is `ACTIVE`, `FROZEN` or `CLOSED`. Freezing needs a person and a second person: see [Approvals](https://docs.panoqore.com/concepts/approvals.md). A frozen account refuses postings with `ACCOUNT_FROZEN`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.