TripleBooks
Platform

Billing

GET
/api/billing/credits

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
AuthorizationBearer <token>

Create keys under Settings → API keys. Prefix ak_. Send as Authorization: Bearer ak_....

In: header

Query Parameters

page?integer
Range1 <= value
Default1
pageSize?integer
Range1 <= value <= 100
Default20
module?string

Optional usage filter by module slug

filterEntityId?string

Optional usage filter by entity

Formatuuid

Response 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"}
POST
/api/billing/checkout

Starts Stripe Checkout to add prepaid USD credits. Minimum $5.00 (amountCents ≥ 500). Requires billing.manage.

Authorization

bearerAuth
AuthorizationBearer <token>

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"}
POST
/api/billing/purchase

Charges a saved Stripe payment method and adds prepaid credits. Minimum $5.00. Requires billing.manage.

Authorization

bearerAuth
AuthorizationBearer <token>

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"}
Empty
GET
/api/billing/auto-recharge

Returns whether auto-recharge is on, the low-balance threshold, and the refill amount. Requires billing.view.

Authorization

bearerAuth
AuthorizationBearer <token>

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"}
PATCH
/api/billing/auto-recharge

Turn auto-recharge on or off and set the threshold and refill amount (refill minimum $5.00). Requires billing.manage.

Authorization

bearerAuth
AuthorizationBearer <token>

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 '{}'
Empty
{  "error": "string"}
POST
/api/billing/portal

Opens the Stripe portal to manage payment methods and credit purchases. Requires billing.manage.

Authorization

bearerAuth
AuthorizationBearer <token>

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"}

On this page