Report Usage Event
Enabled per organization
Usage-based billing must be enabled for your organization before these endpoints accept requests. Contact your WHITELABEL account manager to enable it. Requests from an organization where it is not enabled return 403 PRODUCT_NOT_ENABLED.
Send one event per request, with a unique X-Idempotency-Key header. WHITELABEL resolves the meter from event_name, validates the event synchronously and stores it against the subscription_id. ACTIVE, TRIALING and PAST_DUE subscriptions accept usage — PAUSED, CANCELED and COMPLETED are rejected with 400 SUBSCRIPTION_NOT_ACTIVE and nothing is counted. Usage is aggregated per subscription and billing cycle according to the meter’s aggregation, and any usage beyond the included credits is billed on the subscription’s renewal charge.
event_id is your idempotency key
Generate a unique event_id for every event (a UUID or your own event/request id) and reuse it on retries. A replay returns the same response as the first call — including the original value, even if the retry carried a different one (the retry’s value is discarded) — and the usage is never counted twice. event_id is unique per account and required: a request without it is rejected with 400. This is the mechanism that protects billing; X-Idempotency-Key is accepted (optional, as on the rest of the WHITELABEL API) but is not required and is not what dedupes usage.
Timestamps
occurred_at defaults to the time WHITELABEL receives the event (returned as received_at). You can backdate up to 35 days; older values are rejected with 400. Which billing cycle an event lands in is decided by occurred_at, not by when it was received.
An unknown event_name (or an archived meter) is a 400 METER_NOT_FOUND; an unknown subscription_id is a 400 SUBSCRIPTION_NOT_FOUND. The event carries no country or account_id — both are resolved from the subscription.
Refer to Meter Error Codes for the possible error outcomes.
/subscriptions/meters/eventsUsage-based billing must be enabled for your organization before this endpoint accepts requests (otherwise 403 PRODUCT_NOT_ENABLED). Reports one usage event against a subscription. The meter is resolved from event_name. Validation is synchronous: a malformed or unresolvable event is rejected with 400 and never counted. Replaying the same event_id returns the original response — including the original value, even if the retry sent a different one — and never double counts. ACTIVE, TRIALING and PAST_DUE subscriptions accept usage; any other status is rejected with 400 SUBSCRIPTION_NOT_ACTIVE. One event per request.
Header Parameters
The account_id found in your WHITELABEL Dashboard (UUID). Required — omitting it returns 400 BAD_REQUEST (“Invalid x-account-code header.”).
Unique identifier used in HTTP headers to ensure that a request is processed only once, even if it is retried due to network issues or timeouts. Optional, as on the rest of the WHITELABEL API.
Body application/json
Your unique identifier for this event — the idempotency key. Unique per account. Re-sending the same event_id returns the same response (including the original value) and never counts the usage twice, regardless of retries.
The event_name of the meter this event belongs to. Resolves the meter within your account; an unknown or INACTIVE meter is rejected with 400 METER_NOT_FOUND.
The unique identifier of the subscription the usage is attributed to (MAX 64; MIN 36). Must exist in your account (400 SUBSCRIPTION_NOT_FOUND) and be ACTIVE, TRIALING or PAST_DUE (400 SUBSCRIPTION_NOT_ACTIVE). Usage is metered per subscription and billed on that subscription’s renewal.
The quantity to record for this event. Required for SUM, LAST and MAX meters. Must NOT be sent for a COUNT meter — an explicit value is rejected with 400 BAD_REQUEST (“The value must not be provided for a COUNT meter.”); each COUNT event is recorded as 1.
When the usage happened (ISO 8601 with offset). Defaults to the time the event is received. Backdating is accepted up to 35 days in the past; older values are rejected with 400 INVALID_PARAMETERS. occurred_at decides which billing cycle the event lands in.
Optional key-value pairs stored with the event (MAX 48 entries; value MAX 512).
Optional guard. When sent it must match the meter resolved from event_name, otherwise the request is rejected with 400 BAD_REQUEST (“The meter_id does not match the meter resolved for event_name ‘<event_name>’.”).
Response
201
WHITELABEL’s identifier for the stored event.
When WHITELABEL received the event.
400
403