Replace recharge

Sets the auto-reload rule of the wallet the caller pays from, and answers with the rule as stored.

PUT /v1/billing/recharge

Addresshttps://api.hanzo.ai/v1/billing/recharge
MethodPUT
Operationput_billing_recharge
AuthAuthorization: Bearer $HANZO_API_KEY

Sets the auto-reload rule of the wallet the caller pays from, and answers with the rule as stored.

The org's own account's rule is its admins' to change, and the platform's; a member billed from a wallet of their own (a person in the signup org) changes that wallet's rule and no other (403 otherwise, with the plain sentence "Only an admin of <org> can change its auto-reload. Ask an admin to do it."): the sweep charges the payer's default card with nobody there.

ENABLING REQUIRES A CARD ON FILE (400), because the sweep charges off-session: a rule naming no chargeable method is a promise the schedule cannot keep. The amount is a top-up's own range, 5to5 to 5,000, and the balance it reloads below is 0to0 to 5,000; a value outside either is refused the same way, the range in the sentence. The sweep reloads at most perDay times in a UTC day.

The rule is the payer's OWN. The org and the wallet come from the validated principal and the body names neither, so there is no field a write could be steered through onto another payer's schedule.

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

Request

4 fields, body application/json (required).

FieldInTypeRequiredDescription
amountCentsbodyinteger (int64)—
currencybodystring—
enabledbodyboolean—
thresholdCentsbodyinteger (int64)—

Response

StatusBodyMeaning
200billing.AutoRechargeok
defaultproblem-detailsrefused

200 body — 8 fields.

FieldInTypeAlwaysDescription
amountCentsbodyinteger (int64)—
currencybodystring—
enabledbodyboolean—
lastRechargedAtbodystring—
perDaybodyinteger (int64)—PerDay is the most times the sweep reloads the balance in one UTC day.
storedbodyboolean—
subjectbodystring—
thresholdCentsbodyinteger (int64)—

Failure carries the platform error shape — see Errors.

Examples

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

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

resp, _, err := client.BillingAPI.PutBillingRecharge(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::put_billing_recharge(&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).putBillingRecharge();
curl -X PUT https://api.hanzo.ai/v1/billing/recharge \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "amountCents": 0,
       "currency": "<currency>"
     }'

MCP reaches billing through the billing tool, which names its 45 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "list_billing_accounts"
         }
       }
     }'

Billing API · All Hanzo APIs · Interactive reference

Was this page useful?
Broken link or missing step? Drop it in #docs on Discord or open a PR.