Error Handling
The Artos API returns standard HTTP status codes with detailed error messages. This guide explains how to handle common errors.HTTP Status Codes
Error Response Format
All error responses return a JSON object with error details:Common Errors
401 Unauthorized - Missing Token
Error:401 Unauthorized - Invalid Token
Error:- Token is malformed
- Token has expired
- Token was revoked
- Token is for a different organization
- Verify token format is correct
- Obtain a fresh token from your administrator
- Check token hasn’t been revoked
- Verify token is for the correct environment
403 Forbidden - Wrong Organization
Error:- User’s token doesn’t have an organization
- Resource belongs to a different organization
- User is not member of the organization
404 Not Found - Resource Missing
Error:- Resource ID is incorrect
- Resource has been deleted
- Resource belongs to a different organization
- Verify the resource ID is correct
- Check that the resource exists in your organization
- List available resources to find the correct ID
400 Bad Request - Validation Error
Error:- Check the API documentation for required fields
- Verify all required parameters are included
- Ensure values match the correct type and format
422 Unprocessable Entity - Invalid Structure
Error:- Review the request body format
- Ensure nested objects are properly structured
- Validate against the OpenAPI specification
500 Internal Server Error
Error:- Retry the request after a brief delay
- Check the Artos status page
- Contact support if the error persists
Error Handling Best Practices
1. Implement Exponential Backoff
Retry failed requests with increasing delays:2. Check Status Codes
Always check the response status before processing:3. Handle Async Operations
For async operations (202 responses), implement status polling:4. Validate Input
Validate input before sending requests:5. Log Errors for Debugging
Log error details for troubleshooting:Debugging Tips
1. Enable Debug Logging
2. Check Token Validity
Verify your token hasn’t expired:3. Test with curl
Use curl for quick testing:4. Review OpenAPI Spec
Check the OpenAPI specification at/api-reference/openapi-v1.json for:
- Required parameters
- Expected response formats
- Status codes for each endpoint
Support
If you encounter persistent errors:- Check the documentation - Review endpoint documentation for parameters
- Verify your token - Contact your administrator if token issues
- Check system status - Look for maintenance or outages
- Enable debug logging - Get detailed request/response information
- Contact support - Reach out to internal@artosai.com with error details