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

# Errors

> The error shape and what each status code means.

When a request fails, you get a status code and a JSON body that says why.

```json theme={null}
{
  "error": "Insufficient credits",
  "message": "Optional plain guidance on what to do next"
}
```

`error` is always there. Some responses add more fields:

* **`message`** with a longer explanation.
* **`details`** when the body fails validation. Its keys match your request fields.
* **`required`** and **`topup`** on a `402`, with the credits the job needs and where to buy more.
* **`retryAfter`** on a `429`, in seconds.
* **`currentPlan`** on a `403`, when your plan has no API access.

## Status codes

| Status | What it means | What to do |
| - | - | - |
| `400` | The body, query or path is not valid | Fix the request. Read `details` |
| `401` | Key missing, wrong or revoked | Check the `Authorization` header |
| `402` | Not enough credits | Top up, then send it again |
| `403` | Your plan or key cannot do this | Upgrade, or use a key on the right account |
| `404` | Not found, or not on your account | Check the ID |
| `409` | Clashes with the current state, like cancelling a video that already started | Read `error` |
| `429` | Too many requests | Wait for `Retry-After`. See [Rate limits](https://docs.vidguy.ai/api/rate-limits.md) |
| `500` | Something broke on our side | Retry with backoff |
| `502` | VidGuy could not start the job. Credits are refunded | Safe to retry |
| `503` | A service is briefly unavailable | Retry with backoff |

## When to retry

* **Retry** `429`, `500`, `502` and `503`. Start at 2 seconds and double each time, up to about 30 seconds.
* **Do not retry** `400`, `401`, `403` or `404` until you fix the cause.
* **Never resend a start call to check on it.** Poll the job instead. See [Jobs and polling](https://docs.vidguy.ai/api/jobs.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.