{ "status": "error", "error": "Rate limit exceeded", "message": "You have exceeded your rate limit of 60 requests per minute. Please try again in 23 seconds.", "code": "RATE_LIMIT_EXCEEDED", "retry_after": 23}
{ "status": "error", "error": "Missing required field", "message": "The 'domain' field is required but was not provided", "code": "MISSING_REQUIRED_FIELD", "details": { "field": "domain", "required_fields": ["domain", "topic", "country"] }}
Solutions:
Check API documentation for required fields
Ensure all required parameters are included
Verify request body structure
INVALID_FIELD_FORMAT - Field format is incorrect
{ "status": "error", "error": "Invalid field format", "message": "Country code must be a 2-letter ISO code (e.g., 'US', 'UK')", "code": "INVALID_FIELD_FORMAT", "details": { "field": "country", "provided_value": "USA", "expected_format": "2-letter ISO code" }}
Solutions:
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
{ "status": "error", "error": "Invalid domain format", "message": "Domain must be in format 'example.com' without protocol or path", "code": "INVALID_DOMAIN_FORMAT", "details": { "field": "domain", "provided_value": "https://example.com/blog", "expected_format": "example.com" }}
{ "status": "error", "error": "Insufficient credits", "message": "This request requires 15 credits but you only have 8 remaining", "code": "INSUFFICIENT_CREDITS", "details": { "required_credits": 15, "available_credits": 8, "upgrade_url": "https://platform.agenticpencil.com/billing" }}
Solutions:
Wait for next billing cycle (free/monthly plans)
Upgrade to a higher plan
Monitor credit usage with /v1/usage endpoint
DOMAIN_NOT_FOUND - Domain cannot be analyzed
{ "status": "error", "error": "Domain not found", "message": "Unable to analyze domain 'nonexistent-domain.xyz' - domain may not exist or be accessible", "code": "DOMAIN_NOT_FOUND", "details": { "domain": "nonexistent-domain.xyz" }}
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
SITEMAP_NOT_FOUND - Sitemap inaccessible
{ "status": "error", "error": "Sitemap not found", "message": "Could not find or access sitemap at 'https://example.com/sitemap.xml'", "code": "SITEMAP_NOT_FOUND", "details": { "sitemap_url": "https://example.com/sitemap.xml", "attempted_locations": [ "https://example.com/sitemap.xml", "https://example.com/sitemap_index.xml", "https://example.com/robots.txt" ] }}
Solutions:
Verify sitemap URL is correct and accessible
Check robots.txt for sitemap location
Ensure sitemap is publicly accessible (not behind authentication)
{ "status": "error", "error": "Internal server error", "message": "An unexpected error occurred. Our team has been notified. Please try again later.", "code": "INTERNAL_SERVER_ERROR", "details": { "incident_id": "inc_1234567890abcdef", "timestamp": "2024-02-17T17:10:32Z" }}
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
SERVICE_UNAVAILABLE - Temporary service disruption
{ "status": "error", "error": "Service temporarily unavailable", "message": "The service is temporarily unavailable due to maintenance. Please try again in a few minutes.", "code": "SERVICE_UNAVAILABLE", "details": { "retry_after": 300, "maintenance_window": "2024-02-17T18:00:00Z - 2024-02-17T18:30:00Z" }}
Transform technical errors into user-friendly messages:
User-Friendly Error Mapping
ERROR_MESSAGES = { 'INVALID_API_KEY': 'Your API key is invalid. Please check your configuration.', 'RATE_LIMIT_EXCEEDED': 'You\'re sending requests too quickly. Please wait a moment and try again.', 'INSUFFICIENT_CREDITS': 'You don\'ve used all your credits this month. Consider upgrading your plan.', 'DOMAIN_NOT_FOUND': 'We couldn\'t analyze this domain. Please check the URL and try again.', 'INTERNAL_SERVER_ERROR': 'Something went wrong on our end. Please try again in a few minutes.'}def get_user_friendly_error(error_code, default_message): return ERROR_MESSAGES.get(error_code, default_message)
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.