# Ledger API

Chain maintains a complete double-entry accounting ledger for every financial movement. Query entries for reconciliation, auditing, and financial reporting.

## Double-entry accounting

Every transaction creates at least two ledger entries — a debit and a credit — ensuring your books always balance. Entries are immutable and append-only.

## List Ledger Entries

Query ledger entries with filters for date range, type, direction, and currency.

GET/v1/ledger

| Parameter         | Type     | Description                                                                       |
| ------------------ | -------- | --------------------------------------------------------------------------------- |
| `type`            | `string` | Transaction type: "funding", "payout", "card_transaction", "transfer", "fee". |
| `direction`       | `string` | "debit" or "credit".                                                           |
| `currency`        | `string` | Filter by currency (e.g. "USD", "USDC").                                      |
| `from`            | `string` | Start date (ISO 8601).                                                           |
| `to`              | `string` | End date (ISO 8601).                                                             |
| `limit`           | `number` | Results per page (default 50, max 200).                                         |
| `starting_after`  | `string` | Cursor for pagination.                                                            |

### Scope required

This endpoint requires the `ledger:read` scope.

### Example request

```bash
curl "https://api.chain.com/v1/ledger?from=2026-01-01&to=2026-01-31&type=funding&limit=10" \
  -H "Authorization: Bearer sk_live_..."
```

### Response

```json
{
  "data": [
    {
      "id": "le_abc123",
      "type": "funding",
      "direction": "credit",
      "amount": "10000.00",
      "currency": "USD",
      "balance_after": "58750.25",
      "reference": "fund_123abc",
      "metadata": {
        "memo": "Monthly treasury funding"
      },
      "created_at": "2026-01-15T10:30:00Z"
    },
    {
      "id": "le_def456",
      "type": "payout",
      "direction": "debit",
      "amount": "5000.00",
      "currency": "USDC",
      "balance_after": "53750.25",
      "reference": "po_456def",
      "metadata": {
        "payee": "Acme Corp"
      },
      "created_at": "2026-01-15T11:00:00Z"
    }
  ],
  "has_more": true,
  "next_cursor": "le_def456"
}
```

## Entry Types

| Type                | Description                                               |
| -------------------- | --------------------------------------------------------- |
| `funding`           | Inbound funding from a linked bank account.              |
| `payout`            | Outbound payout to a payee (fiat or USDC).              |
| `card_transaction`  | Card purchase or refund.                                 |
| `transfer`          | Internal transfer between wallets.                        |
| `fee`               | Platform or transaction fee.                              |

## CSV Export

You can export ledger data in CSV format from the [Chain Dashboard](https://app.chain.com/). Generate reports for any date range and download them for reconciliation or accounting purposes.

### Report notifications

Reports are generated asynchronously. You'll receive a `report.ready` webhook event when the download is available.

## Pagination

The ledger endpoint uses cursor-based pagination. Use the `next_cursor` value from the response as the `starting_after` parameter in subsequent requests.

### Paginated request

```bash
curl "https://api.chain.com/v1/ledger?limit=50&starting_after=le_def456" \
  -H "Authorization: Bearer sk_live_..."
```

Pax Dollar

USDP

Ripple USD

RLUSD

Dollar

USD

Tether

USDT

Pounds

GBP

Euro

Eur
