Error Response Format
All API errors follow a consistent JSON structure to make error handling predictable:Error Response Structure
HTTP Status Codes
400 Bad Request
Invalid request format, missing required fields, or invalid parameters
401 Unauthorized
Authentication failed - invalid or missing API key
403 Forbidden
Valid authentication but insufficient permissions
404 Not Found
Endpoint or resource doesn’t exist
429 Too Many Requests
Rate limit exceeded - too many requests in time window
500 Internal Server Error
Unexpected server error - contact support if persistent
Authentication Errors
INVALID_API_KEY - Invalid or malformed API key
INVALID_API_KEY - Invalid or malformed API key
- API key doesn’t start with
ap_ - Typo in API key
- API key has been revoked
- Using wrong environment’s key
- Verify API key format and spelling
- Generate a new API key from your dashboard
- Ensure you’re using the correct environment
EXPIRED_API_KEY - API key has expired
EXPIRED_API_KEY - API key has expired
- Generate a new API key from your dashboard
- Update your application with the new key
- Set up key rotation reminders
Rate Limiting Errors
RATE_LIMIT_EXCEEDED - Too many requests
RATE_LIMIT_EXCEEDED - Too many requests
- Wait for the time specified in
retry_after - Implement exponential backoff
- Upgrade to a higher plan for increased limits
- Use multiple API keys to distribute load
Request Validation Errors
MISSING_REQUIRED_FIELD - Required parameter missing
MISSING_REQUIRED_FIELD - Required parameter missing
- Check API documentation for required fields
- Ensure all required parameters are included
- Verify request body structure
INVALID_FIELD_FORMAT - Field format is incorrect
INVALID_FIELD_FORMAT - Field format is incorrect
- Check the expected format in API documentation
- Validate input data before making requests
- Use proper data types and formats
INVALID_DOMAIN_FORMAT - Domain format incorrect
INVALID_DOMAIN_FORMAT - Domain format incorrect
- Remove protocol (http://, https://)
- Remove paths, subdomains (www.), ports
- Use just the root domain:
example.com
Business Logic Errors
INSUFFICIENT_CREDITS - Not enough credits
INSUFFICIENT_CREDITS - Not enough credits
- Wait for next billing cycle (free/monthly plans)
- Upgrade to a higher plan
- Monitor credit usage with
/v1/usageendpoint
DOMAIN_NOT_FOUND - Domain cannot be analyzed
DOMAIN_NOT_FOUND - Domain cannot be analyzed
- Verify the domain exists and is accessible
- Check for typos in domain name
- Ensure domain has sufficient content to analyze
- Try again later if domain is temporarily unavailable
SITEMAP_NOT_FOUND - Sitemap inaccessible
SITEMAP_NOT_FOUND - Sitemap inaccessible
- Verify sitemap URL is correct and accessible
- Check robots.txt for sitemap location
- Ensure sitemap is publicly accessible (not behind authentication)
- Omit sitemap_url to let us auto-discover it
Plan and Billing Errors
PLAN_LIMIT_EXCEEDED - Plan feature limit reached
PLAN_LIMIT_EXCEEDED - Plan feature limit reached
- Reduce request size to fit plan limits
- Upgrade to a higher plan
- Split large requests into multiple smaller ones
SUBSCRIPTION_REQUIRED - Paid plan needed
SUBSCRIPTION_REQUIRED - Paid plan needed
- Upgrade to a paid plan
- Use alternative endpoints available on your plan
Server Errors
INTERNAL_SERVER_ERROR - Unexpected server error
INTERNAL_SERVER_ERROR - Unexpected server error
- Try the request again after a short delay
- Contact support with the incident_id if problem persists
- Check our status page for known issues
Error Handling Best Practices
1. Implement Proper Error Handling
2. Log Errors for Debugging
Always log error details for debugging and monitoring:Python Error Logging
3. User-Friendly Error Messages
Transform technical errors into user-friendly messages:User-Friendly Error Mapping