Billing API

Stripe-backed org billing: read billing state, initialize a subscription checkout, open the Stripe customer portal, and start checkouts for Warrant-licensed products.

Token tier: sessions only — API keys are rejected

The billing service rejects sk_live_ / sk_test_ API keys entirely (verified live). Authenticate with a kses_ session token or an RS256 JWT. This is by design: payment actions are tied to a human org member, not a machine credential.

Endpoints

MethodPathSDK (client.billing)
GET/v1/orgs/{org_id}/billingget
POST/v1/orgs/{org_id}/billing/initinit
POST/v1/orgs/{org_id}/billing/portalportal
POST/v1/checkout/warrant-productcreateWarrantCheckout

SDK Examples

// Construct the client with a session token (API keys are rejected here)
const billing = await client.billing.get(orgId);
console.log(billing.plan, billing.status);

// Start a subscription checkout — redirect the user to the returned URL
const { checkout_url } = await client.billing.init(orgId, {
  plan_code: 'pro',
});

// Open the Stripe customer portal for self-service management
const portal = await client.billing.portal(orgId);
let billing = client.billing().get(org_id).await?;

let session = client.billing().init(org_id, &BillingInitRequest {
    plan_code: "pro".into(),
}).await?;
Redirect URLs are origin-checked

Checkout/portal redirect URLs must be on .kapable.ai / .kapable.run / localhost — arbitrary origins are refused.

Billing in the console

The console's Billing page is the human counterpart to this API: it shows your current plan, usage against plan limits (apps, team members) with progress bars and overage warnings, and monthly invoices you can view and download once subscribed. The Manage Billing button opens the same Stripe customer portal as the portal endpoint — update payment methods, change plans, view history, or cancel. Current plan tiers and pricing live at kapable.ai/pricing.