Metering & Billing

Enterprise only

Meter API requests by subject headerv3.14+

Use this configuration when your application passes a customer or tenant identifier in a request header and you want to bill against that identifier instead of a Consumer. This is common for SaaS platforms that manage their own customer identity outside of Kong Gateway.

If the configured header is absent on a request, the event is dropped. To prevent unidentified traffic from generating events, use the plugin’s instance_name execution condition to filter those requests out.

To aggregate usage and generate invoices, you need either Konnect Metering & Billing or a self-hosted OpenMeter instance.

Prerequisites

  • Your API clients must pass the subject header on every request you want to meter.

  • A Konnect system account token (spat_) or OpenMeter API key to use as the auth_token.

Environment variables

  • AUTH_TOKEN: A Konnect system account token (spat_) or OpenMeter API key.

  • SUBJECT_HEADER: The name of the request header that contains the tenant or customer identifier, for example x-tenant-id or x-customer-id.

Set up the plugin

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!