ScalixScalix Docs
Sign up

Billing API

Billing API for Scalix Cloud: plans and pricing, hosted checkout and portal, subscriptions, invoices, payment methods, credits and the credit ledger, spending cap, usage analytics and forecast, tax info and calculation, GDPR data-subject ops, and service/module/infra agreements. Tenant identity is resolved server-side from the caller's credential.

REST API endpoints for Billing. 60 operations.

Get the service catalog

plaintext
GET /v1/billing/catalog/{tenant_id}

The billable-service catalog with per-service agreement state for the org.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Service catalog with agreement state
401Missing or invalid API key
403Not your org
500Internal error

operationId: getServiceCatalog

Start a hosted checkout

plaintext
POST /v1/billing/checkout

Creates a provider checkout session for the plan upgrade (or first paid plan) and returns the URL to send the customer to.

Auth: Bearer API key

Request body

application/json (required) — schema CheckoutRequest.

Responses

StatusDescription
201Checkout session created
400Invalid request (e.g. missing tenant/email, or the free plan)
401Missing or invalid API key
403Not your org
500Internal error

operationId: createCheckout

Get the credit ledger

plaintext
GET /v1/billing/credit-ledger/{tenant_id}

Returns the org's full credit ledger (the BillingPage's ledger table).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Credit ledger
401Missing or invalid API key
403Not your org
500Internal error

operationId: getCreditLedger

Get credit transactions

plaintext
GET /v1/billing/credit-transactions/{tenant_id}

Returns the org's credit transaction list (the BillingPage's transactions table).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Credit transactions
401Missing or invalid API key
403Not your org
500Internal error

operationId: getCreditTransactions

Get per-metric usage cost

plaintext
GET /v1/billing/credit-usage-metrics/{tenant_id}

Returns credit consumption broken down by billing metric (the usage-by-service view).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Usage cost by metric
401Missing or invalid API key
403Not your org
500Internal error

operationId: getUsageCostByMetric

Get credit usage

plaintext
GET /v1/billing/credit-usage/{tenant_id}

Returns the org's credit consumption for the current period.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Credit usage for the period
401Missing or invalid API key
403Not your org
500Internal error

operationId: getCreditUsage

Get the credit balance

plaintext
GET /v1/billing/credits/{tenant_id}

Returns the org's current credit balance and billing mode (legacy vs credit).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Credit balance and billing mode
401Missing or invalid API key
403Not your org
500Internal error

operationId: getCreditBalance

Start a credit top-up checkout

plaintext
POST /v1/billing/credits/{tenant_id}/checkout

Creates a hosted checkout session to buy credits.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema object.

Responses

StatusDescription
201Top-up checkout session
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: createCreditTopupCheckout

Get the credit history

plaintext
GET /v1/billing/credits/{tenant_id}/history

Returns the org's credit ledger entries (grants, purchases, deductions).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Credit ledger entries
401Missing or invalid API key
403Not your org
500Internal error

operationId: getCreditHistory

Create a Razorpay top-up order

plaintext
POST /v1/billing/credits/{tenant_id}/razorpay-order

Razorpay-only path: creates the order the console's Checkout.js modal pays against.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema object.

Responses

StatusDescription
201Razorpay order
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: createRazorpayTopupOrder

Submit cancellation feedback

plaintext
POST /v1/billing/feedback/cancellation

Records why an org cancelled; feeds churn analysis. The caller's credential must match the tenant_id in the body.

Auth: Bearer API key

Request body

application/json (required) — schema object.

Responses

StatusDescription
200Feedback recorded
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: submitCancellationFeedback

Get the org's GDPR consent state

plaintext
GET /v1/billing/gdpr/{tenant_id}/consent

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Consent state
401Missing or invalid API key
403Not your org
500Internal error

operationId: getGdprConsent

Update the org's GDPR consent

plaintext
POST /v1/billing/gdpr/{tenant_id}/consent

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema object.

Responses

StatusDescription
200Consent updated
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: updateGdprConsent

Correct the org's billing data (GDPR data-subject correction)

plaintext
POST /v1/billing/gdpr/{tenant_id}/correct

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema object.

Responses

StatusDescription
200Billing data corrected
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: gdprCorrect

Delete the org's billing data (GDPR data-subject deletion)

