# Wallet ledger

`crm.wallet` — `/v1/channels/:channelId/wallet`

Every credit and debit against a channel's balance, with the balance before and
after each movement.

**Read-only.** Money moves through top-ups and through conversation billing, not
through this API. To send a user to the top-up page, read
[`recharge_url`](channel-props.md#recharge_url).

| Action | Route | Scope |
| --- | --- | --- |
| [`list`](#list) | `GET /v1/channels/:channelId/wallet` | `channels:read` |

**Permissions** — `CRM.CHANNEL.USAGE.READ`, shared with the conversation counts.

## The wallet log object

```ts
interface WalletLog {
  id: string;
  type: 'credit' | 'debit';
  currency: string;
  note: string;
  amount: number;        // ten-thousandths
  startBalance: number;  // ten-thousandths
  endBalance: number;    // ten-thousandths
  status: string;
  category: string;
  createdAt: string;
  updatedAt: string;
}
```

**Amounts here are the raw stored values** — ten-thousandths of a currency unit
— unlike `channel.wallet.balance`, which is already divided down for display.
Divide by `10000` to show them:

```ts
const display = (amount: number) => (amount / 10_000).toFixed(4);
```

---

## list

```ts
crm.wallet.list(channelId: string, query?: Partial<ListWalletLogsQuery>): Promise<Paginated<WalletLog>>
```

`GET /v1/channels/:channelId/wallet` · `channels:read` · **200**

Newest first.

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `page` | number | `1` | 1-based. |
| `rows` | number | `25` | 1–100. |
| `search` | string | — | 1–120 chars. Matches the **note, category and status**. |
| `type` | `'credit' \| 'debit'` | — | Quick filter. |
| `range` | `{ start, end }` | — | Unix seconds. `0` on either end means no bound. Serialised to JSON by the SDK. |

```ts
const topUps = await crm.wallet.list(channelId, {
  type: 'credit',
  range: { start: 1767225600, end: 0 },
});
```
