---
agent:
  instructions: "Use this search API to find relevant Cook Studio content (product, pricing, FAQ, blog articles, example videos) with keywords or natural-language queries instead of crawling pages. Results are returned in Markdown."
  endpoint: "https://cookstudio.ai/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
title: "Errors"
description: "The error shape and every error code the API returns."
---
# Errors

Every error has the same shape:

```json
{"error": {"code": "invalid_request", "message": "duration_min: required unless `script` is given (whole minutes)."}}
```

- `code` is stable; branch on it.
- `message` is for humans and names the field that failed.
- Some errors add fields: `credits` (new price), `balance`, `queued`, `detail` (extra context for our support team).
- Every response carries an `x-request-id` header. Quote it when you contact support.

## Codes

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | A field is missing, unknown or out of range. `message` names the field and the allowed values. |
| 400 | `invalid_json` | The body is not valid JSON. |
| 400 | `image_required` | Video models need a start frame: send `image: {mime_type, base64}`. |
| 401 | `unauthorized` | Missing, wrong or revoked key. |
| 402 | `insufficient_credits` | Not enough credits. Nothing was reserved; `balance` shows what you have. |
| 403 | `access_required` | This account cannot order yet. Sign in to the app once to finish setting up the account. |
| 404 | `not_found` | No such video or generation on this account. |
| 409 | `price_changed` | The price moved since your estimate. Send the new `credits` value returned in the error. |
| 409 | `not_ready` | The video or file is not finished yet. Keep polling. |
| 409 | `conflict` | The action does not fit the job's current state (for example a decision for a stop it is not waiting at). |
| 413 | `payload_too_large` | Body over 300 KB. Shrink the start frame. |
| 429 | `rate_limited` | Too many requests. 120 requests per minute per key; ordering has its own lower limit. |
| 500 | `internal_error` | Something broke on our side. Retry; if it keeps failing, contact support with the `x-request-id`. |
| 503 | `service_unavailable` | Production is paused or unreachable. Nothing was charged; retry in a few minutes. |
| 503 | `model_unavailable` | That model is temporarily down. Nothing was charged; try again later or pick another model. |

## Common 400s on estimate

Most `invalid_request` errors are a field that the endpoint does not accept:

- Sending `credits` or `stops` to `/videos/estimate`: leave them out; they are for the order only.
- Leaving out `duration_min` without a `script`.
- A `seconds`, `aspect_ratio` or `resolution` the model does not support: check the [model page](https://cookstudio.ai/docs/models).
- `count` on video or music models (use `seconds`), or `seconds` on image models (use `count`).

Unknown fields are always rejected, so a typo never gets silently ignored.

Canonical: https://cookstudio.ai/docs/errors
