Skip to content

Metering & Billing

Apiway meters API consumption using Resource Units (RU) — a configurable cost unit assigned per operation. The gateway tracks consumption in real time; the cost centre aggregates it into financial reports.

Each API operation has an RU cost. When a consumer calls an operation, the gateway:

  1. Deducts the RU cost from the subscription’s quota
  2. Buffers the consumption event in memory
  3. Flushes events to the RU Service in background batches
  4. Returns RU headers on the response

Every metered response includes consumption information:

HeaderDescription
X-RU-LimitTotal RU quota for this subscription
X-RU-RemainingRU remaining in the current period
X-RU-CostRU cost of this specific request
X-RU-ValueMonetary value of this request
X-RU-ConsumedTotal RU consumed in the current period
X-RU-PeriodBilling period (Daily, Monthly, Quarterly, Annual)
X-RU-CurrencyCurrency code for the value
X-RU-Alert-ThresholdPercentage threshold for soft alerts

RU costs are set per operation when defining the API:

  • Default cost — Applied to all operations unless overridden
  • Per-operation cost — Override for specific operations (e.g., a complex query might cost 5 RU while a simple GET costs 1 RU)
  • Monetary value — Each RU maps to a currency value

OpenSLA definitions can specify different RU allocations per tier:

TierRU QuotaRU PeriodPrice per RU
Free1,000MonthlyFree
Standard50,000Monthly0.001 USD
EnterpriseUnlimitedMonthly0.0005 USD

Each subscription has an RU quota and billing period:

PeriodReset Cycle
DailyMidnight UTC
Monthly1st of each month
QuarterlyEvery 3 months
AnnualYearly
Pay-as-you-goNo quota — unlimited consumption, billed on usage
EventEffect
Threshold reachedSoft alert — notification sent, calls continue
Quota exhaustedHard stop — gateway returns 402 Payment Required
Recurring breaches3+ breaches in 30 days triggers SLA tier upgrade recommendation

The cost centre provides financial reporting across your API portfolio:

  • Revenue — RU consumed by subscribers of your APIs (you earn)
  • Cost — RU you consume from external APIs (you pay)
  • Margin — Revenue minus cost, per API
  • Portfolio P&L — Aggregate financial position across all APIs

The Wealth Engine surfaces negative-margin APIs — ensuring every produced API is value-add.

Terminal window
curl https://ru.api.apiway.net/v1/ru/consumption \
-H "Authorization: Bearer $TOKEN"