Skip to main content

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

Returns the available plans, the authenticated user’s current plan, subscription status, BYOK status, and daily usage.

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”.
The billing endpoint internally defines a legacy plan catalog (starter at 19/mo,proat19/mo, `pro` at 39/mo, scale at $79/mo) which may appear in responses for users who subscribed before the current plan names were introduced. The primary checkout flow and provisioning endpoints use the current plan names (solo, collective, label, network). If you encounter legacy plan names in billing responses, they map to the current plans as follows: startersolo, procollective, scalelabel.

Errors

Billing actions

Performs a billing action. The 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

Redirect the user to the returned 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

Redirects to a Stripe checkout session for subscribing to a plan. This endpoint uses the 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

Verifies a Stripe checkout session after payment and activates the subscription. Requires session authentication.

Query parameters

Response

Errors

Expert setup checkout

Creates a Stripe checkout session for a one-time expert setup booking. No session authentication is required — the customer email is passed as a query parameter.

Query parameters

Response

Redirect the user to the returned url to complete the £49 one-time payment. After payment, Stripe redirects to /expert-setup/success.

Errors

Subscription deploy

Records a subscription-to-plan mapping so the next agent deployment uses the correct resource tier. This endpoint is called by the Stripe webhook after a checkout completes.
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.

Errors