Skip to main content
Billing via API is the remote cash register: subscribe, recharge balance, and add cards — same as the dashboard, over HTTP.
With an API key (or login 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

With an API key, billing routes require billing:read or billing:manage scopes — see Scopes. With sessionToken, OWNER/ADMIN workspace members can operate without key scopes.

Get subscription

Returns current plan, cycle credits, subscription status at the payment provider, next charge, and billing snapshot. Credits vs balance concepts: Billing.

Subscribe to a plan

POST /v1/platform/workspaces/:id/subscription
  • tierIndex — plan index (0 = Free, 1 = Basic, …; maximum 10)
  • billingTypePIX or CREDIT_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:read or billing:manage on API key
  • 503 — billing not configured in environment (provedor de pagamento)
Read-only alternative via messaging API: GET /v1/workspaces/:id?include=billing with workspace scope.