Query video generation task status
curl --request GET \
--url https://api.example.com/v1/video/generations/{taskId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/v1/video/generations/{taskId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/v1/video/generations/{taskId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/video/generations/{taskId}",
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: <authorization>"
],
]);
$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.example.com/v1/video/generations/{taskId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.example.com/v1/video/generations/{taskId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/video/generations/{taskId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"video_url": "<string>",
"video_duration": 123,
"error_code": "<string>",
"error_message": "<string>",
"status": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"model": "<string>",
"created": 123,
"updated": 123,
"usage": {
"input_video_duration": 123,
"output_video_duration": 123,
"total_tokens": 123,
"duration": 123
}
}Video
Query video generation task
Query the status and result of a common video generation task
GET
/
v1
/
video
/
generations
/
{taskId}
Query video generation task status
curl --request GET \
--url https://api.example.com/v1/video/generations/{taskId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/v1/video/generations/{taskId}"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/v1/video/generations/{taskId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/video/generations/{taskId}",
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: <authorization>"
],
]);
$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.example.com/v1/video/generations/{taskId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.example.com/v1/video/generations/{taskId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/video/generations/{taskId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"task_id": "<string>",
"video_url": "<string>",
"video_duration": 123,
"error_code": "<string>",
"error_message": "<string>",
"status": "<string>",
"resolution": "<string>",
"ratio": "<string>",
"model": "<string>",
"created": 123,
"updated": 123,
"usage": {
"input_video_duration": 123,
"output_video_duration": 123,
"total_tokens": 123,
"duration": 123
}
}Use the
task_id returned when creating a video task to query its status. After the task succeeds, the response includes the video URL.
Poll every 10-15 seconds. Video generation typically takes from tens of seconds to a few minutes.
Polling example
Python
import time
import requests
task_id = "cgt-20260730120000-a1b2c3"
url = f"https://api.haitoken.ai/v1/video/generations/{task_id}"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
while True:
result = requests.get(url, headers=headers).json()
if result["status"] == "succeeded":
print(result["video_url"])
break
if result["status"] in ("failed", "cancelled", "expired"):
break
time.sleep(5)
Path Parameters
Response
200 - application/json
Generic video task status query response
Task ID
Video URL (on success; upstream address)
Video duration (seconds, on success)
Error code (on failure)
Error message (on failure)
Task status: queued / running / succeeded / failed / cancelled / expired
Generated video resolution: 480p / 720p / 1080p / 4k
Generated video aspect ratio: 16:9 / 4:3 / 1:1 / 3:4 / 9:16 / 21:9
Platform model number (model_no, used to replace the upstream model name during protocol pass-through)
Creation time (epoch milliseconds) - UTC
Update time (epoch milliseconds) - UTC
Usage statistics (on success; duration fields from Wan usage, token fields from seedance usage)
Show child attributes
Show child attributes