Error Response Format
Most failed requests return a JSON body. The most common validation/auth shape is:Alternate shapes (also used in production)
Endpoints are not fully normalized to one schema. Also handle these when present:Always branch on HTTP status code first, then parse JSON if
Content-Type includes application/json. Log the raw response body when debugging unknown failures.HTTP Status Codes
ElasticFunnels uses conventional HTTP response codes to indicate the success or failure of an API request.Success Codes
OK
The request was successful.
Created
The resource was successfully created.
No Content
The request was successful but there’s no content to return (typically for DELETE requests).
Client Error Codes
Bad Request
The request was malformed or contains invalid parameters.
Unauthorized
Authentication failed. Check your API key.
Forbidden
You don’t have permission to access this resource.
Not Found
The requested resource doesn’t exist.
Unprocessable Entity
Validation failed. Check the
errors field in the response.Too Many Requests
Rate limit exceeded. Slow down your requests.
Server Error Codes
Internal Server Error
Something went wrong on our end. Please contact support if this persists.
Service Unavailable
The service is temporarily unavailable. Please try again later.
Common Error Scenarios
Authentication Errors
Invalid API Key
401
Solution: Check that your API key is correct and hasn’t been regenerated.
No Brand Access
401
Solution: Ensure your API key has access to the specified brand/project.
Validation Errors
Missing Required Fields
422
Solution: Include all required fields in your request.
Invalid Field Values
422
Solution: Ensure field values meet the requirements (correct type, valid options, etc.).
Permission Errors
Insufficient Permissions
403
Solution: This action requires higher permissions (e.g., Admin or Owner role).
Resource Errors
Resource Not Found
404
Solution: Check that the resource ID is correct and the resource exists.
Rate Limiting
Too Many Requests
429
Solution: Implement exponential backoff or reduce request frequency.
Best Practices for Error Handling
Check Status Codes
Always check the HTTP status code before parsing the response
Handle Validation Errors
Display validation errors to users in a friendly format
Implement Retry Logic
Retry failed requests with exponential backoff for 5xx errors
Log Errors
Log error responses for debugging and monitoring