Create issue

Issues a draft invoice: moves it to OPEN, assigns its number, and makes it collectible.

POST /v1/billing/invoices/{id}/issue

Addresshttps://api.hanzo.ai/v1/billing/invoices/{id}/issue
MethodPOST
OperationissueInvoice
AuthAuthorization: Bearer $HANZO_API_KEY

Issues a draft invoice: moves it to OPEN, assigns its number, and makes it collectible. It is the org admin's act; a member is refused 403.

Only a draft can be issued. An invoice already open, paid or void is refused with the state machine's own reason rather than being silently re-issued, which would mint a second number for one debt.

A named handler, not a closure, so zipdoc can lift this prose into the registry.

Request

1 field.

FieldInTypeRequiredDescription
idpathstringyesID is the invoice id.

Response

StatusBodyMeaning
200billing.Invoiceok
defaultproblem-detailsrefused

200 body — 16 fields.

FieldInTypeAlwaysDescription
amountDueCentsbodyinteger (int64)—AmountDueCents is what remains collectible.
amountPaidCentsbodyinteger (int64)—AmountPaidCents is what has been collected so far.
createdAtbodystring—CreatedAt is when the draft was raised, RFC3339.
currencybodystring—Currency is the ISO 4217 code.
customerEmailbodystring—CustomerEmail is where it is sent.
idbodystring—ID is the invoice id — what the issue, collect and void ops address.
linesbodybilling.InvoiceLine[]—Lines are the charges on the invoice.
lines[].amountbodyinteger (int64)—Amount is the line total in whole cents (250000 is $2,500.00).
lines[].descriptionbodystring—Description is the human-readable line, e.g. "Advisory retainer — August".
lines[].quantitybodyinteger (int64)—Quantity is the number of units, when the line is metered.
lines[].unitPricebodyinteger (int64)—UnitPrice is the per-unit price in cents, when the line is metered.
numberbodystring—Number is the human-facing invoice number, e.g. "INV-0042".
paymentRefbodystring—PaymentRef is the processor reference for the collection, once paid.
statusbodystring—Status is draft, open, paid, void or uncollectible.
subtotalCentsbodyinteger (int64)—SubtotalCents is the sum of the lines.
userIdbodystring—UserID is the customer billed.

Failure carries the platform error shape — see Errors.

Examples

hanzo billing invoices issue <id>
import { Configuration, BillingApi } from 'hanzoai';

const api = new BillingApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.issueInvoice({ 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).issue_invoice(id='id')
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.BillingAPI.IssueInvoice(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::issue_invoice(&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).issueInvoice();
curl -X POST https://api.hanzo.ai/v1/billing/invoices/<id>/issue \
  -H "Authorization: Bearer $HANZO_API_KEY"

Tool billing, op issueInvoice — 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": "issueInvoice",
           "input": {
             "id": "<id>"
           }
         }
       }
     }'

Billing API · All Hanzo APIs · Interactive reference

Was this page useful?