Error Handling
API error codes and handling best practices
Error Handling
Learn how to handle API errors gracefully and troubleshoot common issues.
Error Response Format
All API errors return a consistent JSON format:
HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API token |
| 403 | Forbidden - API access not available on your plan |
| 404 | Not Found - Resource doesn't exist |
| 422 | Unprocessable Entity - Validation errors |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error |
| 503 | Service Unavailable - Temporary issue |
Common Errors
401 Unauthorized
Causes:
- Missing
Authorizationheader - Invalid API token
- Revoked token
Solutions:
- Include
Authorization: Bearer YOUR_TOKENheader - Verify token is correct
- Generate a new token if needed
403 Forbidden
Cause: API access requires Pro or Enterprise plan.
Solution: Upgrade your subscription at Settings > Subscription.
404 Not Found
Causes:
- Invalid test ID
- Test belongs to different account
- Test was deleted
Solutions:
- Verify the test ID is correct
- Check you're using the right account
422 Unprocessable Entity
Cause: Request body failed validation.
Solution: Check the errors array for specific issues and fix your request.
429 Rate Limited
Cause: Too many requests in a short period.
Solution: Implement exponential backoff:
503 Service Unavailable
Cause: Temporary service issue.
Solution: Retry with exponential backoff after a few seconds.
Validation Errors
Invalid Provider Types
Valid values: consumer, business, protected
Missing Required Fields
Error Handling Best Practices
1. Check Status Codes
2. Implement Retries
3. Log Errors
4. Handle Gracefully
Debugging Tips
1. Enable Verbose Logging
2. Check Request/Response
3. Validate JSON
Related
- Authentication - API tokens and auth errors
- External Tests API - API endpoints
- Code Examples - Error handling examples