Billing API
Retrieve billing information and perform subscription actions such as creating a checkout session, enabling bring-your-own-key (BYOK) mode, checking usage, and purchasing credit packs.All billing endpoints require session authentication.
Get billing info
Response
Response fields
The
currentPlan value is set by the Stripe webhook when a checkout completes. Plans created through the primary checkout flow (/api/stripe/checkout) use solo, collective, label, or network. The billing dashboard displays these with their plan names: solo appears as “Solo”, collective as “Collective”, and label as “Label”.Errors
Billing actions
action field in the request body determines which operation is executed.
Create checkout session
Creates a Stripe checkout session for subscribing to a plan.Request body
Response
url to complete payment.
Errors
Enable BYOK
Enables bring-your-own-key mode with an external AI provider. When BYOK is active, AI requests are billed directly by the provider rather than consuming platform credits.Request body
Response
Errors
Disable BYOK
Disables BYOK mode and reverts to platform credits.Request body
Response
Get usage
Returns the current day’s unit consumption.Request body
Response
Buy credits
Purchases a credit pack.Request body
Response
Errors
Common errors
These apply to all billing POST actions:Stripe checkout
solo, collective, label, and network plan names with GBP pricing. All new subscriptions include a 7-day free trial — the first charge occurs after the trial period ends. Admin users (configured via ADMIN_EMAILS) bypass Stripe and are redirected directly to the onboarding page.
The checkout plans (
solo, collective, label, network) are the primary subscription path for agent provisioning. All plans start with a 7-day free trial. Admin users (configured via ADMIN_EMAILS) bypass Stripe entirely.Query parameters
Checkout plan pricing
Response
On success, redirects (303) to the Stripe checkout URL. The checkout session includes a 7-day free trial — the user enters payment details but is not charged until the trial ends. After checkout completes, Stripe redirects the user to/checkout/success?session_id={CHECKOUT_SESSION_ID}&plan={plan}. On error, redirects to the pricing page with an error query parameter.
Verify checkout session
Query parameters
Response
Errors
Expert setup checkout
Query parameters
Response
url to complete the £49 one-time payment. After payment, Stripe redirects to /expert-setup/success.
Errors
Subscription deploy
This is a backend-only endpoint that requires bearer token (API key) authentication.
Request body
Response
Plan resource allocations
The Railway provisioning function enforces resource limits for the following plans only:
underground, solo, collective, label, network. Legacy aliases (starter, pro, scale, enterprise, white_glove) are not resolved during Railway provisioning and default to solo limits (2 GB / 1 vCPU). The subscription deploy endpoint still accepts all tier values listed above.