# Wandura Ref 1.0: a drop-in for the video task API

> **TL;DR**: a tool that already calls the standard video-task API (`POST /api/v3/contents/generations/tasks`) changes three things: the base URL to `https://api.wandura.ai`, the key to a Wandura key, and `model` to `wandura-ref-1-0`. Everything else stays: the same request shape it sends today, the same `{"id"}` answer, the same task object on `GET` and on `callback_url`. Wandura decides how each video is made. A request it does not make yet is refused, free, with the code `UnsupportedRequest`: send that one to the model you used before. You pay the video's base cost × 1.1, with no discount. Failed, refused and timed-out tasks are free.

```mermaid
sequenceDiagram
  participant T as Your tool
  participant W as api.wandura.ai
  T->>W: POST /api/v3/contents/generations/tasks (model wandura-ref-1-0)
  W-->>T: 200 with the task id (or 400 UnsupportedRequest, then use your old model)
  Note over W: holds a ceiling price, makes the video
  W->>T: POST to your callback_url when the task ends (signed task object)
  T->>W: GET /api/v3/contents/generations/tasks/ID
  W-->>T: task object (status, content.video_url, wandura block)
```

## What changes
|  | Today | With Wandura |
|---|---|---|
| Base URL | The host you call today | `https://api.wandura.ai` (the path stays `/api/v3/contents/generations/tasks`) |
| Key | Your current key | `Authorization: Bearer wdr_live_…` (or `wdr_test_…` to test for free) |
| `model` | The model name you send today | `wandura-ref-1-0` |

Nothing else changes: the body, the `{"id"}` answer, the task object and the statuses keep their shape.

