API reference
API: Billing
| Method | Path | What it does | Scope |
|---|---|---|---|
| GET | /v1/billing | The organization's plan, subscription, seats and this month's usage against the plan's allowance (AI credits) | billing:read |
| POST | /v1/billing/cancel | Cancel the subscription at the end of the period (owners). Asks why: a reason from the list, and optional words. The workspace goes back to Free when the period ends; until then it can be undone (web app only) | billing:write |
| POST | /v1/billing/checkout | Start a Stripe checkout for a paid plan (owners). Returns the checkout URL to open; the plan applies when Stripe confirms the subscription (web app only) | billing:write |
| GET | /v1/billing/invoices | Invoices from Stripe, newest first, with tax shown separately (owners) | billing:write |
| GET | /v1/billing/invoices/:id/pdf | A short-lived link to one invoice's PDF (owners) | billing:write |
| POST | /v1/billing/plan | Change to another paid plan or billing interval now, prorated (owners). Moving to a smaller plan asks why: a reason from the list, and optional words (web app only) | billing:write |
| POST | /v1/billing/portal | Short-lived links to Stripe's customer portal: update the payment method, invoices, billing details (owners; cancelling is POST /v1/billing/cancel) (web app only) | billing:write |
| GET | /v1/billing/prices | Plan prices for a location, before sales tax (we sell to businesses in the United States; tax is added at checkout where it applies) | billing:read |
| POST | /v1/billing/resume | Keep the subscription: undo a cancel that hasn't happened yet (owners) (web app only) | billing:write |
| GET | /v1/billing/run-costs | What runs cost before you start them: credits per unit and the most one AI request can cost; with billing access, credits left this month, today's AI spend and budget, and what an agent's runs or your agent's requests cost on average | marketing:read |
| POST | /v1/billing/seats/sync | Set the subscription's quantity to the current sites (per-site plans), prorated on the next invoice (owners, in the app; also runs daily) (web app only) | billing:write |
| POST | /v1/billing/upgrade-link | For agents: suggest a paid plan to the organization's owners. Returns a link to the billing page with the plan filled in, for an owner to review and pay; nothing is bought here, and the owners are notified (naming the key or app that asked) | agents:write |
| GET | /v1/billing/upgrade-link/check | Whether an agent suggested this plan to the organization in the last 7 days (the billing page checks before showing it) | billing:read |
Examples
GET /v1/billing
The organization's plan, subscription, seats and this month's usage against the plan's allowance (AI credits)
curl -s "https://api.cubbylark.com/v1/billing" \
-H "Authorization: Bearer $KC_API_KEY"const res = await fetch(`https://api.cubbylark.com/v1/billing`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.KC_API_KEY}` },
});
const data = await res.json();GET /v1/billing/invoices
Invoices from Stripe, newest first, with tax shown separately (owners)
curl -s "https://api.cubbylark.com/v1/billing/invoices" \
-H "Authorization: Bearer $KC_API_KEY"const res = await fetch(`https://api.cubbylark.com/v1/billing/invoices`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.KC_API_KEY}` },
});
const data = await res.json();GET /v1/billing/invoices/$ID/pdf
A short-lived link to one invoice's PDF (owners)
curl -s "https://api.cubbylark.com/v1/billing/invoices/$ID/pdf" \
-H "Authorization: Bearer $KC_API_KEY"const res = await fetch(`https://api.cubbylark.com/v1/billing/invoices/${id}/pdf`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.KC_API_KEY}` },
});
const data = await res.json();GET /v1/billing/prices
Plan prices for a location, before sales tax (we sell to businesses in the United States; tax is added at checkout where it applies)
curl -s "https://api.cubbylark.com/v1/billing/prices" \
-H "Authorization: Bearer $KC_API_KEY"const res = await fetch(`https://api.cubbylark.com/v1/billing/prices`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.KC_API_KEY}` },
});
const data = await res.json();GET /v1/billing/run-costs
What runs cost before you start them: credits per unit and the most one AI request can cost; with billing access, credits left this month, today's AI spend and budget, and what an agent's runs or your agent's requests cost on average
curl -s "https://api.cubbylark.com/v1/billing/run-costs" \
-H "Authorization: Bearer $KC_API_KEY"const res = await fetch(`https://api.cubbylark.com/v1/billing/run-costs`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.KC_API_KEY}` },
});
const data = await res.json();POST /v1/billing/upgrade-link
For agents: suggest a paid plan to the organization's owners. Returns a link to the billing page with the plan filled in, for an owner to review and pay; nothing is bought here, and the owners are notified (naming the key or app that asked)
curl -s -X POST "https://api.cubbylark.com/v1/billing/upgrade-link" \
-H "Authorization: Bearer $KC_API_KEY" \
-H "content-type: application/json" \
-d '{}'const res = await fetch(`https://api.cubbylark.com/v1/billing/upgrade-link`, {
method: "POST",
headers: { authorization: `Bearer ${process.env.KC_API_KEY}`, "content-type": "application/json" },
body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();GET /v1/billing/upgrade-link/check
Whether an agent suggested this plan to the organization in the last 7 days (the billing page checks before showing it)
curl -s "https://api.cubbylark.com/v1/billing/upgrade-link/check" \
-H "Authorization: Bearer $KC_API_KEY"const res = await fetch(`https://api.cubbylark.com/v1/billing/upgrade-link/check`, {
method: "GET",
headers: { authorization: `Bearer ${process.env.KC_API_KEY}` },
});
const data = await res.json();Request and response schemas: https://www.cubbylark.com/openapi.json. All resources: API reference.