Credits, Auto-Recharge, and History
This endpoint group covers prepaid credit operations and billing observability.Endpoints
Credits and purchases
POST /api/billing/:workspaceId/add-creditsGET /api/billing/:workspaceId/credit-packagesGET /api/billing/:workspaceId/transactions
Usage and history
GET /api/billing/:workspaceId/usageGET /api/billing/:workspaceId/usage-historyGET /api/billing/:workspaceId/history
Auto-recharge
GET /api/billing/:workspaceId/auto-rechargePUT /api/billing/:workspaceId/auto-rechargePOST /api/billing/:workspaceId/auto-recharge/payment-method
Permissions
billing:read: read-only endpointsbilling:manage: add credits and auto-recharge mutations
Add credits payload
POST /api/billing/:workspaceId/add-credits
- Amount must be finite number.
- Minimum:
$5. - Maximum single purchase:
$10,000. - Currency currently supports
usdonly. - Amount is sanitized to cent precision before checkout creation.
Usage endpoint
GET /api/billing/:workspaceId/usage returns:
- resource usage counts (links, rules, domains, campaigns, pixels, apiKeys)
- click/conversion usage for current cycle
- plan limits
- credit balance and cycle usage
- billing cycle dates and subscription status
Usage history endpoint
GET /api/billing/:workspaceId/usage-history
Query params:
start_date(optional)end_date(optional)
Auto-recharge payloads
PUT /api/billing/:workspaceId/auto-recharge
POST /api/billing/:workspaceId/auto-recharge/payment-method
Common errors
400: invalid amount/currency/auto-recharge config/payment method403: missing permission404: workspace not found500: analytics/provider fetch failure

