OpenapiBilling
Read one invoice
Reads one invoice out of the caller's org.
GET /v1/billing/invoices/{id}
| Address | https://api.hanzo.ai/v1/billing/invoices/{id} |
| Method | GET |
| Operation | getInvoice |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Reads one invoice out of the caller's org.
The org scopes the read by construction — the store is namespaced to it — so an id belonging to another tenant is not found rather than found and then filtered.
A named handler, not a closure, so zipdoc can lift this prose into the registry.
Request
1 field.
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | ID is the invoice id. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | Invoice | ok |
200 body — 16 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
amountDueCents | body | integer | — | AmountDueCents is what remains collectible. |
amountPaidCents | body | integer | — | AmountPaidCents is what has been collected so far. |
createdAt | body | string | — | CreatedAt is when the draft was raised, RFC3339. |
currency | body | string | — | Currency is the ISO 4217 code. |
customerEmail | body | string | — | CustomerEmail is where it is sent. |
id | body | string | — | ID is the invoice id — what the issue, collect and void ops address. |
lines | body | InvoiceLine[] | — | Lines are the charges on the invoice. |
lines[].amount | body | integer | — | Amount is the line total in whole cents (250000 is $2,500.00). |
lines[].description | body | string | — | Description is the human-readable line, e.g. |
lines[].quantity | body | integer | — | Quantity is the number of units, when the line is metered. |
lines[].unitPrice | body | integer | — | UnitPrice is the per-unit price in cents, when the line is metered. |
number | body | string | — | Number is the human-facing invoice number, e.g. |
paymentRef | body | string | — | PaymentRef is the processor reference for the collection, once paid. |
status | body | string | — | Status is draft, open, paid, void or uncollectible. |
subtotalCents | body | integer | — | SubtotalCents is the sum of the lines. |
userId | body | string | — | UserID is the customer billed. |
Failure carries the platform error shape — see Errors.
Examples
hanzo billing invoices get <id>import { Configuration, BillingApi } from 'hanzoai';
const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getInvoice({ id: 'id' });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_invoice(id='id')cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.BillingAPI.GetInvoice(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::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_invoice(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.BillingApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new BillingApi(client).getInvoice();curl https://api.hanzo.ai/v1/billing/invoices/<id> \
-H "Authorization: Bearer $HANZO_API_KEY"Tool commerce, op getInvoice — 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": "commerce",
"arguments": {
"op": "getInvoice",
"input": {
"id": "<id>"
}
}
}
}'How is this guide?