plaintext
POST /v1/billing/gdpr/{tenant_id}/delete

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Billing data deleted
401Missing or invalid API key
403Not your org
500Internal error

operationId: gdprDelete

Export the org's billing data (GDPR data-subject export)

plaintext
POST /v1/billing/gdpr/{tenant_id}/export

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Billing data export
401Missing or invalid API key
403Not your org
500Internal error

operationId: gdprExport

Get the glitch-tracker status

plaintext
GET /v1/billing/glitch-tracker

Whether the Glitches feed is enabled for the project and its service agreement state.

Auth: Bearer API key

Responses

StatusDescription
200Glitch-tracker status
401Missing or invalid API key
500Internal error

operationId: getGlitchTrackerStatus

Disable the glitch-tracker

plaintext
POST /v1/billing/glitch-tracker/disable

Auth: Bearer API key

Responses

StatusDescription
200Glitch-tracker disabled
401Missing or invalid API key
500Internal error

operationId: disableGlitchTracker

Enable the glitch-tracker

plaintext
POST /v1/billing/glitch-tracker/enable

Auth: Bearer API key

Responses

StatusDescription
200Glitch-tracker enabled
401Missing or invalid API key
500Internal error

operationId: enableGlitchTracker

Get the infrastructure agreement

plaintext
GET /v1/billing/infra-agreement/{tenant_id}

The org's infrastructure services agreement (the BillingPage's agreements tab).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Infrastructure agreement
401Missing or invalid API key
403Not your org
500Internal error

operationId: getInfraAgreement

Disable the infrastructure agreement

plaintext
POST /v1/billing/infra-agreement/{tenant_id}/disable

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Infrastructure agreement disabled
401Missing or invalid API key
403Not your org
500Internal error

operationId: disableInfraAgreement

List the org's invoices

