Apiable

Monetization

Usage-based billing

Usage-based billing meters API calls and bills them to Stripe at the end of the cycle. It needs the Usage Events add-on, your gateway logs connected, and matching criteria on the plan price.

Usage-based billing meters the API calls a subscriber makes and bills them to Stripe at the end of the billing cycle. It applies to the Volume, Graduated, and Flat-fee plus Overage pricing models. It needs the Usage Events add-on, your gateway access logs connected, and matching criteria on the plan price.

What is usage-based billing in Apiable?

Usage-based billing charges a subscriber for the API calls they make, rather than a fixed fee. Apiable counts each matching call from your gateway logs, then meters the total to Stripe at the end of the cycle. The Volume, Graduated, and Flat-fee plus Overage models use it.

What do you need before usage counts?

Three things, all required. Without any one of them, no calls are counted and nothing is metered.

RequirementWhat it doesWhere it lives
Usage Events add-onTurns on usage metering for your organization.Activated on the organization.
Gateway access logsStreams each API call to Apiable so it can be counted.Configured on your API gateway.
Matching criteriaDecide which calls on the plan count toward billing.Set on the plan's price, on the Monetization tab.

Why does usage-based billing need gateway logs?

Apiable counts usage from the access logs your gateway streams to it, not from traffic it proxies. The portal does not sit in the request path. So a call is only billable once its log record reaches Apiable. No logs connected means no usage counted.

How does Apiable decide which calls to bill?

Each price on a plan carries matching criteria. A logged call is billed only if it matches the API the criteria name, and every criterion set on that price. The three criterion types are response code, method, and URI keyword, and they combine with AND.

CriterionWhat it matchesNotes
APIThe API the call hit, by name.Use All APIs to match every API on the plan, or name one specific API.
Response codeThe HTTP status the call returned.An exact code like 201, or a family like 2xx that matches any 200 to 299.
MethodThe HTTP method of the call.One of GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD.
URI keywordA substring of the request URI.The call's URI must contain the keyword. The match ignores case.

A call counts only when the API matches and all of the response code, method, and URI keyword criteria you set also match. Leave a criterion type out and it does not restrict anything. Set several and a call must satisfy them all.

How do you set a custom billing unit?

The plan price carries a billing unit label, which defaults to call. You can name a custom unit, for example a token or a record, so invoices read in your own terms. Custom units are not counted from gateway logs, so you report them with the API.

A custom billing unit changes the label, not the source of the count. If the unit is something your gateway logs do not represent as one call, count it yourself and send it to Apiable. See Report usage with the API.

How does usage flow to Stripe?

Apiable runs a scheduled billing run. It reads the matching calls from your connected gateway logs, sums them per subscription, and meters the total to Stripe. Stripe then bills the metered amount on the plan's price at the end of the billing cycle.

  1. A subscriber calls your API. Your gateway writes an access log and streams it to Apiable.
  2. The billing run reads new log records and applies each plan price's matching criteria.
  3. Apiable sums the matching calls per subscription and reports the quantity to Stripe.
  4. Stripe bills the metered total on the plan's price when the billing cycle closes.

Where to next