Error Handling
The ZenFlow API uses standard HTTP status codes and returns detailed error information in JSON format.Error Response Format
All errors follow this structure:HTTP Status Codes
| Code | Description | When It Occurs |
|---|---|---|
| 400 | Bad Request | Invalid request body or parameters |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Valid key but insufficient permissions |
| 404 | Not Found | Resource doesn’t exist |
| 409 | Conflict | Resource already exists |
| 422 | Unprocessable | Validation failed |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Error | Server-side error |
Common Error Codes
Authentication Errors
| Code | Message | Resolution |
|---|---|---|
missing_api_key | API key is required | Add X-API-Key header |
invalid_api_key | API key is invalid | Check your API key |
expired_api_key | API key has expired | Create a new API key |
revoked_api_key | API key was revoked | Create a new API key |
Authorization Errors
| Code | Message | Resolution |
|---|---|---|
insufficient_scope | Missing required scope | Use key with proper scopes |
ip_not_allowed | IP not in whitelist | Add your IP to whitelist |
Validation Errors
| Code | Message | Resolution |
|---|---|---|
validation_error | Invalid field value | Check the details field |
invalid_id | ID format is wrong | Use correct ID format |
missing_field | Required field missing | Include required fields |
Resource Errors
| Code | Message | Resolution |
|---|---|---|
not_found | Resource not found | Check the resource ID |
already_exists | Resource already exists | Use a different identifier |
Rate Limiting
Handling Errors
JavaScript/TypeScript
Python
Best Practices
Check success Field
Always check the
success field in responsesLog Error Codes
Log error codes for debugging and monitoring
Handle Retries
Implement retry logic for transient errors
User Messages
Show user-friendly messages for validation errors
Retry Strategy
Retry these errors with exponential backoff:429Rate limit exceeded500Internal server error503Service unavailable- Network timeouts
400Bad request (fix the request first)401Unauthorized (fix authentication)403Forbidden (check permissions)404Not found (resource doesn’t exist)
Getting Help
If you encounter persistent errors:- Check the error code and message
- Review the API documentation
- Check service status
- Contact [email protected] with:
- Error code and message
- Request details (endpoint, method)
- Timestamp of the error



