Skip to content

API reference

API: Billing

Markdown version

MethodPathWhat it doesScope
GET/v1/billingThe organization's plan, subscription, seats and this month's usage against the plan's allowance (AI credits)billing:read
GET/v1/billing/api-useThis month's place-data requests made with the organization's API keys: what's included, what's used, the monthly limit for more and what that costsbilling:read
PUT/v1/billing/api-use/limitSet how much requests beyond the included 10,000 a month may cost (owners): $1 for each 10,000, charged at the end of the month, never more than this. 0 stops at what's included. Raising it needs the plan that renews (web app only)billing:write
POST/v1/billing/cancelCancel the subscription at the end of the period (owners), in one step. The workspace goes back to Free when the period ends; until then it can be undone. Why can be told after (optional) (web app only)billing:write
POST/v1/billing/cancel/reasonAfter cancelling: why, if you'd like to say (owners; optional). A reason from the list, and optional words. Told once (web app only)billing:write
POST/v1/billing/checkoutStart 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/invoicesInvoices from Stripe, newest first, with tax shown separately (owners)billing:write
GET/v1/billing/invoices/:id/pdfA short-lived link to one invoice's PDF (owners)billing:write
POST/v1/billing/monthPay once for one month of the plan (owners): returns the checkout URL to open. It never renews and nothing more is charged; the month starts when Stripe confirms the payment, or when a month already paid for ends (web app only)billing:write
POST/v1/billing/planChange 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/portalShort-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/pricesPlan 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/resumeKeep the subscription: undo a cancel that hasn't happened yet (owners) (web app only)billing:write
GET/v1/billing/run-costsWhat 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 averagemarketing:read
POST/v1/billing/seats/syncSet 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-linkFor 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/checkWhether 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.wherestead.com/v1/billing" \
  -H "Authorization: Bearer $NB_API_KEY"
const res = await fetch(`https://api.wherestead.com/v1/billing`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.NB_API_KEY}` },
});
const data = await res.json();

GET /v1/billing/api-use

This month's place-data requests made with the organization's API keys: what's included, what's used, the monthly limit for more and what that costs

curl -s "https://api.wherestead.com/v1/billing/api-use" \
  -H "Authorization: Bearer $NB_API_KEY"
const res = await fetch(`https://api.wherestead.com/v1/billing/api-use`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.NB_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.wherestead.com/v1/billing/invoices" \
  -H "Authorization: Bearer $NB_API_KEY"
const res = await fetch(`https://api.wherestead.com/v1/billing/invoices`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.NB_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.wherestead.com/v1/billing/invoices/$ID/pdf" \
  -H "Authorization: Bearer $NB_API_KEY"
const res = await fetch(`https://api.wherestead.com/v1/billing/invoices/${id}/pdf`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.NB_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.wherestead.com/v1/billing/prices" \
  -H "Authorization: Bearer $NB_API_KEY"
const res = await fetch(`https://api.wherestead.com/v1/billing/prices`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.NB_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.wherestead.com/v1/billing/run-costs" \
  -H "Authorization: Bearer $NB_API_KEY"
const res = await fetch(`https://api.wherestead.com/v1/billing/run-costs`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.NB_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.wherestead.com/v1/billing/upgrade-link" \
  -H "Authorization: Bearer $NB_API_KEY" \
  -H "content-type: application/json" \
  -d '{}'
const res = await fetch(`https://api.wherestead.com/v1/billing/upgrade-link`, {
  method: "POST",
  headers: { authorization: `Bearer ${process.env.NB_API_KEY}`, "content-type": "application/json" },
  body: JSON.stringify({}), // fields: see the OpenAPI schema
});
const data = await res.json();

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.wherestead.com/v1/billing/upgrade-link/check" \
  -H "Authorization: Bearer $NB_API_KEY"
const res = await fetch(`https://api.wherestead.com/v1/billing/upgrade-link/check`, {
  method: "GET",
  headers: { authorization: `Bearer ${process.env.NB_API_KEY}` },
});
const data = await res.json();

Request and response schemas: https://www.wherestead.com/openapi.json. All resources: API reference.

Send feedback

Tell us what's broken, confusing or missing on this page, or an idea. It goes to the team that builds the product.
Please don't include passwords or card numbers.
Only to reply about this. Never added to any mailing list.