- A customer consumed AI LLM tokens
- A customer streamed minutes of video
- A customer made an API request
event_id: A unique identifier for the event to ensure idempotency.customer_id: The Solifyn customer ID associated with the usage event.event_name: The string identifier matching a configured meter’s event name (e.g.api.request).value: An optional numeric value representing the quantity of consumption (defaults to1).metadata: A JSON object containing custom key-value pairs used for filters or advanced aggregation.timestamp: An optional ISO 8601 string representing when the event occurred.
Ingest events using the API
To record usage, send aPOST request to the /meters/ingest endpoint. You must authenticate the request using your API Bearer token in the Authorization header and specify your active business context via the x-business-id header if managing multiple businesses.
Endpoint
POST /meters/ingest
Payload structure
The request payload accepts an array of events:| Parameter | Type | Required | Description |
|---|---|---|---|
events | array | Yes | An array of event objects to ingest. |
events[].event_id | string | Yes | A unique UUID/string identifier for the event to ensure idempotency. If an event with the same ID is sent again, it will be skipped. |
events[].customer_id | string | Yes | The ID of the customer associated with this usage. |
events[].event_name | string | Yes | The event name that matches the eventName field configured on your Meter (e.g. api.request). |
events[].value | number | No | The numeric amount of usage. Defaults to 1. |
events[].metadata | object | No | Custom JSON properties to be used in advanced aggregations or filters. |
events[].timestamp | string | No | ISO 8601 timestamp representing when the usage occurred. Defaults to the server’s current time. |
cURL Example
TypeScript Example
Idempotency Guarantee
Solifyn guarantees idempotency based on the
event_id field. Sending multiple requests with the same event_id will safely result in only one usage event being registered, preventing accidental double-billing.Good to know
Events are immutable
Once an event is successfully ingested, it cannot be modified or deleted. Ensure yourvalue and metadata are accurate before transmitting them.