# Ошибки

Каждая ошибка публичного API приходит как `application/problem+json` с полем `code`. Адрес в поле `type` оканчивается кодом: `/errors/<код>`. На этом сайте он открывает страницу кода, где написано, что случилось и что делать.

| Код | HTTP-статус | Что случилось |
|---|---|---|
| [`missing_token`](https://developers.staging.donatty.com/errors/missing_token.md) | 401 | В запросе нет ключа. |
| [`invalid_token`](https://developers.staging.donatty.com/errors/invalid_token.md) | 401 | Ключ не найден или повреждён. |
| [`token_expired`](https://developers.staging.donatty.com/errors/token_expired.md) | 401 | Срок ключа вышел. |
| [`token_in_query`](https://developers.staging.donatty.com/errors/token_in_query.md) | 400 | Ключ передан в адресе запроса. |
| [`wrong_token_type`](https://developers.staging.donatty.com/errors/wrong_token_type.md) | 403 | Это не ключ для публичного API. |
| [`insufficient_scope`](https://developers.staging.donatty.com/errors/insufficient_scope.md) | 403 | У ключа нет нужного права. |
| [`origin_not_allowed`](https://developers.staging.donatty.com/errors/origin_not_allowed.md) | 403 | Адрес сайта не разрешён этому ключу. |
| [`invalid_parameter`](https://developers.staging.donatty.com/errors/invalid_parameter.md) | 400 | Значение параметра не подходит. |
| [`not_found`](https://developers.staging.donatty.com/errors/not_found.md) | 404 | Такого маршрута нет. |
| [`rate_limited`](https://developers.staging.donatty.com/errors/rate_limited.md) | 429 | Исчерпан лимит запросов. |
| [`internal_error`](https://developers.staging.donatty.com/errors/internal_error.md) | 500 | Запрос не удался на стороне Донатти. |
| [`service_unavailable`](https://developers.staging.donatty.com/errors/service_unavailable.md) | 503 | API временно недоступен. |
