The Track Endpoint
Request Body
| Field | Required | Description |
|---|---|---|
meter_token | ✅ | Unique token from your meter |
customer_external_id | ✅ | Your customer’s ID |
quantity | ✅ | Usage amount (> 0) |
timestamp | Defaults to now if omitted | |
idempotency_key | Prevents duplicate events on retry | |
metadata | Extra data; required user_id key for UNIQUE_COUNT meters |
Language Examples
- Python
- Node.js
- Go
Tracking UNIQUE_COUNT Events
ForUNIQUE_COUNT meters, include the value to count in metadata.user_id:
Best Practices
Use idempotency keys
Use idempotency keys
Always pass a unique
idempotency_key so it’s safe to retry failed requests without double-counting.Track asynchronously
Track asynchronously
Don’t block your main request path waiting for Fluxrate’s response. Track usage in a background task or fire-and-forget.
Handle failures gracefully
Handle failures gracefully
Log tracking failures but don’t let them break your main workflow. Implement retry logic with exponential backoff for transient errors.
Batch high-volume events
Batch high-volume events
If you have millions of events per day, pre-aggregate at your backend and send totals every minute rather than sending individual events.