API reference
API overview
Authenticate requests and choose the correct API surface.
Base URLs
| Surface | Local base | Authentication |
|---|---|---|
| Public entitlement and billing API | http://localhost:4001/v1 | Secret, publishable, or customer-scoped token as permitted by the endpoint. |
| Policy API | http://localhost:4000/v1 through gateway | Server gateway token; browser uses authenticated BFF. |
| Dashboard BFF | http://localhost:3000/api | Signed-in dashboard session. |
| MCP | http://localhost:4009/mcp | email and wallet-gated OAuth for public remote connections. |
Authentication
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json| Credential | Use |
|---|---|
| Publishable key | Public plan listings only. Cannot read private customer access, issue tokens or consume credits. |
| Secret key | Trusted server operations, plans, checkout, and customer token issuance. |
| Customer token | Short-lived token scoped to a provider and holder; revoked when its issuing secret key is revoked. |
Create named, expiring provider keys through Dashboard → Developers. Secret keys appear only once and are stored as hashes. Rotate by creating a replacement, updating your integration, then revoking the old key. Internal deployment credentials are never returned. Never paste secret keys into these docs, browser examples, or an assistant chat.
Error format
{
"error": {
"code": "HOLDER_MISMATCH",
"message": "grant holder does not match"
}
}| Status | Typical meaning |
|---|---|
| 400 | Invalid body, precision, or missing idempotency key. |
| 401 / 403 | Missing credentials, insufficient scope, or refused access. |
| 402 | Checkout payment could not yet be verified. |
| 404 | No matching plan, grant, or resource. |
| 409 | Conflicting state, reused payment, or unavailable deployment. |
| 502 / 503 | Upstream failure, configuration issue, or insufficient deployer gas. |
Endpoint reference
Authenticated customer billing BFF
| Route | Purpose |
|---|---|
| GET /api/customers?search=&page=0 | Provider-owned paid customers; 20 records per page. |
| GET /api/billing-documents?view=issued|purchases&status=ALL&page=0 | Issued invoices or exact signed-in holder purchases; optional customer filter. |
| GET /api/billing-documents?id=INVOICE_ID | One private document, visible to issuer, billed holder or authenticated billing email. |
| GET /api/provider-checkouts?status=ALL&page=0&days=30 | Provider-scoped checkout cohort; days is 0, 7, 30 or 90. |
These routes require the console session and return no-store responses. Ownership is derived server-side. Supplying a provider or holder query parameter cannot broaden scope. They are not public secret-key daemon endpoints.