Developers · Documentation

Build billing that notices you.

One REST API, server SDKs for five languages and a webhook system. Every read is a billable event, including the ones you make while reading these docs.

API version 2026-10-29.ψ · current

Quickstart #

Make your first observation in about four minutes.

  1. Install the SDK. Python, Ruby and curl are also supported.
shell
npm install @quantum-billing/node
  1. Create a client and observe a customer. Observing is a read. Reads are billed. Your first 1,000 observations are free, unless you counted them.

        

Sample generated for this tab.

  1. Read the response. Reading it again is billed.
  2. Check what you were billed. See Observer-based billing. This is also a read.
Heads upSample code is verified against the live API at publish time. The live API has since been observed and no longer matches.

Concepts #

Five ideas explain every behavior in the API. Two of them explain the invoices.

Superposition $20$0$∞ price(customer) = all of them

Until observed, a customer's plan, price and entitlements hold every value at once. This is the data model.

status: "active" | "churned" | "pending"
Observation 1 valueGET

Any read is an observation: an API call, a portal view, a webhook delivery, an invoice PDF, a thought about an invoice.

POST /v1/observations
Collapse ψ$41.17

The moment a value is read, one state is selected and committed to the ledger. Collapse is final, until the next read.

event: entitlement.collapsed
Decoherence t = 0t + 14 min

An unobserved subscription loses coherence over time and drifts to a plan nobody chose. Decoherence is distinct from churn. Churn is measurable.

event: subscription.decohered
Entanglement AnaRavi cancelsupgradessub_8f2a

Two customers can share one subscription. Cancel one and the other is upgraded, instantly, regardless of distance, consent, or time zone.

event: customer.entangled

Observer-based billing #

Every read is a billable event. Think of it as read receipts for reads: you are told who looked at what, and charged for being told.

EventMeterRate
customer.readper observation$0.0004
entitlements.readper observation, per entitlement$0.0001 × however many there are today
invoice.readper page, per observer$0.002
observation.readper observation of an observation$0.0004, recursive
ledger.readper read of the ledger of readssee below

Observers are identified in the X-Observed-By header. If no observer is present, the read is billed to the one most likely to have been looking.

Your read ledger, this session
$0.0004
Pricing noteReading the ledger is a read. Reading the ledger of reading the ledger is also a read. We stop at depth 7 because the invoice runs out of room.

API reference #

Base URL: https://api.getquantumbilling.com. All requests use bearer auth and send QB-Version. All responses are JSON.

Authentication
Authorization: Bearer qb_live_••••••••
QB-Version: 2026-10-29.ψ
QB-Universe: (optional) uni_prime

API playground #

Send a request against the sandbox universe. Click a history entry to review it. It will be different now.

No response yet.
// press "Send request"

Response history0

  • Nothing yet. History is only written once it has happened.

Select an entry to review it.

Webhooks #

Subscribe to events and we will POST to your endpoint. Delivery is at-least-once. Webhooks may arrive before the event they describe.

EventFires when
entitlement.collapsedAn entitlement settles into a state after being read.
invoice.observedAn invoice is viewed. Amount may differ from the one in this payload.
subscription.decoheredA subscription drifts to a plan nobody selected.
customer.entangledTwo customers become linked. Also fires for the other one.
universe.forkedA request resolves differently in two places at once.

Event feed

Watch the delivery timestamp.
  • --No events yet. Check again before you click.

Verifying signatures

Each delivery includes a QB-Signature header. Compute an HMAC of the raw body with your signing secret and compare in constant time. Verification can succeed for a different payload.

verify.js
const ok = qb.webhooks.verify(rawBody, req.headers["qb-signature"], secret);
if (!ok) return res.status(400).end();   // ok may be true and false

Result: not yet verified.

Idempotency #

Send an Idempotency-Key on any POST. Keys guarantee a request happens at most once per universe. Retry as often as you like. In this universe, it will not happen again.

POST /v1/subscriptions
curl "https://api.getquantumbilling.com/v1/subscriptions" \
  -H "Idempotency-Key: 6f1c-once-per-universe" \
  -d '{"customer":"cus_halcyon","plan":"growth"}'
ScenarioResult
Same key, same universeOriginal response replayed. Observation billed twice.
Same key, different universeRequest executes there as well.
Different key, same body409.
Key reused after 24 hoursKeys expire after 24 hours, or 24 hours from now.

Errors #

Errors return a stable code, a human message, and an observed flag indicating whether the error occurred before you saw it.

CodeHTTPMeaning
observer_present409Someone is already looking at this resource. Try again unobserved.
self_observation409The customer is observing themselves. Wait for them to finish.
wave_function_not_normalized422Probabilities for this account add up to more than 100%. Common in Q4.
cancellation_unobservable202The cancellation cannot be confirmed without observing it, which would reverse it.
universe_mismatch207Request and response come from different universes.
entanglement_conflict409Cancelling this customer would upgrade someone who did not ask.
invoice_already_paid_and_open200Not an error. Reported as one for visibility.
teapot_observed418The server is a teapot. We have not been able to reproduce this.
rate_limit_exceeded429You exceeded a limit you could not have known. See Rate limits.
error_not_found404The resource will exist shortly. Retry after it has been deleted.

Rate limits #

Rate limits are known only after you exceed them. Measuring your remaining quota would consume it, so we do not offer a header for that. We offer a header for what you used, one request later.

checks: 0

Limit: unknown. Exceed it to find out.

  • Limits apply per key and per universe.
  • Retry-After is accurate to the second, sometime last Thursday.
  • Need higher limits? Talk to sales.

SDKs #

Server SDKs for Node, Python, Ruby, Go and Rust, plus a COBOL copybook of uncertain origin. Official libraries are generated from the OpenAPI spec, which is generated from the libraries.

Building a front end? The browser SDK is one script tag and eight web components: pricing table, checkout, portal, entitlements and more. Read the SDK docs.

LanguagePackageLatestStatus
Node@quantum-billing/node4.2.1Stable
Pythonquantum-billing3.9.1Stable
Rubyquantum_billing2.0.0.rc9Release candidate since 2024
Gogithub.com/quantum-billing/gov0.0.0Observed, then unobserved
Rustquantum-billingunreleasedNot yet observed
COBOLQBILLING.CPY1.1Uncertain origin

Versioning #

SDKs use semantic versions. The current SDK is v4.2.1.

The current API version is 2026-10-29.ψ. Versions are named by date and a Greek suffix, and released out of order. Pin a version with the QB-Version header. Pinned versions are honored until they are observed to be wrong.

VersionReleasedNotes
2026-10-29.ψOct 29, 2026Current. Adds /v1/universes. Removes yesterday.
2026-10-28.ψOct 31, 2026Released after the current version. Considered older.
2026-10-14.φOct 14, 2026Entanglement GA, introduced in SDK v4.2.0. Cancellations became upgrades.
2025-12-01.αJan 3, 2025Deprecated. Still the default for accounts created tomorrow.
2026-06-15.ωNeverFinal version. Already superseded.

Breaking changes are announced in the changelog at least 90 days before, or 90 days after.

Was this page helpful?