> ## Documentation Index
> Fetch the complete documentation index at: https://pixelcut.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Error handling

> Build resilient clients with consistent logging and retry behavior.

Most error responses return a JSON body with:

* `error`: human-readable message
* `error_code`: machine-readable code for programmatic handling

## Common status codes

* `400` invalid request (for example: image too large, unsupported format)
* `401` invalid or missing API key (`invalid_auth_token`)
* `403` insufficient credits (`insufficient_api_credits`)
* `429` rate limit exceeded (`rate_limit_exceeded`)
* `500` internal error (retryable)

## 400 error codes (examples)

Common `error_code` values include:

* `missing_parameter`, `invalid_parameter`
* `unsupported_image_format`, `malformed_image`
* `file_size_too_large`, `resolution_too_high`
* `unknown_foreground` (foreground subject not detected)

## Logging recommendations

* Log: endpoint, status code, `error_code`, and a request timestamp
* Redact: API keys, signed URLs, and user PII

<Card title="Rate limits & retries" icon="timer" href="/developer-guide/core-concepts/rate-limits" />
