Error Response Format

All errors follow this structure:

txt
{
  "error": {
    "code": "error_code",
    "message": "Human-readable description",
    "docs": "https://altextapi.com/docs/api-reference/errors"
  }
}

HTTP Status Codes

| Status | Code | Description | |--------|------|-------------| | 400 | invalid_request | Missing or malformed request body | | 400 | invalid_image_url | The provided URL is not a valid image | | 400 | unsupported_format | Image format not supported (use JPG, PNG, WebP, AVIF) | | 400 | image_too_large | Image exceeds 20MB limit | | 401 | unauthorized | Invalid or missing API key | | 401 | key_revoked | API key has been revoked | | 402 | insufficient_credits | No credits remaining in current billing period | | 403 | plan_restricted | Feature not available on your plan | | 403 | domain_restricted | Key is restricted to specific domains | | 404 | not_found | Resource not found | | 429 | rate_limited | Too many requests — slow down | | 500 | internal_error | Server error — try again later | | 503 | service_unavailable | Service temporarily unavailable |

Common Errors

invalid_image_url

The URL must:

  • Be publicly accessible (no authentication)
  • Point directly to an image file
  • Use HTTPS
  • Return a valid image within 10 seconds

insufficient_credits

You've used all credits for the current billing period. Options:

  • Wait for monthly reset (1st of each month)
  • Upgrade your plan for more credits
  • Purchase additional credit packs

rate_limited

| Plan | Rate Limit | |------|-----------| | Free | 5 req/min | | Pro | 20 req/min | | Business | 60 req/min | | Agency | 120 req/min |

Handling rate limits

Implement exponential backoff. Wait 1s, then 2s, then 4s, then 8s before giving up. Our API returns Retry-After headers.