plaintext
GET /v1/billing/invoices/{tenant_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Invoice list
401Missing or invalid API key
403Not your org
500Internal error

operationId: listInvoices

Render an invoice as HTML

plaintext
GET /v1/billing/invoices/{tenant_id}/{invoice_id}/html

Returns the printable invoice document for download/email.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
invoice_idpathstringYesInvoice id

Responses

StatusDescription
200Invoice HTML
401Missing or invalid API key
403Not your org
404Invoice not found
500Internal error

operationId: renderInvoiceHtml

Retry a failed invoice payment

plaintext
POST /v1/billing/invoices/{tenant_id}/{invoice_id}/retry

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
invoice_idpathstringYesInvoice id

Responses

StatusDescription
200Payment retried
401Missing or invalid API key
403Not your org
404Invoice not found
500Internal error

operationId: retryInvoicePayment

List model pricing tiers

plaintext
GET /v1/billing/model-tiers

Public — no API key required. The per-tier token prices used for usage-based billing.

Auth: none

Responses

StatusDescription
200Model pricing tiers
500Internal error

operationId: listModelTiers

Get a module agreement

plaintext
GET /v1/billing/module-agreement/{tenant_id}/{module}

The agreement for one billable module (per-module autodebit setup).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
modulepathstringYesModule id

Responses

StatusDescription
200Module agreement
401Missing or invalid API key
403Not your org
404Module agreement not found
500Internal error

operationId: getModuleAgreement

Set up module autodebit

plaintext
POST /v1/billing/module-agreement/{tenant_id}/{module}/autodebit

Authorizes automatic debit for the module's usage charges.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
modulepathstringYesModule id

Responses

StatusDescription
200Autodebit set up
401Missing or invalid API key
403Not your org
500Internal error

operationId: setupModuleAutodebit

Disable a module agreement

plaintext
POST /v1/billing/module-agreement/{tenant_id}/{module}/disable

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
modulepathstringYesModule id

Responses

StatusDescription
200Module agreement disabled
401Missing or invalid API key
403Not your org
500Internal error

operationId: disableModuleAgreement

Toggle overage billing

plaintext
POST /v1/billing/overage/{tenant_id}

Enables or disables allow-overage (continue serving past the credit balance and bill the difference) for the org.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema object.

Responses

StatusDescription
200Overage setting updated
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: toggleOverage

Get the billing overview

plaintext
GET /v1/billing/overview/{tenant_id}

The BillingPage's landing view: current plan, subscription status, balance, and spend summary in one response.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Billing overview
401Missing or invalid API key
403Not your org
500Internal error

operationId: getBillingOverview

List the org's payment methods

plaintext
GET /v1/billing/payment-methods/{tenant_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Payment methods
401Missing or invalid API key
403Not your org
500Internal error

operationId: listPaymentMethods

Remove a payment method

plaintext
DELETE /v1/billing/payment-methods/{tenant_id}/{pm_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
pm_idpathstringYesPayment method id

Responses

StatusDescription
200Payment method removed
401Missing or invalid API key
403Not your org
404Payment method not found
500Internal error

operationId: removePaymentMethod

Set the default payment method

plaintext
POST /v1/billing/payment-methods/{tenant_id}/{pm_id}/default

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
pm_idpathstringYesPayment method id

Responses

StatusDescription
200Default payment method set
401Missing or invalid API key
403Not your org
404Payment method not found
500Internal error

operationId: setDefaultPaymentMethod

Authorize a Razorpay payment method

plaintext
POST /v1/billing/payment-methods/{tenant_id}/razorpay-authorization

Starts the Razorpay authorization flow for adding a card via the console's in-page Checkout.js modal.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
201Authorization session (razorpay_key_id + order id)
401Missing or invalid API key
403Not your org
500Internal error

operationId: createRazorpayPaymentMethodAuthorization

List the billing plans (the pricing page's source)

plaintext
GET /v1/billing/plans

Public — no API key required. Returns every active plan with its prices, limits, support tier, SLA, and features.

Auth: none

Responses

StatusDescription
200Active plans
500Internal error

operationId: listPlans

Get one plan's detail

plaintext
GET /v1/billing/plans/{plan_id}

Public — no API key required.

Auth: none

Parameters

NameInTypeRequiredDescription
plan_idpathstringYesPlan id

Responses

StatusDescription
200Plan detail
404Plan not found
500Internal error

operationId: getPlanDetail

Open the billing portal

plaintext
POST /v1/billing/portal

Creates a provider customer-portal session for self-serve payment method and subscription management.

Auth: Bearer API key

Request body

application/json (required) — schema object.

Responses

StatusDescription
201Portal session created (url in the body)
401Missing or invalid API key
403Not your org
500Internal error

operationId: createPortal

Public pricing matrix

plaintext
GET /v1/billing/pricing

Public — no API key required. The per-plan, per-provider price list the pricing page renders.

Auth: none

Responses

StatusDescription
200Public pricing matrix
500Internal error

operationId: publicPricing

Agree to a service agreement

plaintext
POST /v1/billing/service-agreement/{tenant_id}/{service_id}/agree

Records the org's acceptance of one service's agreement (enables the service for billing).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
service_idpathstringYesService id

Responses

StatusDescription
200Service agreement accepted
401Missing or invalid API key
403Not your org
500Internal error

operationId: agreeService

Disable a service agreement

plaintext
POST /v1/billing/service-agreement/{tenant_id}/{service_id}/disable

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)
service_idpathstringYesService id

Responses

StatusDescription
200Service agreement disabled
401Missing or invalid API key
403Not your org
500Internal error

operationId: disableServiceAgreement

List billable services

plaintext
GET /v1/billing/services

Public — no API key required. The service catalog the console's BillingPage enables per org.

Auth: none

Responses

StatusDescription
200Billable services
500Internal error

operationId: listBillingServices

List the org's enabled services

plaintext
GET /v1/billing/services/{tenant_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Services enabled for the org
401Missing or invalid API key
403Not your org
500Internal error

operationId: listTenantServices

Complete the org's billing setup

plaintext
GET /v1/billing/setup/{tenant_id}

Bootstraps the org's billing customer record (free tier) with the signup email; idempotent.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Billing setup complete
401Missing or invalid API key
403Not your org
500Internal error

operationId: setupTenantBilling

Delete the spending cap

plaintext
DELETE /v1/billing/spending-cap/{tenant_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Spending cap removed
401Missing or invalid API key
403Not your org
500Internal error

operationId: deleteSpendingCap

Get the spending cap

plaintext
GET /v1/billing/spending-cap/{tenant_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Current spending cap
401Missing or invalid API key
403Not your org
500Internal error

operationId: getSpendingCap

Set the spending cap

plaintext
POST /v1/billing/spending-cap/{tenant_id}

Accepts PUT, PATCH and POST on the same path; the body is the cap configuration.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema SpendingCapRequest.

Responses

StatusDescription
200Spending cap set
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: setSpendingCap

Get the org's subscription

plaintext
GET /v1/billing/subscription/{tenant_id}

Returns the current subscription with the display amount in the org's pinned currency, is_paid, and any scheduled (pending) plan change.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Current subscription
401Missing or invalid API key
403Not your org
404No subscription
500Internal error

operationId: getSubscription

Cancel the subscription

plaintext
POST /v1/billing/subscription/{tenant_id}/cancel

Cancels at the current period end (the console confirms first).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Subscription cancelled
401Missing or invalid API key
403Not your org
404No subscription
500Internal error

operationId: cancelSubscription

Change the plan (in-place upgrade/downgrade)

plaintext
POST /v1/billing/subscription/{tenant_id}/change

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema ChangePlanRequest.

Responses

StatusDescription
200Plan changed (or downgrade scheduled)
400Invalid request
401Missing or invalid API key
403Not your org
404No subscription
500Internal error

operationId: changePlan

Reactivate a cancelled subscription

plaintext
POST /v1/billing/subscription/{tenant_id}/reactivate

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Subscription reactivated
401Missing or invalid API key
403Not your org
404No subscription
500Internal error

operationId: reactivateSubscription

Get the org's tax info

plaintext
GET /v1/billing/tax-info/{tenant_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Tax info (GST/VAT registration)
401Missing or invalid API key
403Not your org
500Internal error

operationId: getTaxInfo

Update the org's tax info

plaintext
POST /v1/billing/tax-info/{tenant_id}

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Request body

application/json (required) — schema TaxInfoRequest.

Responses

StatusDescription
200Tax info updated
400Invalid request
401Missing or invalid API key
403Not your org
500Internal error

operationId: updateTaxInfo

Calculate tax for a charge

plaintext
POST /v1/billing/tax/calculate

Applies the org's tax-info settings (GST/VAT, reverse charge, LUT, exemption) to a pre-tax amount. The stored tax profile fills omitted body fields only for a caller authenticated as that tenant; an unauthenticated caller gets the pure computation from the body fields.

Auth: Bearer API key

Request body

application/json (required) — schema object.

Responses

StatusDescription
200Tax breakdown for the amount
400Invalid request
500Internal error

operationId: calculateTax

Get usage by model

plaintext
GET /v1/billing/usage/{tenant_id}/by-model

Token usage and cost broken down per AI model.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Usage by model
401Missing or invalid API key
403Not your org
500Internal error

operationId: getUsageByModel

Get the usage forecast

plaintext
GET /v1/billing/usage/{tenant_id}/forecast

Projected end-of-period spend based on usage so far.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Projected end-of-period spend
401Missing or invalid API key
403Not your org
500Internal error

operationId: getUsageForecast

Get the usage history

plaintext
GET /v1/billing/usage/{tenant_id}/history

Period-by-period usage history (the BillingPage's usage table).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Usage history
401Missing or invalid API key
403Not your org
500Internal error

operationId: getUsageHistory

Get the current overage amount

plaintext
GET /v1/billing/usage/{tenant_id}/overage

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Current overage
401Missing or invalid API key
403Not your org
500Internal error

operationId: getUsageOverage

Get the usage spread

plaintext
GET /v1/billing/usage/{tenant_id}/spread

Returns usage distributed across the billing period (the spend-over- time chart).

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Usage spread across the period
401Missing or invalid API key
403Not your org
500Internal error

operationId: getUsageSpread

Get the usage summary

plaintext
GET /v1/billing/usage/{tenant_id}/summary

Aggregated usage-and-spend summary for the current period.

Auth: Bearer API key

Parameters

NameInTypeRequiredDescription
tenant_idpathstringYesTenant id (UUID)

Responses

StatusDescription
200Usage summary
401Missing or invalid API key
403Not your org
500Internal error

operationId: getBillingUsageSummary

GET /v1/public/service-rates

plaintext
GET /v1/public/service-rates

Auth: none

Responses

StatusDescription
200The public rate card: one row per billable, enabled, service-mapped non-AI metric. Sell-side only: our_cost_cents never leaves this query.
404Billing not configured on this deployment

operationId: get_public_service_rates