# Hosting API errors

A failed call answers with success false, a readable message and a stable error\_code. Branch on the code, show the message, and use the table below to decide whether to retry.

## Which codes can the API return?

Deploy API error codes

| Status | Code | Meaning |
| --- | --- | --- |
| 400, 413, 415 | `HTTP_ERROR` | The server could not read the request: malformed JSON (400), a body over the server's size limit (413) or a Content-Type other than application/json (415). |
| 401 | `UNAUTHENTICATED` | Missing, unknown or revoked key, or its site, workspace, creator seat or hosting plan is no longer active. No further detail is given. |
| 404 | `HOSTING_DEPLOY_NOT_FOUND` | The deploy does not exist or does not belong to the key's site. |
| 409 | `HOSTING_DEPLOY_NOT_UPLOADING` | Finalize was called on a deploy that is no longer uploading. |
| 409 | `HOSTING_DEPLOY_NOT_READY` | Promote or rollback named a deploy that is not ready. |
| 409 | `HOSTING_DEPLOY_IS_PREVIEW` | Promote or rollback named an Arch editor preview (preview: true in the deploy list). A preview was never live and never goes live this way: publish the site from Arch. |
| 409 | `HOSTING_SITE_IN_ARCH_TRASH` | Promote or rollback was refused because the site's website is in Arch's Trash. Restore it in Arch to publish it again. |
| 422 | `VALIDATION_ERROR` | The body or a path id has the wrong shape (for example a manifest entry without a path, or a deploy id that is not a UUID). The errors field names each field. |
| 422 | `HOSTING_MANIFEST_INVALID` | A manifest path is empty, absolute, contains .. or a dot-segment, or is too long. |
| 422 | `HOSTING_DEPLOY_TOO_LARGE` | Too many files, one file too large, or the whole deploy over the hosting plan's size cap. |
| 422 | `HOSTING_TOO_MANY_PENDING` | 3 deploys are already uploading for this site. |
| 422 | `HOSTING_DEPLOY_INCOMPLETE` | Finalize found a missing or wrong-sized file; the deploy is now failed and its files are deleted. |
| 429 | `RATE_LIMIT_EXCEEDED` | More than 120 requests in a minute with one key. |
| 500 | `INTERNAL_ERROR` | Something failed on Soartana's side. Retry with backoff; a deploy that was not created or finalized is safe to start again. |
| 409 | `CONFLICT` | Another change to the same record landed at the same moment. Read the current state (for example the deploy list), then repeat the call if it is still needed. |
| 503 | `RETRYABLE` | Soartana was briefly busy with a conflicting change. Nothing was saved: wait the seconds in the Retry-After header, then repeat the same call. |

## When should a client retry?

- `429`: wait for the next minute, then retry the same call.
- `503` (`RETRYABLE`): wait the seconds in the `Retry-After` header, then retry the same call.
- `500`: retry with backoff; if it keeps failing, start a new deploy later.
- `409` (`CONFLICT`): read the current state first, then repeat the call if it is still needed.
- `400`, `413`, `415`, `422` and the other `409` codes: fix the request first; a failed deploy is never resumed, so start a new one.
- `401`: check the key on the site's API keys tab; a revoked key never comes back.

Field-level problems arrive in `errors`, keyed by field. The plan caps behind the 422 codes are on [Limits and plans](/docs/developer/hosting/v1/limits), the request shapes in the [API reference](/docs/developer/hosting/v1/api), and a working sequence in [the quickstart](/docs/developer/hosting/v1/quickstart).
