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

# Double-entry

> Why every journal balances, and how we enforce it.

3Rings keeps **double-entry** books: every journal is made of lines that are either a **debit** or
a **credit**, and the total debits must equal the total credits. This is what makes the books
provably correct — and it is enforced on our side, not yours.

## A journal

A journal groups the lines of a single economic event. Paying ₦250,000 of office rent in cash is
one journal with two lines:

| Line | Account | Debit | Credit |
| - | - | - | - |
| 1 | Office Rent (expense) | 25000000 | |
| 2 | Cash (asset) | | 25000000 |
| | **Total** | **25000000** | **25000000** |

```json theme={null}
{
  "businessId": "biz_9f2",
  "narration": "Office rent — November",
  "currency": "NGN",
  "entries": [
    { "type": "debit",  "accountId": "acc_rent", "amount": 25000000 },
    { "type": "credit", "accountId": "acc_cash", "amount": 25000000 }
  ]
}
```

## Balancing is authoritative

When you `POST /v1/journals`, we check that debits equal credits **before** posting. An unbalanced
journal is rejected with `422` and never reaches the ledger:

```json theme={null}
{
  "error": {
    "type": "unbalanced_journal",
    "message": "Debits (25000000) do not equal credits (24000000).",
    "code": "journal.unbalanced"
  }
}
```

A journal can have more than two lines — a compound journal — as long as the totals balance.

## Amounts

All amounts are **integers in the currency's minor unit** (kobo for NGN, cents for USD) and always
positive; the `type` (`debit`/`credit`) carries the direction. Using integers avoids floating-point
rounding errors in the ledger.


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