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

# Errors

Errors use one stable JSON envelope and public messages are always in English.

```json theme={null}
{
  "error": {
    "message": "Insufficient balance",
    "type": "billing_error",
    "param": null,
    "code": "insufficient_balance"
  },
  "request_id": "req_..."
}
```

| HTTP | Code                      | Meaning                                                        |
| ---: | ------------------------- | -------------------------------------------------------------- |
|  400 | `invalid_request`         | The request body or parameters are invalid                     |
|  400 | `invalid_media_input`     | Media is unavailable, expired, already used, or the wrong type |
|  401 | `invalid_api_key`         | The key is missing, wrong, expired, or revoked                 |
|  402 | `insufficient_balance`    | The price could not be reserved                                |
|  403 | `permission_denied`       | The key lacks the scope or model access                        |
|  404 | `not_found`               | The resource does not exist or belongs to another account      |
|  409 | `idempotency_conflict`    | The idempotency key was reused with a different body           |
|  409 | `job_not_cancelable`      | The job already went to the provider                           |
|  413 | `media_too_large`         | The uploaded file exceeds its size limit                       |
|  413 | `storage_quota_exceeded`  | The account is holding its maximum volume of inputs            |
|  429 | `rate_limit_exceeded`     | A rate or concurrency limit was hit                            |
|  500 | `internal_error`          | An unexpected error on our side                                |
|  502 | `provider_error`          | The upstream generator failed                                  |
|  503 | `temporarily_unavailable` | A dependency is temporarily unavailable                        |
|  504 | `provider_timeout`        | The upstream generator timed out                               |

Retry `429`, `500`, `503`, and `504` with backoff.

Do not retry `400`, `401`, `402`, `403`, or `409` without changing the request or state.

Always include `request_id` when contacting [support](mailto:support@nsfw-api.net).
