API reference
Errors & rate limits
Errors return a JSON body with a stable code and a sentence a human can act on. Failed requests are not charged.
Error format
Every non-2xx response has Content-Type: application/json and an errors array. Branch on code; show title and detail to people.
Example error
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"errors": [
{
"code": "insufficient_credits",
"title": "Not enough credits",
"detail": "This request needs 1 credit. Your balance is 0."
}
]
}Error codes
| Status | Code | What happened | What to do |
|---|---|---|---|
| 400 | invalid_parameters | A parameter is missing, unknown, or has an invalid value. | Check detail for the field name and fix the request. |
| 400 | multiple_sources | More than one of image_file, image_url, image_file_b64 was sent. | Send exactly one image source. |
| 401 | missing_api_key | No X-Api-Key header. | Add the header. |
| 401 | invalid_api_key | Key is malformed, revoked, or unknown. | Check the key or create a new one. |
| 402 | insufficient_credits | Your balance can’t cover the request. | Buy credits or change plan, then retry. |
| 403 | key_not_permitted | Key isn’t allowed for this operation. | Use a live key or adjust key permissions. |
| 413 | file_too_large | Upload exceeds 12 MB. | Resize or recompress, then retry. |
| 415 | unsupported_format | Not a JPG, PNG, or WebP. | Convert the image first. |
| 422 | no_subject_found | We couldn’t find a clear foreground subject. | Try a photo with a distinct subject; not charged. |
| 422 | image_url_unreachable | image_url failed or timed out. | Check the URL is public HTTPS, or upload the file. |
| 429 | rate_limited | Too many requests for this key. | Wait for Retry-After seconds, then retry. |
| 500 | internal_error | Something failed on our side. | Retry with backoff; include X-Request-Id if it persists. |
| 503 | temporarily_unavailable | Capacity or maintenance. | Retry with backoff; check Status. |
Rate limits
Limits apply per API key, measured in images per minute. When you exceed one you receive 429 with a Retry-After header in seconds.
| Plan | Images / minute |
|---|---|
| Pay-as-you-go | TBD |
| Growth | TBD |
| Scale | TBD |
| Enterprise | Custom |
Retrying safely
- Retry
429,500,503, and504with exponential backoff and jitter. - Don't retry
4xxerrors other than429— the same request will fail again. - Failed requests aren't charged, so retries never double-bill a single successful result.