Billing Auto Topup
PATCH /api/v1/billing/auto-topup
Updates the authenticated account’s auto top-up settings. enabled is required; threshold_cents and amount_cents are optional. Enabling requires an available saved payment method. Requires an authenticated user. Bearer access tokens need the billing.write ability, and the associated account needs the billing.change permission. The * wildcard also satisfies the bearer ability check. Browser session authentication uses the account permission check without a token-ability check. API-key credentials are not accepted. A bearer token missing its ability receives a 403 JSON body with error: "token_ability_missing", required: ["billing.write"], and have.
Authenticate with a portal session token.
Request body
application/json object
amount_centsintegerRange: 2500 to 200000enabledboolean requiredthreshold_centsintegerRange: 100 to 20000
Generated sample
{
"amount_cents": 2500,
"enabled": true,
"threshold_cents": 100
}Responses
200 Auto top-up settings updated.
application/json object
amount_centsinteger requiredavailableboolean requiredenabledboolean requiredhas_payment_methodboolean requiredpayment_methodobject or null requiredAny keys are accepted.
threshold_centsinteger requiredunavailable_reasonstring or null required
Generated sample
{
"amount_cents": 0,
"available": true,
"enabled": true,
"has_payment_method": true,
"payment_method": {},
"threshold_cents": 0,
"unavailable_reason": "string"
}401 Authentication is missing or invalid.
application/json object
errorobject requiredcodestring requiredValue:"unauthenticated"messagestring required
403 The bearer token lacks the required ability or the authenticated account lacks the required permission.
application/json any
Any of
- object
errorstring requiredValue:"token_ability_missing"havearray of string requiredmessagestring requiredrequiredarray of string required
- object
messagestring required
409 Auto top-up is unavailable while the account-level gate is active.
application/json object
availableboolean requiredValue:falseerrorstring requiredValue:"auto_topup_blocked"messagestring requiredunavailable_reasonstring requiredValue:"auto_topup_blocked"
422 The request failed validation or no saved payment method is available.
application/json object
errorany requiredOne of
- string
- object
codestringfieldsobjectOther keys: array of string
messagestring
- object
codestringmessagestring
429 The request was rate limited. API-generated responses are JSON;
Response headers
Retry-Afterstring headerSeconds to wait before retrying, when provided.
X-RateLimit-Scopestring headerIdentifies the scope of the request limit, when provided.
application/json GenericError
erroranyOne of
- string
- object
Any keys are accepted.
error_codestringcodestringmessagestringdetailstringstatusanyOne of
- string
- integer
errorsobjectAny keys are accepted.
text/html string