Hanzo AI
OpenapiBilling

Create usage

Debits one act an application metered to the org it acts for, and answers the receipt.

POST /v1/billing/usage

Addresshttps://api.hanzo.ai/v1/billing/usage
MethodPOST
Operationpost_billing_usage
AuthAuthorization: Bearer $HANZO_API_KEY

Debits one act an application metered to the org it acts for, and answers the receipt.

The caller is an application acting as itself — an IAM client_credentials token — and the org is the one that token acts in: the application's own, or one that granted it membership, selected with X-Org-Id and named again in org. A person, an API key, an unauthenticated caller, and a body naming an org the token does not act in are all refused before anything is debited.

The debit lands in the same ledger every other meter writes, in the wallet GET /v1/billing/balance reports for the same caller. It is exactly-once on id: a retry answers the same receipt, and the same id for a different amount is 409. Recording does not gate — the work already happened — so a caller that must refuse unfunded work asks GET /v1/billing/balance and GET /v1/billing/alerts/authorize first.

Request

8 fields, body application/json (required).

FieldInTypeRequiredDescription
amountbodybilling.Money
amount.currencybodystringyes
amount.decimalbodystringyes
idbodystringID names the act, chosen by the reporting application and stable across its retries: the ledger debits one act once.
modelbodystringModel names the unit the amount prices (a machine size, a model id), and is recorded with the debit.
orgbodystringOrg is the organization this usage is billed to.
projectbodystringProject attributes the debit to one project of the org.
servicebodystringService scopes the debit for spend caps and attributes it to a product, as a lowercase slug.

Response

StatusBodyMeaning
200billing.usageReceiptok
defaultproblem-detailsrefused

200 body — 6 fields.

FieldInTypeAlwaysDescription
accountbodystringAccount is the wallet the debit drew from, the same key GET /v1/billing/balance reports for this caller.
amountbodybilling.Money
amount.currencybodystringyes
amount.decimalbodystringyes
idbodystringID is the act's name, echoed.
orgbodystringOrg is the organization whose ledger holds the debit.

Failure carries the platform error shape — see Errors.

Examples

hanzo billing usage create

Billing API · All Hanzo APIs · Interactive reference

How is this guide?

On this page