Billing
Returns the workspace prepaid credit balance, published rates, auto-recharge settings, saved payment methods, and paginated usage history. Requires billing.view. GET /api/billing/subscription remains as a deprecated alias of this route.
Authorization
bearerAuth Create keys under Settings → API keys. Prefix ak_. Send as Authorization: Bearer ak_....
In: header
Query Parameters
1 <= value11 <= value <= 10020Optional usage filter by module slug
Optional usage filter by entity
uuidResponse Body
application/json
application/json
curl -X GET "https://example.com/api/billing/credits"{ "balanceCents": 0, "balanceDollars": "string", "unlimitedUsage": true, "creditRates": {}, "autoRecharge": {}, "paymentMethods": [ {} ], "usage": {}, "recentTransactions": [ {} ], "transactionsPagination": {}}{ "error": "string"}Starts Stripe Checkout to add prepaid USD credits. Minimum $5.00 (amountCents ≥ 500). Requires billing.manage.
Authorization
bearerAuth Create keys under Settings → API keys. Prefix ak_. Send as Authorization: Bearer ak_....
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/api/billing/checkout" \ -H "Content-Type: application/json" \ -d '{ "amountCents": 500 }'{ "url": "http://example.com"}{ "error": "string"}Charges a saved Stripe payment method and adds prepaid credits. Minimum $5.00. Requires billing.manage.
Authorization
bearerAuth Create keys under Settings → API keys. Prefix ak_. Send as Authorization: Bearer ak_....
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/api/billing/purchase" \ -H "Content-Type: application/json" \ -d '{ "amountCents": 500, "paymentMethodId": "string" }'{ "ok": true, "balanceAfterCents": 0, "alreadyApplied": true, "requiresCheckout": true, "checkoutUrl": "http://example.com"}{ "error": "string"}Returns whether auto-recharge is on, the low-balance threshold, and the refill amount. Requires billing.view.
Authorization
bearerAuth Create keys under Settings → API keys. Prefix ak_. Send as Authorization: Bearer ak_....
In: header
Response Body
application/json
application/json
curl -X GET "https://example.com/api/billing/auto-recharge"{ "autoRechargeEnabled": true, "autoRechargeThresholdCents": 0, "autoRechargeAmountCents": 0, "stripePaymentMethodId": "string"}{ "error": "string"}Turn auto-recharge on or off and set the threshold and refill amount (refill minimum $5.00). Requires billing.manage.
Authorization
bearerAuth Create keys under Settings → API keys. Prefix ak_. Send as Authorization: Bearer ak_....
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X PATCH "https://example.com/api/billing/auto-recharge" \ -H "Content-Type: application/json" \ -d '{}'{ "error": "string"}Opens the Stripe portal to manage payment methods and credit purchases. Requires billing.manage.
Authorization
bearerAuth Create keys under Settings → API keys. Prefix ak_. Send as Authorization: Bearer ak_....
In: header
Response Body
application/json
application/json
curl -X POST "https://example.com/api/billing/portal"{ "url": "http://example.com"}{ "error": "string"}