Usage events are the raw measurements that Fluxrate aggregates into invoices. Send them from your backend whenever a billable action occurs.
Two Ways to Track
Option 1: SDK Endpoint (Recommended)
Use the simplified SDK endpoint with an API key (no user session required):
Option 2: REST API
Use the full REST API with JWT authentication:
Request Fields
Idempotency
Always include an idempotency_key to safely retry failed requests:
If the same key is sent again, the event is silently deduplicated — you won’t get a double charge.
Good idempotency keys combine a unique transaction ID with a descriptive suffix: order_{id}, job_{id}_tokens, request_{uuid}.
Tracking in Different Languages
Best Practices
- Fire-and-forget — Don’t block your main request path waiting for the tracking response. Send events asynchronously.
- Retry with backoff — Retry failed tracking requests with exponential backoff. Use idempotency keys to stay safe.
- Batch when possible — For extremely high-volume scenarios, pre-aggregate at your backend and send totals periodically.
- Log failures — Log any events that fail to track for manual reconciliation.