# Errors

Source: https://smartpdf.ru/en/developers/docs/errors

A request error is an HTTP code and JSON with a `detail` field: a string with an explanation or, for `422`, a list of errors by field.

```json
{ "detail": "File not found or expired" }
```

| Code | When | What to do |
|---|---|---|
| `400` | The result link was requested before the operation finished; invalid request. | Wait for `done`; check the request. |
| `401` | No key, or the key is invalid, regenerated or deleted. | Check the `X-API-Key` header. |
| `402` | Not enough money on the balance, or the key’s limit is used up. `detail` says which one and how much the request costs. Nothing is charged. | Top up the balance or raise the key’s limit in your dashboard. |
| `404` | `file_id` not found or expired (an hour), `task_id` not found. | Upload the file again. |
| `410` | The result’s storage period has ended, the file was deleted, or the link on the Free plan has already been issued. | Run the operation again. |
| `413` | The file exceeds the plan’s limit. | Compress or split the file. |
| `415` | The format isn’t supported, or the content doesn’t match the type. | Check the file and its extension. |
| `422` | Invalid parameters; for text recognition, more than 100 pages (nothing is charged). | Fix the request based on `detail`. |
| `429` | Too many requests — see [limits](https://smartpdf.ru/en/developers/docs/limits). | Wait and retry; respect `Retry-After`. |
| `503` | The processing service is temporarily unavailable; the payment has been returned. | Try again later. |

## Processing errors

If the file was accepted but couldn’t be processed, the operation request succeeds (`202`), and the task gets the `failed` status. The `error` field contains a human-readable reason: for example, a wrong password for Unlock PDF or a damaged PDF. The payment for such an operation is returned to the balance automatically.

## Message language

The texts in `detail`, in `error` and in webhooks are in the language of the key’s account: Russian by default, English if English is selected under “Language” in your [dashboard settings](https://smartpdf.ru/en/dashboard/settings). An `Accept-Language: en` or `Accept-Language: ru` header in the request takes precedence over the setting; the response language is returned in the `Content-Language` header. Response codes and JSON fields don’t depend on the language — check them, not the text.

## 429 responses without JSON

The per-IP rate limit is applied before the request reaches the application, so such a `429` may not be in JSON. Rely on the response code.
