> For the complete documentation index, see [llms.txt](https://bountyv.gitbook.io/vdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bountyv.gitbook.io/vdocs/errors.md).

# Errors

The API returns standard HTTP status codes and JSON error bodies.

## Error response format

```json
{
  "error": "Human-readable error message",
  "details": { /* optional, present on validation errors */ }
}
```

Some responses include additional context for billing-related errors:

```json
{
  "error": "Insufficient credits",
  "required_cents": 70,
  "balance_cents": 35
}
```

## Status codes

| Code  | Meaning                                                   | What to do                            |
| ----- | --------------------------------------------------------- | ------------------------------------- |
| `200` | OK — sync request succeeded                               | Use the response                      |
| `202` | Accepted — async job created                              | Poll the `poll_url`                   |
| `400` | Bad request — invalid parameters                          | Fix your request; see `details` field |
| `401` | Unauthorized — missing/invalid/revoked API key            | Check your `Authorization` header     |
| `402` | Payment required — insufficient credits                   | Top up via `/v1/topup`                |
| `403` | Forbidden — account disabled                              | Contact support                       |
| `404` | Not found — job ID doesn't exist or isn't yours           | Verify the job ID                     |
| `500` | Server error — unexpected failure on our side             | Retry with exponential backoff        |
| `502` | Upstream worker error — generation failed (auto-refunded) | Retry                                 |
| `503` | Service unavailable — provider not configured             | Wait and retry                        |

## Automatic refunds

When a request passes authentication and balance checks but fails during generation (worker error, upstream timeout, etc.), your balance is **automatically refunded**. The response will include:

```json
{
  "error": "Image generation failed",
  "refunded_cents": 70
}
```

You are only charged for successful completions.

## Retry strategy

For transient errors (`500`, `502`, `503`), use exponential backoff:

```python
import time

for attempt in range(5):
    r = make_request()
    if r.status_code < 500:
        break
    time.sleep(2 ** attempt)  # 1, 2, 4, 8, 16 seconds
```

Do **not** retry:

* `400` — request is malformed, retrying won't help
* `401` — key is invalid, retrying won't help
* `402` — you need more credits; call `/v1/topup`
* `403` — account disabled; contact support

## Async job failures

A video job can complete with `status: "failed"` and an `error` field. This is different from an HTTP error — the submission succeeded, but the pipeline failed midway. You are refunded automatically. Retry by submitting a new job.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://bountyv.gitbook.io/vdocs/errors.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
