Skip to main content

Billing API

Manage API keys, check usage, and upgrade plans via Stripe.

Create API Key

POST /api/v1/billing/api-keys

Requires JWT (Authorization: Bearer <token>).

{
"organizationName": "Acme DeFi",
"contactEmail": "dev@acme.com",
"tier": "Free"
}

Validation

FieldRules
organizationNameRequired, 2–200 characters
contactEmailRequired, valid email, max 320 characters
tierFree, Starter, Growth, or Enterprise (defaults to Free)

Response

{
"id": "a1b2c3d4-...",
"tier": "Free",
"rateLimit": 10,
"monthlyQueryLimit": 100,
"createdAt": "2026-02-27T12:00:00Z",
"note": "API key created. Use X-API-Key header to authenticate requests."
}

Get Usage

GET /api/v1/billing/usage

Requires API key (X-API-Key header).

Response

{
"queriesThisMonth": 47,
"monthlyLimit": 100,
"remaining": 53
}

For Enterprise tier, monthlyLimit and remaining are null (unlimited).


Create Checkout Session

POST /api/v1/billing/checkout

Creates a Stripe Checkout session for upgrading to a paid plan.

{
"planId": "starter",
"walletAddress": "0x1234...",
"successUrl": "https://your-app.com/billing/success",
"cancelUrl": "https://your-app.com/billing/cancel"
}

Validation

FieldRules
planIdRequired, starter or growth
walletAddressOptional, valid Ethereum address
successUrlOptional, valid URL, max 2,000 chars
cancelUrlOptional, valid URL, max 2,000 chars

Response

{
"sessionId": "cs_live_abc123...",
"url": "https://checkout.stripe.com/c/pay/cs_live_abc123..."
}

Redirect the user to url to complete payment.


Pricing Tiers

TierRate LimitMonthly QueriesWebhooksPrice
Free10 req/s100$0
Starter100 req/s10,0003$49/mo
Growth500 req/s100,00010$199/mo
Enterprise2,000 req/sUnlimited50Contact us

Subscription Lifecycle

Stripe webhooks automatically manage tier upgrades and downgrades:

Stripe EventAction
checkout.session.completedUpgrade API key to purchased tier
customer.subscription.updatedLog subscription change
customer.subscription.deletedDowngrade API key to Free tier