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

# Query a Wan3.0 video task

> Retrieve a Wan3.0 video task by ID. Inspect processing and terminal states, download the video, read final usage, and implement bounded polling.

Query AntiRouter for a Wan3.0 task's progress, video URL, and final usage. Use the `output.task_id` from [Generation](https://docs.anti.rs/en/api-reference/wan3/generation.md) and an active inference key belonging to the account that created the task.

## Path parameter

**task\_id** `string` *required*

The `output.task_id` from the creation response, not its `request_id`. You can only query tasks owned by the account associated with your key.

## Task states

| `output.task_status` | Meaning | Next step |
| - | - | - |
| `PENDING` | Accepted and waiting for processing. | Query again later. |
| `RUNNING` | Generation is in progress. | Query again later. |
| `SUCCEEDED` | Generation succeeded and usage is confirmed. | Read `output.video_url` and `usage`. |
| `FAILED` | Generation failed. | Stop polling and check console history before resubmitting. |
| `CANCELED` | The task was canceled. | Stop polling; the hold is released. |

An HTTP `200` response can contain `FAILED` or `CANCELED`, so always inspect the task state. `CANCELED` is a possible terminal state; these docs do not expose a task-cancellation endpoint.

## Response fields

**request\_id** `string` *required*

The original generation request's platform ID, also returned as `X-Request-ID` on successful queries.

**output** `object` *required*

**output fields**

**task\_id** `string` *required*

Generation task ID.

**task\_status** `string` *required*

Task state from the table above.

**submit\_time** `string` *required*

Submission time in UTC, formatted as `YYYY-MM-DD HH:mm:ss.SSS`.

**scheduled\_time** `string` *required*

Currently equals the submission time; do not use it to measure queue time or the actual start time.

**end\_time** `string` *required*

Recorded terminal-state time in UTC, or an empty string while unfinished.

**orig\_prompt** `string` *required*

The original submitted prompt.

**video\_url** `string` *required*

Video URL on success, or an empty string when no result is available.

**usage** `object`

Returned after settlement. In-progress and failed tasks normally omit this field.

**usage fields**

**video\_count** `integer`

Number of videos, currently `1`.

**duration** `integer`

Total billable seconds: input reference-video seconds plus output seconds.

**input\_video\_duration** `integer`

Combined reference-video duration rounded down to billable whole seconds.

**output\_video\_duration** `integer`

Requested seconds for fixed-duration tasks; measured output rounded up to whole seconds for automatic duration.

**SR** `integer`

Value for the requested resolution: 480, 720, 1080, 1440 (2k), or 2160 (4k). This is not a measurement of the output dimensions.

**ratio** `string`

Requested aspect ratio, not a measurement of the output dimensions.

## Polling example

Start with a three-second polling interval and adjust it for your application. This Python example queries an existing task using only the standard library. Set `ANTI_API_KEY` and `TASK_ID` first.

```python Python theme={null}
import json
import os
import time
from urllib.parse import quote
from urllib.request import Request, urlopen

# Set TASK_ID to the output.task_id returned by the generation request.
task_id = os.environ["TASK_ID"]
url = "https://anti.rs/api/v1/tasks/" + quote(task_id, safe="")
headers = {"Authorization": "Bearer " + os.environ["ANTI_API_KEY"]}
deadline = time.monotonic() + 600

while time.monotonic() < deadline:
    request = Request(url, headers=headers)
    with urlopen(request, timeout=120) as response:
        result = json.load(response)
    output = result["output"]
    status = output["task_status"]
    if status == "SUCCEEDED":
        print(output["video_url"])
        break
    if status in ("FAILED", "CANCELED"):
        raise RuntimeError("Task ended with status: " + status)
    if status not in ("PENDING", "RUNNING"):
        raise RuntimeError("Unexpected task status: " + status)
    time.sleep(3)
else:
    raise TimeoutError("Polling stopped. Query the same task ID later.")
```

The example stops after ten minutes of local polling. This is not a platform task-timeout limit. Stopping polling does not cancel the task; keep its ID to query later. Network and HTTP errors stop this example. Production clients can add bounded backoff retries for queries.

## Errors and charges

* `401 unauthorized`: check the inference key is valid and enabled, and the request IP satisfies your allowlist.
* `404 not_found`: verify the task ID and use a key belonging to the account that created it.
* `502 upstream_unavailable`: a valid state cannot currently be retrieved; retry the same query later.
* `503 metering_unavailable`: usage cannot yet be confirmed; query later and review the console status.

Querying an existing task does not create a new generation order. Failed or canceled tasks release the original hold. Review successful usage and charges in [task history](https://anti.rs/app/tasks) and [Billing](https://anti.rs/app/billing).

> [!NOTE]
>
> Example IDs, timestamps, and `example.com` video URLs illustrate the response structure. Use the actual `video_url` from your response and download finished videos to your own storage when you need to retain them.

```bash cURL theme={null}
curl --request GET \
  --url "https://anti.rs/api/v1/tasks/$TASK_ID" \
  --header "Authorization: Bearer $ANTI_API_KEY"
```

```json SUCCEEDED theme={null}
{
  "request_id": "3c22bd6d-4101-4c7d-8430-b7af1050e842",
  "output": {
    "task_id": "example-task-id",
    "task_status": "SUCCEEDED",
    "submit_time": "2026-11-30 08:00:00.000",
    "scheduled_time": "2026-11-30 08:00:00.000",
    "end_time": "2026-11-30 08:01:20.000",
    "orig_prompt": "A paper boat floats along a quiet stream at sunrise. Slow tracking shot, soft natural light.",
    "video_url": "https://example.com/generated-video.mp4"
  },
  "usage": {
    "video_count": 1,
    "duration": 5,
    "input_video_duration": 0,
    "output_video_duration": 5,
    "SR": 720,
    "ratio": "16:9"
  }
}
```

```json RUNNING theme={null}
{
  "request_id": "3c22bd6d-4101-4c7d-8430-b7af1050e842",
  "output": {
    "task_id": "example-task-id",
    "task_status": "RUNNING",
    "submit_time": "2026-11-30 08:00:00.000",
    "scheduled_time": "2026-11-30 08:00:00.000",
    "end_time": "",
    "orig_prompt": "A paper boat floats along a quiet stream at sunrise. Slow tracking shot, soft natural light.",
    "video_url": ""
  }
}
```

```json FAILED theme={null}
{
  "request_id": "3c22bd6d-4101-4c7d-8430-b7af1050e842",
  "output": {
    "task_id": "example-task-id",
    "task_status": "FAILED",
    "submit_time": "2026-11-30 08:00:00.000",
    "scheduled_time": "2026-11-30 08:00:00.000",
    "end_time": "2026-11-30 08:01:20.000",
    "orig_prompt": "A paper boat floats along a quiet stream at sunrise. Slow tracking shot, soft natural light.",
    "video_url": ""
  }
}
```


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