Wan
Retrieve a Wan video
Retrieve a Wan video task by task ID, including status, progress, timestamps, and the completed video URL.
GET
/
v1
/
videos
/
{task_id}
cURL
curl https://api.cometapi.com/v1/videos/<TASK_ID> \
-H "Authorization: Bearer $COMETAPI_KEY"import os
import time
import requests
TASK_ID = "<TASK_ID>"
headers = {"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]}
terminal_statuses = {"completed", "failed", "error"}
while True:
response = requests.get(
f"https://api.cometapi.com/v1/videos/{TASK_ID}",
headers=headers,
timeout=60,
)
response.raise_for_status()
task = response.json()
print(task["status"], task.get("progress"))
if task["status"] in terminal_statuses:
print(task.get("video_url"))
break
time.sleep(10)
const TASK_ID = "<TASK_ID>";
const terminalStatuses = new Set(["completed", "failed", "error"]);
while (true) {
const response = await fetch(
`https://api.cometapi.com/v1/videos/${TASK_ID}`,
{ headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` } },
);
const task = await response.json();
console.log(task.status, task.progress);
if (terminalStatuses.has(task.status)) {
console.log(task.video_url);
break;
}
await new Promise((resolve) => setTimeout(resolve, 10_000));
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/v1/videos/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/v1/videos/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cometapi.com/v1/videos/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/v1/videos/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "task_example",
"model": "wan2.6",
"object": "video",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}Use this endpoint after you create a Wan video task. It returns the task state and includes
video_url after the task is completed.
Check these fields
statustells you whether the task isqueued,in_progress,completed,failed, orerror.progressis a coarse completion percentage.video_urlappears on completed responses.errorappears when a task fails.
Polling flow
1
Create the task first
Start with Create a Wan video and store the returned
id.2
Poll by task ID
Send the task ID to this endpoint until
status reaches completed, failed, or error.3
Download the MP4 file
When
status is completed, call Retrieve Wan video content.Response
Current Wan video task state.
Last modified on June 23, 2026
⌘I
cURL
curl https://api.cometapi.com/v1/videos/<TASK_ID> \
-H "Authorization: Bearer $COMETAPI_KEY"import os
import time
import requests
TASK_ID = "<TASK_ID>"
headers = {"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]}
terminal_statuses = {"completed", "failed", "error"}
while True:
response = requests.get(
f"https://api.cometapi.com/v1/videos/{TASK_ID}",
headers=headers,
timeout=60,
)
response.raise_for_status()
task = response.json()
print(task["status"], task.get("progress"))
if task["status"] in terminal_statuses:
print(task.get("video_url"))
break
time.sleep(10)
const TASK_ID = "<TASK_ID>";
const terminalStatuses = new Set(["completed", "failed", "error"]);
while (true) {
const response = await fetch(
`https://api.cometapi.com/v1/videos/${TASK_ID}`,
{ headers: { Authorization: `Bearer ${process.env.COMETAPI_KEY}` } },
);
const task = await response.json();
console.log(task.status, task.progress);
if (terminalStatuses.has(task.status)) {
console.log(task.video_url);
break;
}
await new Promise((resolve) => setTimeout(resolve, 10_000));
}
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/v1/videos/{task_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/v1/videos/{task_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cometapi.com/v1/videos/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/v1/videos/{task_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "task_example",
"model": "wan2.6",
"object": "video",
"status": "queued",
"progress": 0,
"created_at": 1779938152
}