Error response format
Most errors return both anerror field and a message field:
The missing
q parameter error returns only the error field with no message:Status codes
| Code | Error | Message | Description |
|---|---|---|---|
400 | Varies | Varies | Missing or invalid parameters. Check the error field for details. |
401 | Unauthorized | Invalid API key | Missing or invalid API key. Verify your x-api-key header. |
402 | Insufficient Credits | Your account has insufficient credits. Please add credits to continue. | Account balance depleted. Add credits to continue. |
429 | Too Many Requests | Rate limit of N requests per second exceeded | Too many requests. Back off and retry after the period in the Retry-After header. |
500 | Internal server error | — | Something went wrong on our end. Retry with backoff. |
Handling errors
Check the HTTP status code before parsing the response body:Retry strategy
For transient errors (429, 500), use exponential backoff:
- Wait 1 second after the first failure
- Double the wait time on each subsequent retry
- Cap at 60 seconds
- Stop after 5 retries
429 responses, prefer the Retry-After header value over your own backoff timer if it’s present.
