List 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

Addresshttps://api.hanzo.ai/v1/billing/ledger
MethodGET
Operationget_billing_ledger
AuthAuthorization: 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.

FieldInTypeRequiredDescription
rangequerystring—Range is the window: 24h, 7d, 30d or 90d.

Response

StatusBodyMeaning
200billing.financeLedgerEntry[]ok
defaultproblem-detailsrefused

200 body — 7 fields.

FieldInTypeAlwaysDescription
[].accountbodystring—
[].balanceCentsbodyinteger (int64)—
[].centsbodyinteger (int64)—
[].currencybodystring—
[].datebodystring—
[].descriptionbodystring—
[].idbodystring—

Failure carries the platform error shape — see Errors.

Examples

hanzo billing ledger
import { Configuration, BillingApi } from 'hanzoai';

const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getBillingLedger();
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()
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
}
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?;
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();
curl https://api.hanzo.ai/v1/billing/ledger \
  -H "Authorization: Bearer $HANZO_API_KEY"

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

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 · All Hanzo APIs · Interactive reference

Was this page useful?