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.
How RU Metering Works
Section titled “How RU Metering Works”Each API operation has an RU cost. When a consumer calls an operation, the gateway:
- Deducts the RU cost from the subscription’s quota
- Buffers the consumption event in memory
- Flushes events to the RU Service in background batches
- Returns RU headers on the response
Response Headers
Section titled “Response Headers”Every metered response includes consumption information:
| Header | Description |
|---|---|
X-RU-Limit | Total RU quota for this subscription |
X-RU-Remaining | RU remaining in the current period |
X-RU-Cost | RU cost of this specific request |
X-RU-Value | Monetary value of this request |
X-RU-Consumed | Total RU consumed in the current period |
X-RU-Period | Billing period (Daily, Monthly, Quarterly, Annual) |
X-RU-Currency | Currency code for the value |
X-RU-Alert-Threshold | Percentage threshold for soft alerts |
Configuring RU Costs
Section titled “Configuring RU Costs”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 Tiers
Section titled “OpenSLA Tiers”OpenSLA definitions can specify different RU allocations per tier:
| Tier | RU Quota | RU Period | Price per RU |
|---|---|---|---|
| Free | 1,000 | Monthly | Free |
| Standard | 50,000 | Monthly | 0.001 USD |
| Enterprise | Unlimited | Monthly | 0.0005 USD |
Subscription Quotas
Section titled “Subscription Quotas”Each subscription has an RU quota and billing period:
| Period | Reset Cycle |
|---|---|
| Daily | Midnight UTC |
| Monthly | 1st of each month |
| Quarterly | Every 3 months |
| Annual | Yearly |
| Pay-as-you-go | No quota — unlimited consumption, billed on usage |
Quota Enforcement
Section titled “Quota Enforcement”| Event | Effect |
|---|---|
| Threshold reached | Soft alert — notification sent, calls continue |
| Quota exhausted | Hard stop — gateway returns 402 Payment Required |
| Recurring breaches | 3+ breaches in 30 days triggers SLA tier upgrade recommendation |
Cost Centre
Section titled “Cost Centre”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.
Accessing Metering Data
Section titled “Accessing Metering Data”curl https://ru.api.apiway.net/v1/ru/consumption \ -H "Authorization: Bearer $TOKEN"curl -N https://risk.api.apiway.net/v1/events/subscribe \ -H "Authorization: Bearer $TOKEN" \ -H "Accept: text/event-stream"Navigate to Home to see the KPI dashboard, or Cost Centre for detailed financial reports.