Billing API
Credit balance, usage tracking, Stripe checkout, and auto-topup. Billing routes accept Bearer JWT or API key.
API-first: e2a has no dashboard UI. Use these endpoints to manage billing programmatically — check balance, top up credits, and view transactions via API.
Quick Examples
Check your balance:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.e2a.bot/v1/billing/balance
Top up credits (returns Stripe checkout URL):
curl -X POST -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"credit_amount": 1000}' \
https://api.e2a.bot/v1/billing/checkoutView transaction history:
curl -H "Authorization: Bearer YOUR_API_KEY" \ https://api.e2a.bot/v1/billing/transactions?limit=10
Billing Model
- Infra-only billing: CPU/RAM/Disk usage. LLM tokens are NOT charged — you BYO LLM key.
- Credits: Pre-paid balance in cents (smallest currency unit).
- Auto-topup: Automatically add credits when balance drops below threshold.
Get Balance
GET
api.e2a.bot/v1/billing/balanceCurrent credit balance in cents.
Response (200)
{ "credit_balance": 84750 } // $847.50Create Checkout Session
POST
api.e2a.bot/v1/billing/checkoutCreate a Stripe Checkout session to add credits. Returns a redirect URL.
Request
{ "credit_amount": 1000 } // $10.00Response (200)
{ "url": "https://checkout.stripe.com/..." }| Code | Meaning | When |
|---|---|---|
| 200 | OK | session created |
| 400 | Bad request | invalid or below-minimum amount |
List Transactions
GET
api.e2a.bot/v1/billing/transactionsPaginated billing transactions (top-ups, deductions, refunds).
Query Parameters
| Name | Default | Description |
|---|---|---|
| limit | 20 | Max items per page |
| offset | 0 | Skip items |
Response (200)
{
"transactions": [
{
"id": "txn_...",
"amount": -25,
"description": "Sandbox usage",
"timestamp": "2026-05-01T12:00:00Z"
},
{
"id": "txn_...",
"amount": 1000,
"description": "Credit top-up",
"timestamp": "2026-05-01T10:00:00Z"
}
]
}Auto-Topup
Get Configuration
GET
api.e2a.bot/v1/billing/auto-topup{
"enabled": true,
"threshold_amount": 100, // trigger when balance < $1.00
"topup_amount": 500 // add $5.00
}Update Configuration
POST
api.e2a.bot/v1/billing/auto-topup{
"enabled": true,
"threshold_amount": 500, // trigger when balance < $5.00
"topup_amount": 2000 // add $20.00
}