Skip to main content
POST
Track Usage
Records usage for a customer feature and returns updated balances. Use this after an action happens to decrement usage, or send a negative value to credit balance back.

Authentication

Requires a valid API secret key in the Authorization header:

Request Body

string
required
The ID of the customer.
string
The ID of the feature to track usage for. Required if event_name is not provided.
string
Event name to track usage for. Use instead of feature_id when multiple features should be tracked from a single event. Either feature_id or event_name must be provided.
string
The ID of the entity for entity-scoped balances (e.g., per-seat limits).
number
default:1
The amount of usage to record. Use negative values to credit balance (e.g., when removing a seat).
object
Additional properties to attach to this usage event. Accepts any key-value pairs.

Query Parameters

boolean
If true, bypasses the cache and fetches fresh data.
string
Comma-separated list of fields to expand. Available options:
  • balance.feature: Include full feature object in the balance response

Response

string
The ID of the customer whose usage was tracked.
string
The ID of the entity, if entity-scoped tracking was performed.
string
The event name that was tracked, if event_name was used instead of feature_id.
number
The amount of usage that was recorded.
object
The updated balance for the tracked feature. Null if tracking by event_name that affects multiple features.
string
The feature ID this balance is for.
number
Total balance granted (included + prepaid).
number
Remaining balance available for use.
number
Total usage consumed in the current period.
boolean
Whether this feature has unlimited usage.
boolean
Whether usage beyond the granted balance is allowed (with overage charges).
number
Maximum quantity that can be purchased as a top-up, or null for unlimited.
number
Timestamp when the balance will reset, or null for no reset.
array
Detailed breakdown of balance sources when stacking multiple plans or grants.
string
The unique identifier for this balance breakdown.
string
The plan ID this balance originates from, or null for standalone balances.
number
Amount granted from the plan’s included usage.
number
Amount granted from prepaid purchases or top-ups.
number
Remaining balance available for use.
number
Amount consumed in the current period.
boolean
Whether this balance has unlimited usage.
object
Reset configuration for this balance, or null if no reset.
string
Reset interval: day, week, month, or year.
number
Timestamp when the next reset occurs.
object
Pricing configuration if this balance has usage-based pricing.
number
Timestamp when this balance expires, or null for no expiration.
object
The full feature object if expand=balance.feature was used.
object
Map of feature_id to updated balance when tracking by event_name affects multiple features. Only present when using event_name.

Example Request

Track by Feature ID

Track by Event Name

Credit Balance (Negative Value)

Example Response

Single Feature Response

Multi-Feature Response (Event Name)

Error Responses

object
string
Human-readable error message.
string
Machine-readable error code. Common codes:
  • customer_not_found: The specified customer doesn’t exist
  • feature_not_found: The specified feature doesn’t exist
  • invalid_inputs: Request validation failed (e.g., both feature_id and event_name provided)
  • entity_not_found: The specified entity doesn’t exist
  • insufficient_balance: Customer doesn’t have enough balance for the usage amount
  • invalid_event_name: The specified event name is not configured

Example Error Response