- **Keys.** An App key from the [console](https://open.wandura.ai) works, including a key limited to some styles. A creative team can instead get a key on its org's **UA wallet** (the wallet the org set aside for making ads; UA = user acquisition). Wandura makes UA wallet keys: ask your Wandura contact. A UA wallet key works only on this page's two paths. Everywhere else it gets `403 key_scope` (see [Errors](https://docs.wandura.ai/developers/api-v2/errors#key-scope)).
- **One model name.** `model` is always `wandura-ref-1-0`, in what you send and in every answer. Wandura picks how to make each video underneath.
- **No mark.** Videos made here never carry the "Made with Wandura.ai" mark.

| Endpoint | What it does |
|---|---|
| `POST /api/v3/contents/generations/tasks` | Create a task. Answers `{"id": "…"}`. |
| `GET /api/v3/contents/generations/tasks/{id}` | The task object. The same JSON is POSTed to your `callback_url`. |

## What it makes
Wandura Ref 1.0 makes videos from one reference video (a clip), at `480p` or `720p`. Anything else is refused with `UnsupportedRequest` and costs nothing.

| Request | Made? |
|---|---|
| An edit of the clip: one clip, with or without photos, in an edit task (`omni_reference_task_type: "edit"`): a new look, or someone in the clip replaced by the person in a photo. A clip with no photo, or a text that edits the clip, counts as an edit too. | Yes |
| One photo + one clip: the people in the photo move like the people in the clip. The photo has as many people as move in the clip, 1 to 4. | Yes |
| `resolution: "1080p"` | No: `400 UnsupportedRequest` (`param`: `resolution`) |
| No clip: photos only (first frame, first and last frame, reference images) or text only | No: `400 UnsupportedRequest` (`param`: `content`) |
| Several photos + a clip, when it is not an edit | No: `400 UnsupportedRequest` (`param`: `content`) |
| One photo + a clip, when the number of people differs or is above 4 | No: the task ends `failed` with `error.code` `UnsupportedRequest` |

**On `UnsupportedRequest`, send the same request to the model you used before.** Wandura finds most of these cases in the body, so `POST` answers `400` at once. A few show only once the task has started (counting the people, or a clip Wandura cannot work from): then the task ends `failed` with that code, also free. Branch on the code, not the message.

## Create a task
```bash
curl -X POST https://api.wandura.ai/api/v3/contents/generations/tasks \
  -H "Authorization: Bearer $WANDURA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "wandura-ref-1-0",
    "content": [
      {"type": "text", "text": "Edit @Video1: replace the dancer with the woman in @Image1, keep the moves."},
      {"type": "image_url", "image_url": {"url": "https://cdn.example.com/u/model.jpg"}, "role": "reference_image"},
      {"type": "video_url", "video_url": {"url": "https://cdn.example.com/u/dance.mp4"}, "role": "reference_video"}
    ],
    "omni_reference_task_type": "edit",
    "resolution": "480p",
    "generate_audio": true,
    "watermark": false
  }'
# HTTP 200
# {"id":"run_Rf5kT2wQx8Lm"}
```

The answer has only `id`. Keep it, then poll or wait for the callback.

| Field | Notes |
|---|---|
| `model` | Required. `wandura-ref-1-0`. Any other value is refused with `400` (see [Errors](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#errors)). |
| `content` | Required array, as you send it today. `text`: the prompt; refer to files as `@Image1`, `@Video1`, `@Audio1`. `image_url` with `role` `first_frame`, `last_frame` or `reference_image`: an https link, or a base64 data URI (PNG, JPEG or WEBP). `video_url` with `role` `reference_video`: an https link. `audio_url` with `role` `reference_audio`: an https link. See [What it makes](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#scope). |
| `duration` | A number, not a string: whole seconds, 4 to 30. An edit needs none: its video follows the clip, up to 30 seconds (or `duration` when shorter). |
| `resolution` | `480p` (also when you leave it out) or `720p`. `1080p` is refused with `400 UnsupportedRequest`. |
| `return_last_frame` | Optional. `true` adds `content.last_frame_url` to the task (see [The task object](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#task)). |
| Other parameters | `ratio`, `generate_audio`, `seed`, `watermark`, `omni_reference_task_type` and the rest: send them as you do today. |
| `callback_url` | Optional. A public https URL (at most 2048 characters) that gets the task object when the task ends. See [Callback](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#callback). |
| `id`, `user_prompt`, `backend_prompt`, `source` | Optional, Wandura's own. See [Wandura's extra fields](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#extra-fields). |

- **Links are read when the task runs**, not when you submit. Keep them valid until the task ends.
- **A base64 image** is stored privately by Wandura and used from that copy. Video and audio must be https links.
- Every problem in the body is refused at once with `400`, before anything is made or held. See [Limits](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#limits).

## Wandura's extra fields
Four optional fields at the top level of the body. Wandura keeps them with the task. They are never passed on to make the video.

| Field | What to send |
|---|---|
| `id` | Your tool's own job id: 1 to 80 letters, digits, dots, dashes or underscores. Sending the same `id` again gives back the same task (see [Same request, same task](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#idempotency)). |
| `user_prompt` | What the person typed in your tool, word for word, in any language. |
| `backend_prompt` | The prompt your tool's backend wrote from it (usually the `text` in `content`). |
| `source` | An object saying where the request came from, for example `{"venture", "tool", "template_id"}`. Reports group by `template_id`. |

With both prompts, Wandura can see what the person meant and what your backend asked for. Without one, the task carries a warning (see [The wandura block](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#wandura-block)). A full request, every field filled:

```json
{"model":"wandura-ref-1-0",
 "content":[{"type":"text","text":"Replace the dancer in @Video1 with @Image1, keep @Audio1"},
   {"type":"image_url","image_url":{"url":"https://cdn.example.com/u/model.jpg"},"role":"reference_image"},
   {"type":"video_url","video_url":{"url":"https://cdn.example.com/u/dance.mp4"},"role":"reference_video"},
   {"type":"audio_url","audio_url":{"url":"https://cdn.example.com/u/beat.mp3"},"role":"reference_audio"}],
 "ratio":"9:16","duration":8,"resolution":"720p","generate_audio":false,"watermark":false,"seed":42,
 "omni_reference_task_type":"reference","return_last_frame":true,
 "id":"job-1","user_prompt":"make it me","backend_prompt":"Replace the dancer in @Video1 with @Image1, keep @Audio1",
 "source":{"venture":"vl","tool":"creative","template_id":"tpl_9"},
 "callback_url":"https://creative.example/hook"}
```

## The task object
```bash
curl https://api.wandura.ai/api/v3/contents/generations/tasks/run_Rf5kT2wQx8Lm \
  -H "Authorization: Bearer $WANDURA_KEY"
```

```json
{"id":"run_Rf5kT2wQx8Lm","model":"wandura-ref-1-0","status":"succeeded",
 "content":{"video_url":"https://api.wandura.ai/v2/files/<file name>","last_frame_url":"https://api.wandura.ai/v2/files/<file name>"},
 "error":null,"created_at":1791590400,"updated_at":1791590400,
 "resolution":"480p",
 "wandura":{"creative_id":"run_Rf5kT2wQx8Lm","notes":[],"warnings":["no backend_prompt: taken from the content text"]}}
```

| Field | Notes |
|---|---|
| `id` | The task id from `POST`. |
| `model` | Always `wandura-ref-1-0`. |
| `status` | See the table below. |
| `content.video_url` | Only when `succeeded`: the MP4 on Wandura storage. Download it and keep your own copy. |
| `content.last_frame_url` | Only when `succeeded` and you sent `return_last_frame: true`: the video's last frame as a PNG, on Wandura storage. |
| `error` | `null`, or `{code, message}` when the task ended without a video. |
| `created_at`, `updated_at` | Unix seconds. |
| `resolution`, `ratio`, `duration`, `seed` | As you sent them. A field you did not send is not there. |
| `wandura` | Wandura's own block. See [The wandura block](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#wandura-block). |

There is no `usage` field. The price does not come from tokens (see [Price](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#price)).

| `status` | Meaning | `error.code` |
|---|---|---|
| `queued` | Accepted, waiting for room. |  |
| `running` | Being made. |  |
| `succeeded` | Done. `content.video_url` is set. You are charged. |  |
| `failed` | Ended without a video. Free. | `UnsupportedRequest` (not made yet: send it to the model you used before, see [What it makes](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#scope)), `GENERATION_FAILED` (submit again), `CONTENT_MODERATION_BLOCKED` (change the prompt or files), `INPUT_UNUSABLE` (a file could not be used) |
| `cancelled` | Stopped before it ran. Free. |  |
| `expired` | Not done within 90 minutes after it started. Free. Submit again. | `TIMEOUT` |

A task Wandura found it does not make, once it started (no `content`):

```json
{"id":"run_Rf5kT2wQx8Lm","model":"wandura-ref-1-0","status":"failed",
 "error":{"code":"UnsupportedRequest","message":"Wandura Ref 1.0 does not make this request yet (it makes an edit of the reference video (a new look, or a subject replaced from a photo), or a photo + a reference video with as many people in the photo as move in the clip). Not charged: send it to the model you used before."},
 "created_at":1791590400,"updated_at":1791590400,
 "resolution":"480p","ratio":"9:16","duration":5,
 "wandura":{"creative_id":"run_Rf5kT2wQx8Lm","notes":[],"warnings":[]}}
```

- **How often to poll**: every 10 to 15 seconds, or use `callback_url`.
- **Test keys** (`wdr_test_…`): the task succeeds at once with a sample video (`https://api.wandura.ai/v2/samples/video`). Nothing is held or charged.
- `GET` on an id that is not a task of your key's product answers `404 NotFound`.

## The wandura block
| Field | Notes |
|---|---|
| `creative_id` | On every task. Wandura keeps each task as a **creative**: the video with its whole recipe (your request and a private copy of every file). `creative_id` equals the task `id`. Use it when you talk to Wandura about this video. |
| `notes` | A list, can be empty. How Wandura read your request, in its own words (for example where `user_prompt` and the files disagree). |
| `warnings` | A list, can be empty. What was missing, changed or left out: no `user_prompt`, no `backend_prompt`, a `backend_prompt` that differs from the `text` in `content`, sound asked for but not made. |

Show `notes` and `warnings` to the person who wrote the prompt. Do not branch on their text.

## Callback
With `callback_url`, Wandura POSTs the task object (the same JSON as `GET`) **once, when the task ends**: `succeeded`, `failed`, `cancelled` or `expired`. There is no POST for `queued` or `running`.

1. **Have a signing secret first.** In the [console](https://open.wandura.ai/webhooks), create the product's Jobs API signing secret (or save a Webhook endpoint: its secret works too). For a UA wallet key, ask Wandura. Without one, a request with `callback_url` is refused with `400 InvalidParameter` (`param`: `callback_url`).
2. **Verify every request** on the **raw body**: `X-Signature` is the hex HMAC-SHA256 of `X-Timestamp + "." + raw body` with your secret. `X-Timestamp` (unix seconds) must be within 5 minutes of now. The code on [Verify the signature](https://docs.wandura.ai/developers/api-v2/jobs#webhook-verify) works as it is.
3. **Answer `2xx` within 10 seconds**, then do your work. Dedupe on the task `id` or the `Wandura-Event-Id` header (the same on every retry).

```http
POST /hook HTTP/1.1
Content-Type: application/json
User-Agent: Wandura-Webhooks/1
X-Timestamp: 1791590400
X-Signature: 6f1c…(64 hex characters)
Wandura-Event-Id: evt_…
Wandura-Event-Type: job.ended

{"id":"run_Rf5kT2wQx8Lm","model":"wandura-ref-1-0","status":"succeeded", …}
```

A non-2xx answer, a timeout or a network error is retried after 30 seconds, 2 minutes, 10 minutes, 1 hour, 6 hours and 24 hours. If every attempt fails, the task is still there: `GET` it.

## Price
One rule, the same for every org. Partner discounts do not apply to this model.

**Price = (video seconds at the base video rate + prompt writing + split pictures) × 1.1**

| Part | What it counts |
|---|---|
| Video seconds | Wandura makes the video in pieces of at most 15 seconds. Each piece counts its output seconds plus the seconds of the clip it reads (at most 15). The base video rate is $0.041256 per second at `480p` and $0.083 at `720p`. |
| Prompt writing | One language-model call per piece, plus one to count the people for a photo + a clip: what the call cost, or $0.03 when that is not known. |
| Split pictures | Only for a photo + a clip: one picture per person plus one of the empty place, each at what it cost, or $0.20 when that is not known. |

1. **On submit, Wandura holds the most the request can cost** on the key's wallet: the longest video it can make from the request (an edit counts its clip at up to 30 seconds), 15 seconds of clip per piece, $0.03 per call, and for a photo + a clip pictures for 4 people plus the place, all × 1.1.
2. **When the task succeeds, you are charged** for what was made, × 1.1. Never more than the hold.
3. **The rest of the hold goes back** to the wallet.

Example: a 30-second `480p` edit is made in two pieces. Held: (2 calls × $0.03 + (30 s out + 2 × 15 s of clip) × $0.041256) × 1.1 = $2.788896. Charged when the two calls cost $0.0021 each: (60 s × $0.041256 + $0.0042) × 1.1 = $2.727516.

- `failed`, `expired` and `cancelled` tasks are **free**: the whole hold goes back. That includes a task that ends with `UnsupportedRequest`. A refused request (`4xx`) holds nothing.
- If the wallet cannot cover the hold, the request is refused with `402 InsufficientBalance` and nothing is made.
- A UA wallet key pays only from the UA wallet, never from the org's pool or another wallet.
- No mark fee: these videos carry no mark.
- The task object carries no price.

## Same request, same task
A retry never makes a second video or a second charge:

- **With `id`**: the same `id` with the same body gives back the same task, with no time limit. The same `id` with a different body is refused with `409 Conflict`. Use a new `id` for a new task.
- **Without `id`**: the same body from the same key within 10 minutes is the same task (a double click makes one video). After 10 minutes it is a new task.

The `Idempotency-Key` header is not read here. Use `id`.

## Limits
| What | Limit |
|---|---|
| What it makes | See [What it makes](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#scope). Anything else is refused with `UnsupportedRequest`, free. |
| Images | Up to 10. Https links or base64 data URIs (PNG, JPEG, WEBP). |
| Video | At most 1, https link only. |
| Audio | Https links only. |
| Tags | `@Image3` needs at least 3 images (the same for `@Video` and `@Audio`). |
| Placeholders | A link that is still a placeholder, such as `<link>`, is refused. |
| `duration` | A number (`8`, not `"8"`): whole seconds, 4 to 30. An edit task (`omni_reference_task_type: "edit"`) takes exactly one video instead. |
| `resolution` | `480p` (the default) or `720p`. `1080p` is refused with `400 UnsupportedRequest`. |
| `id` | 1 to 80 letters, digits, dots, dashes or underscores. |
| `callback_url` | Public https, at most 2048 characters. |
| Task time | 90 minutes after it starts. Then it is `expired`, free. |
| Not here | Listing and deleting tasks: both answer `404 NotFound`. |

When many tasks run at once, new ones wait as `queued`. They are not refused. Your product's per-minute rate and daily spend cap still apply (see [Errors](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#errors)).

## Errors
Errors have the same shape as the API you call today: `{"error": {"code", "message", "param"}}`. `param` is there only on `400`. Branch on `code`; the message is for people. Each code has its own section on the [Errors](https://docs.wandura.ai/developers/api-v2/errors#ref-errors) page.

| HTTP | `code` | Retry? | When |
|---|---|---|---|
| 400 | [`InvalidParameter`](https://docs.wandura.ai/developers/api-v2/errors#ref-invalid-parameter) | No | The body breaks a [limit](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#limits), `model` is not `wandura-ref-1-0`, or `callback_url` cannot be signed. `param` names the field. |
| 400 | [`UnsupportedRequest`](https://docs.wandura.ai/developers/api-v2/errors#ref-unsupported-request) | No: send it to the model you used before | A valid request Wandura Ref 1.0 does not make yet (see [What it makes](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#scope)). `param` is `resolution` or `content`. |
| 401 | [`AuthenticationError`](https://docs.wandura.ai/developers/api-v2/errors#ref-authentication-error) | No | No key, or an unknown, revoked or expired key. |
| 402 | [`InsufficientBalance`](https://docs.wandura.ai/developers/api-v2/errors#ref-insufficient-balance) | No | The wallet cannot cover the hold. Add money first. |
| 403 | [`AccessDenied`](https://docs.wandura.ai/developers/api-v2/errors#ref-access-denied) | No | A read-only key sends a task. |
| 404 | [`NotFound`](https://docs.wandura.ai/developers/api-v2/errors#ref-not-found) | No | No such task for this key's product, or no such endpoint. |
| 409 | [`Conflict`](https://docs.wandura.ai/developers/api-v2/errors#ref-conflict) | No | This `id` was used with a different body. |
| 429 | [`RateLimitExceeded`](https://docs.wandura.ai/developers/api-v2/errors#ref-rate-limit-exceeded) | Yes | Too many tasks this minute, or too many running. Wait for `Retry-After`. |
| 429 | [`QuotaExceeded`](https://docs.wandura.ai/developers/api-v2/errors#ref-quota-exceeded) | No | Your product's daily spend cap is reached. |
| 500 | [`InternalServiceError`](https://docs.wandura.ai/developers/api-v2/errors#ref-internal-service-error) | Yes | Something went wrong at Wandura. Send the same request again. |
| 503 | [`ServiceUnavailable`](https://docs.wandura.ai/developers/api-v2/errors#ref-service-unavailable) | Yes | Briefly unavailable. Nothing was made or held. |

A string `duration`:

```json
HTTP 400
{"error":{"code":"InvalidParameter","message":"a reference task needs a whole-second duration 4–30 (got \"8\")","param":"duration"}}
```

The old model name:

```json
HTTP 400
{"error":{"code":"InvalidParameter","message":"model must be \"wandura-ref-1-0\" (Wandura Ref 1.0).","param":"model"}}
```

Too many images:

```json
HTTP 400
{"error":{"code":"InvalidParameter","message":"Wandura Ref 1.0 takes at most 10 reference images (has 11)","param":"content"}}
```

A resolution Wandura Ref 1.0 does not make yet:

```json
HTTP 400
{"error":{"code":"UnsupportedRequest","message":"Wandura Ref 1.0 does not make this request yet (1080p: it makes 480p and 720p). Nothing was created or charged: send it to the model you used before.","param":"resolution"}}
```

The same `id` with a different body:

```json
HTTP 409
{"error":{"code":"Conflict","message":"This id was already used with a different request. Use a new id for a new task."}}
```

When the body has several problems, `message` lists all of them, separated by `; `, and `param` names the field of the first one.

A task that ends without a video is not an HTTP error: it reads `failed` or `expired` (see [The task object](https://docs.wandura.ai/developers/api-v2/wandura-ref-1-0#task)). It is free.
