What are usage events?
A usage event represents customer consumption in your app, such as an API call, token spend, or document generation. Usage events are distinct from meter events:- Usage events: analytics and operational visibility
- Meter events: billing and limit enforcement
Publish a usage event
Event fields
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | Dot-notation event type (for example usage.api_call) |
customerRef | string | Yes | Customer reference this event belongs to |
productRef | string | No | Product scope for the event |
units | number | Yes | Quantity consumed (non-negative) |
Common types
usage.api_callusage.tokenusage.message_sentusage.document_generatedusage.searchusage.storage
Relationship to meters
Use both when needed:createEvent()for product analytics and operationstrackUsage()for limits and billing logic