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
| Address | https://api.hanzo.ai/v1/billing/recharge |
| Method | PUT |
| Operation | put_billing_recharge |
| Auth | Authorization: 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.
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).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
amountCents | body | integer (int64) | — | |
currency | body | string | — | |
enabled | body | boolean | — | |
thresholdCents | body | integer (int64) | — |
Response
| Status | Body | Meaning |
|---|---|---|
200 | billing.AutoRecharge | ok |
default | problem-details | refused |
200 body — 8 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
amountCents | body | integer (int64) | — | |
currency | body | string | — | |
enabled | body | boolean | — | |
lastRechargedAt | body | string | — | |
perDay | body | integer (int64) | — | PerDay is the most times the sweep reloads the balance in one UTC day. |
stored | body | boolean | — | |
subject | body | string | — | |
thresholdCents | body | integer (int64) | — |
Failure carries the platform error shape — see Errors.
Examples
hanzo billing recharge replaceimport { 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"
}
}
}'