# Get the trial balance

> The ledger.trial_balance operation: GET /api/v1/ledger/trial_balance in the REST API and the ledger_trial_balance tool in the MCP server.

Returns the trial balance of the legal entity's ledger in the mode of the request: for each currency, every
account with a non-zero posted balance, its balance on the debit or the credit side (integer micros), and the
debit and credit totals. The totals of a currency must be equal (`balanced`); `difference` is debits minus
credits. All brands of the entity are included.

Without `asOf`, the balances are the accounts' current posted balances. With `asOf` (`YYYY-MM-DD`), they are
recomputed from the posted transactions effective up to the end of that day (UTC). Pending and voided
transactions never count. Filter with `currency`.

## At a glance

- **REST:** `GET /api/v1/ledger/trial_balance`
- **MCP tool:** `ledger_trial_balance`
- **Operation ID:** `ledger.trial_balance`
- **Scope:** Legal entity
- **Permission:** `ledger:read`
- **Risk tier:** `read`
- **Dry run:** Not supported
- **Idempotency:** Not needed (read only)
- **Modes:** Test and live
- **Authentication:** API key with the `ledger:read` scope
- **Since:** M2

## Request

### Query parameters

| Field      | Type   | Required | Description                                                                             |
| ---------- | ------ | -------- | --------------------------------------------------------------------------------------- |
| `asOf`     | string | No       | Balances at the end of this day (`YYYY-MM-DD`, UTC). Leave it out for the balances now. |
| `currency` | string | No       | One currency only.                                                                      |

## Response

`200 OK` with a JSON object:

| Field                                | Type                                                        | Description |
| ------------------------------------ | ----------------------------------------------------------- | ----------- |
| `object`                             | `"ledger_trial_balance"`                                    |             |
| `entityId`                           | `ent_…` ID                                                  |             |
| `livemode`                           | boolean                                                     |             |
| `asOf`                               | string or null                                              |             |
| `balanced`                           | boolean                                                     |             |
| `currencies`                         | array of object                                             |             |
| `currencies[].currency`              | string                                                      |             |
| `currencies[].accounts`              | array of object                                             |             |
| `currencies[].accounts[].accountId`  | `acct_…` ID                                                 |             |
| `currencies[].accounts[].code`       | string                                                      |             |
| `currencies[].accounts[].type`       | one of `asset`, `liability`, `revenue`, `expense`, `equity` |             |
| `currencies[].accounts[].normalSide` | one of `debit`, `credit`                                    |             |
| `currencies[].accounts[].brandId`    | `brd_…` ID or null                                          |             |
| `currencies[].accounts[].balance`    | integer string                                              |             |
| `currencies[].accounts[].debit`      | string                                                      |             |
| `currencies[].accounts[].credit`     | string                                                      |             |
| `currencies[].totals`                | object                                                      |             |
| `currencies[].totals.debit`          | string                                                      |             |
| `currencies[].totals.credit`         | string                                                      |             |
| `currencies[].difference`            | integer string                                              |             |
| `currencies[].balanced`              | boolean                                                     |             |

## Examples

### The trial balance now

```http
GET /api/v1/ledger/trial_balance
Authorization: Bearer or_test_…
```

Response (`200`):

```json
{
  "object": "ledger_trial_balance",
  "entityId": "ent_01m4tx5nj8emwbyf7y9vcf47x2",
  "livemode": true,
  "asOf": null,
  "balanced": true,
  "currencies": [
    {
      "currency": "EUR",
      "accounts": [
        {
          "accountId": "acct_01m4tx5nj8emwbyf7y9vcf47xc",
          "code": "bank:ent_01m4tx5nj8emwbyf7y9vcf47x2:EUR",
          "type": "asset",
          "normalSide": "debit",
          "brandId": null,
          "balance": "1500000000",
          "debit": "1500000000",
          "credit": "0"
        },
        {
          "accountId": "acct_01m4tx5nj8emwbyf7y9vcf47xd",
          "code": "opening_balances:EUR",
          "type": "equity",
          "normalSide": "credit",
          "brandId": null,
          "balance": "1500000000",
          "debit": "0",
          "credit": "1500000000"
        }
      ],
      "totals": {
        "debit": "1500000000",
        "credit": "1500000000"
      },
      "difference": "0",
      "balanced": true
    }
  ]
}
```

### EUR balances at the end of September 2026

```http
GET /api/v1/ledger/trial_balance?asOf=2026-09-30&currency=EUR
Authorization: Bearer or_test_…
```

Response (`200`):

```json
{
  "object": "ledger_trial_balance",
  "entityId": "ent_01m4tx5nj8emwbyf7y9vcf47x2",
  "livemode": true,
  "asOf": "2026-09-30",
  "balanced": true,
  "currencies": [
    {
      "currency": "EUR",
      "accounts": [
        {
          "accountId": "acct_01m4tx5nj8emwbyf7y9vcf47xc",
          "code": "bank:ent_01m4tx5nj8emwbyf7y9vcf47x2:EUR",
          "type": "asset",
          "normalSide": "debit",
          "brandId": null,
          "balance": "1500000000",
          "debit": "1500000000",
          "credit": "0"
        },
        {
          "accountId": "acct_01m4tx5nj8emwbyf7y9vcf47xd",
          "code": "opening_balances:EUR",
          "type": "equity",
          "normalSide": "credit",
          "brandId": null,
          "balance": "1500000000",
          "debit": "0",
          "credit": "1500000000"
        }
      ],
      "totals": {
        "debit": "1500000000",
        "credit": "1500000000"
      },
      "difference": "0",
      "balanced": true
    }
  ]
}
```

## Errors

| Code                                                                                   | HTTP status | When                                                                         | What to do                                                                                                                                         |
| -------------------------------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`validation_failed`](https://ownrecord.io/docs/reference/errors.md#validation_failed) | 400         | `asOf` isn't a date such as 2026-09-30, or `currency` isn't a currency code. | Fix the fields listed in `details.issues` and send the request again.                                                                              |
| [`scope_required`](https://ownrecord.io/docs/reference/errors.md#scope_required)       | 400         | The request names no legal entity (an org key without `Ownrecord-Entity`).   | Call the operation with credentials or a target at its level: an organization, a legal entity, a brand or the platform (`details.required_scope`). |
| [`permission_denied`](https://ownrecord.io/docs/reference/errors.md#permission_denied) | 403         | You can't see this entity's ledger (brand-scoped members never can).         | Ask an organization owner or admin for a role or scope that allows this action.                                                                    |

It can also return these [common errors](https://ownrecord.io/docs/reference.md#common-errors): [`api_version_unsupported`](https://ownrecord.io/docs/reference/errors.md#api_version_unsupported), [`authentication_required`](https://ownrecord.io/docs/reference/errors.md#authentication_required), [`api_key_invalid`](https://ownrecord.io/docs/reference/errors.md#api_key_invalid), [`resource_not_found`](https://ownrecord.io/docs/reference/errors.md#resource_not_found), [`dry_run_not_supported`](https://ownrecord.io/docs/reference/errors.md#dry_run_not_supported), [`rate_limited`](https://ownrecord.io/docs/reference/errors.md#rate_limited), [`internal_error`](https://ownrecord.io/docs/reference/errors.md#internal_error).
