Skip to main content

Error Response Format

All API errors follow a consistent JSON structure to make error handling predictable:
Error Response Structure
string
Always “error” for error responses
string
Brief, human-readable error summary
string
Detailed error description with actionable guidance
string
Machine-readable error code for programmatic handling
object
Additional context specific to the error (optional)

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

Common Causes:
  • API key doesn’t start with ap_
  • Typo in API key
  • API key has been revoked
  • Using wrong environment’s key
Solutions:
  • Verify API key format and spelling
  • Generate a new API key from your dashboard
  • Ensure you’re using the correct environment
Common Causes:
  • Forgot to include Authorization header
  • Header name is incorrect (should be Authorization)
  • Missing “Bearer ” prefix
Solutions:
  • Add Authorization: Bearer ap_your_key_here header
  • Check header spelling and format
Solutions:
  • Generate a new API key from your dashboard
  • Update your application with the new key
  • Set up key rotation reminders

Rate Limiting Errors

Response Headers:
Solutions:
  • 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

Solutions:
  • Check API documentation for required fields
  • Ensure all required parameters are included
  • Verify request body structure
Solutions:
  • Check the expected format in API documentation
  • Validate input data before making requests
  • Use proper data types and formats
Solutions:
  • Remove protocol (http://, https://)
  • Remove paths, subdomains (www.), ports
  • Use just the root domain: example.com

Business Logic Errors

Solutions:
  • Wait for next billing cycle (free/monthly plans)
  • Upgrade to a higher plan
  • Monitor credit usage with /v1/usage endpoint
Solutions:
  • 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
Solutions:
  • 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

Solutions:
  • Reduce request size to fit plan limits
  • Upgrade to a higher plan
  • Split large requests into multiple smaller ones
Solutions:
  • Upgrade to a paid plan
  • Use alternative endpoints available on your plan

Server Errors

Solutions:
  • Try the request again after a short delay
  • Contact support with the incident_id if problem persists
  • Check our status page for known issues
Solutions:
  • Wait for the specified retry_after time
  • Check our status page for maintenance schedules
  • Implement retry logic with exponential backoff

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
Never expose raw error details to end users - always sanitize error messages to prevent information leakage.
Monitor error patterns - Frequent specific errors might indicate issues with your integration that need addressing.