sessionToken), the Platform API exposes workspace billing at /v1/platform/workspaces/:id/*. Useful for AI agents that provision accounts and immediately subscribe or recharge.
Authentication
billing:read or billing:manage scopes — see Scopes. With sessionToken, OWNER/ADMIN workspace members can operate without key scopes.
Get subscription
Subscribe to a plan
POST /v1/platform/workspaces/:id/subscription
tierIndex— plan index (0 = Free, 1 = Basic, …; maximum 10)billingType—PIXorCREDIT_CARD- With a saved card, use
paymentMethodId; with PIX, response may include payment details
Cancel subscription
DELETE /v1/platform/workspaces/:id/subscription — cancels renewal; access until end of cycle per plan policy.
Balance (pay-as-you-go)
Minimum recharge and balance expiry follow product rules (min. R$ 30, 90-day batches).
billingType: PIX or CREDIT_CARD.
Payment cards
Tokenization sends
creditCard and creditCardHolderInfo (name, email, tax ID, address, phone). Cards stay with the payment provider; API returns IDs for reuse in subscription and recharge.
Credit usage history
GET /v1/platform/workspaces/:id/credits/usage — scope billing:read.
Returns current credit balance, cycle renewal, balance in BRL, and a paginated usage list with channel, charge amount, correlationId, and apiKeyId. Useful for audits and agents explaining spend to customers.
Common errors
- 402
INSUFFICIENT_CREDITS/WORKSPACE_BLOCKED— no credits or balance to send - 403 — missing
billing:readorbilling:manageon API key - 503 — billing not configured in environment (provedor de pagamento)
GET /v1/workspaces/:id?include=billing with workspace scope.
