Billing & Usage
Manage your subscription, check usage, and access Stripe billing portals.
Plans
| Plan | Price | Token Allowance | Rate Limit |
|---|---|---|---|
| Free | $0/mo | 1,000 tokens/mo | 100 req/min |
| Pro | $49/mo | 100,000 tokens/mo | 1,000 req/min |
| Enterprise | Custom | Custom | Unlimited |
Tokens are consumed based on the size of text processed. One token is approximately four characters.
GET /billing/balance
Get the current balance and usage for the billing period.
Example
curl https://api.pii-redactor.dev/api/v1/billing/balance \
-H "X-API-Key: pk_live_abc123"{
"plan": "pro",
"tokens_used": 42350,
"tokens_limit": 100000,
"period_start": "2026-02-01T00:00:00Z",
"period_end": "2026-03-01T00:00:00Z"
}GET /billing/usage
Get usage history across billing periods.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from_date | string | No | Start date (ISO 8601) |
to_date | string | No | End date (ISO 8601) |
granularity | string | No | daily or monthly (default: monthly) |
Example
curl "https://api.pii-redactor.dev/api/v1/billing/usage?granularity=daily&from_date=2026-02-01" \
-H "X-API-Key: pk_live_abc123"[
{
"date": "2026-02-11",
"tokens_used": 15200,
"requests": 312
},
{
"date": "2026-02-12",
"tokens_used": 18900,
"requests": 401
},
{
"date": "2026-02-13",
"tokens_used": 8250,
"requests": 187
}
]POST /billing/checkout
Create a Stripe checkout session to upgrade or start a subscription. Returns a URL to redirect the user to Stripe.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
plan | string | Yes | Plan to subscribe to (pro or enterprise) |
success_url | string | Yes | URL to redirect after successful payment |
cancel_url | string | Yes | URL to redirect if checkout is cancelled |
Example
curl -X POST https://api.pii-redactor.dev/api/v1/billing/checkout \
-H "X-API-Key: pk_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"plan": "pro",
"success_url": "https://app.pii-redactor.dev/billing?success=true",
"cancel_url": "https://app.pii-redactor.dev/billing?cancelled=true"
}'{
"checkout_url": "https://checkout.stripe.com/c/pay/cs_live_..."
}POST /billing/portal
Create a Stripe customer portal session for managing payment methods, invoices, and subscription details.
Example
curl -X POST https://api.pii-redactor.dev/api/v1/billing/portal \
-H "X-API-Key: pk_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"return_url": "https://app.pii-redactor.dev/billing"
}'{
"portal_url": "https://billing.stripe.com/p/session/..."
}POST /billing/cancel
Cancel the current subscription. The subscription remains active until the end of the current billing period, then reverts to the free plan.
Example
curl -X POST https://api.pii-redactor.dev/api/v1/billing/cancel \
-H "X-API-Key: pk_live_abc123"{
"detail": "Subscription cancelled. Active until 2026-03-01T00:00:00Z"
}