The Flux API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes.
Base URL
Authentication
The Flux API uses API keys to authenticate requests. Include your key in the Authorization header:
Authorization: Bearer sk_live_your_api_key
All API requests must be made over HTTPS. Requests over HTTP will fail.
For POST and PUT requests, encode parameters as JSON:
curl -X POST https://api.flux.dev/v1/events \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"type": "user.signup", "data": {"userId": "123"}}'
All responses return JSON. Successful responses include the requested resource:
{
"id": "evt_1a2b3c4d",
"type": "user.signup",
"created": "2024-01-15T10:30:00Z",
"data": {
"userId": "123"
}
}
List endpoints return paginated results:
{
"data": [...],
"hasMore": true,
"nextCursor": "cur_abc123"
}
Errors
Errors return a consistent structure with an error code and message:
{
"error": {
"code": "invalid_request",
"message": "The 'type' field is required",
"param": "type"
}
}
HTTP Status Codes
| Code | Description |
|---|
200 | Success |
201 | Created |
400 | Bad Request — Invalid parameters |
401 | Unauthorized — Invalid API key |
404 | Not Found — Resource doesn’t exist |
429 | Rate Limited — Too many requests |
500 | Server Error — Something went wrong |
List endpoints support cursor-based pagination:
GET /v1/events?limit=50&cursor=cur_abc123
| Parameter | Description |
|---|
limit | Number of items to return (max 100) |
cursor | Cursor for the next page |
Rate Limiting
The API is rate limited based on your plan. When rate limited, you’ll receive a 429 response with a Retry-After header indicating when to retry.