# List ledger

URL: https://docs.hanzo.ai/docs/openapi/billing/get-billing-ledger

> Answers the org's own postings inside `range=`, each as a signed entry: a DEPOSIT CREDITS the wallet (positive, account `credits:<org>`), a HOLD sets money aside for a payment agreed and not yet made (negative, account `held:<org>`) and its return gives it back (positive), and every other posting DEBITS it (negative, account `usage:<org>`), described by its notes or its tags.

`GET /v1/billing/ledger`

> [Billing →](https://docs.hanzo.ai/docs/openapi/billing) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                          |
| ------------- | ---------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/billing/ledger` |
| **Method**    | `GET`                                    |
| **Operation** | `get_billing_ledger`                     |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY`   |

Answers the org's own postings inside `range=`, each as a signed
entry: a DEPOSIT CREDITS the wallet (positive, account `credits:<org>`), a
HOLD sets money aside for a payment agreed and not yet made (negative, account
`held:<org>`) and its return gives it back (positive), and every other posting
DEBITS it (negative, account `usage:<org>`), described by its notes or its
tags. The sign is the posting's own meaning, read through ONE
vocabulary shared with the ledger that wrote it — a reader with its own
spelling for `deposit` rendered a customer's grant as a charge.

This is the closest projection of the truth. The org's double-entry postings
are the source of record — balanced, only ever appended, one file per org —
and this lane is that list, wider than either half of it: the deposits are the
grants /v1/billing/credits lists and the debits are the spend /v1/billing/usage
rolls up. It answers 503 where this deployment runs no ledger, rather than
reporting an empty wallet.

A row whose timestamp will not parse is KEPT rather than dropped — a malformed
date must show up in a money list, not vanish from it. `balanceCents` is
omitted: these are MOVEMENTS, and the standing balance is /v1/billing/balance.

Cents are ROUNDED from the ledger's exact 18-decimal USD. Scoped to the
caller's own org, where the org's ledger file is the tenant boundary; 401
without a validated principal.

## Request

1 field.

| Field   | In    | Type   | Required | Description                               |
| ------- | ----- | ------ | -------- | ----------------------------------------- |
| `range` | query | string | —        | Range is the window: 24h, 7d, 30d or 90d. |

## Response

| Status    | Body                          | Meaning |
| --------- | ----------------------------- | ------- |
| `200`     | billing.financeLedgerEntry\[] | ok      |
| `default` | problem-details               | refused |

`200` body — 7 fields.

| Field             | In   | Type            | Always | Description |
| ----------------- | ---- | --------------- | ------ | ----------- |
| `[].account`      | body | string          | —      |             |
| `[].balanceCents` | body | integer (int64) | —      |             |
| `[].cents`        | body | integer (int64) | —      |             |
| `[].currency`     | body | string          | —      |             |
| `[].date`         | body | string          | —      |             |
| `[].description`  | body | string          | —      |             |
| `[].id`           | body | string          | —      |             |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo billing ledger
```

**SDK**

**.ts**

```ts
import { Configuration, BillingApi } from 'hanzoai';

const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBillingLedger();
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import BillingApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = BillingApi(client).get_billing_ledger()
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.BillingAPI.GetBillingLedger(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, billing_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = billing_api::get_billing_ledger(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.BillingApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new BillingApi(client).getBillingLedger();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/billing/ledger \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `billing`, op `get_billing_ledger` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "billing",
         "arguments": {
           "op": "get_billing_ledger",
           "input": {}
         }
       }
     }'
```

---

[Billing API](https://docs.hanzo.ai/docs/openapi/billing) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
