Update billing preferences
const url = 'https://dev-api.infiniteaudience.ai/v1/settings/billing-preferences';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"low_balance_threshold":1,"budget_ceiling":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://dev-api.infiniteaudience.ai/v1/settings/billing-preferences \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "low_balance_threshold": 1, "budget_ceiling": 1 }'Updates whichever platform-owned safeguard applies to your org’s own billing_model. Low-balance thresholds are prepay-only; budget ceilings are postpay-only. Requires ‘account’ scope.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Prepay only.
Postpay only. Optional hard spend ceiling per billing cycle; null removes the ceiling (unlimited).
Examplegenerated
{ "low_balance_threshold": 1, "budget_ceiling": 1}Responses
Section titled “Responses”Billing preferences updated.
object
Example
{ "ok": true}Invalid request, or the requested field doesn’t apply to this org’s billing model — code PREFERENCE_NOT_APPLICABLE_POSTPAY (low_balance_threshold on a postpay org) or BUDGET_CEILING_NOT_APPLICABLE_PREPAY (budget_ceiling on a prepay org).
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Examples
{ "error": "Not applicable", "code": "PREFERENCE_NOT_APPLICABLE_POSTPAY", "message": "Low-balance alerts are prepay-only. Use budget_ceiling for postpay billing."}{ "error": "Not applicable", "code": "BUDGET_CEILING_NOT_APPLICABLE_PREPAY", "message": "Budget ceiling is a postpay-only setting."}Missing or invalid Bearer token. Obtain one via POST /v1/auth/token. When a token was supplied but rejected, code distinguishes TOKEN_EXPIRED (the token’s lifetime has passed — request a new one via POST /v1/auth/token and retry) from TOKEN_INVALID (malformed or revoked — re-authenticate).
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Examples
{ "error": "Unauthorized: Missing or invalid Authorization header"}{ "error": "Unauthorized", "code": "TOKEN_EXPIRED", "message": "Your session has expired. Please sign in again."}Token is valid but lacks the required scope for this endpoint. Check the endpoint description for the required scope (discovery, purchase, or account).
object
Stable machine-readable error code (e.g. INVALID_STATUS_TRANSITION, BILLING_INSUFFICIENT_BALANCE). Always present.
Human-readable explanation of the error.
Alternate machine-readable code — present on some endpoints as an alias for error for backward compatibility.
Opaque support/debug identifier when available.
Examples
{ "error": "SCOPE_REQUIRED", "message": "This endpoint requires the purchase scope."}