Get a video task
curl --request GET \
--url https://api.aiohub.org/v1/contents/generations/tasks/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1/contents/generations/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aiohub.org/v1/contents/generations/tasks/{task_id}', 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.aiohub.org/v1/contents/generations/tasks/{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.aiohub.org/v1/contents/generations/tasks/{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.aiohub.org/v1/contents/generations/tasks/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1/contents/generations/tasks/{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_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ",
"model": "doubao-seedance-2-5-260628",
"status": "succeeded",
"error": null,
"content": {
"video_url": "https://api.aiohub.org/v1/videos/task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ/content"
},
"usage": {
"completion_tokens": 87300,
"total_tokens": 87300
},
"output_format": "mp4",
"framespersecond": 24,
"resolution": "720p",
"ratio": "16:9",
"duration": 4,
"generate_audio": true,
"priority": 0,
"service_tier": "default",
"execution_expires_after": 172800,
"created_at": 1791275108,
"updated_at": 1791275315
}{
"code": "invalid_duration",
"message": "duration must be between 4 and 30 seconds for this model"
}Get video · Ark / Seedance
Check task status, handle failures and find the completed video.
GET
/
v1
/
contents
/
generations
/
tasks
/
{task_id}
Get a video task
curl --request GET \
--url https://api.aiohub.org/v1/contents/generations/tasks/{task_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aiohub.org/v1/contents/generations/tasks/{task_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aiohub.org/v1/contents/generations/tasks/{task_id}', 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.aiohub.org/v1/contents/generations/tasks/{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.aiohub.org/v1/contents/generations/tasks/{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.aiohub.org/v1/contents/generations/tasks/{task_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiohub.org/v1/contents/generations/tasks/{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_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ",
"model": "doubao-seedance-2-5-260628",
"status": "succeeded",
"error": null,
"content": {
"video_url": "https://api.aiohub.org/v1/videos/task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ/content"
},
"usage": {
"completion_tokens": 87300,
"total_tokens": 87300
},
"output_format": "mp4",
"framespersecond": 24,
"resolution": "720p",
"ratio": "16:9",
"duration": 4,
"generate_audio": true,
"priority": 0,
"service_tier": "default",
"execution_expires_after": 172800,
"created_at": 1791275108,
"updated_at": 1791275315
}{
"code": "invalid_duration",
"message": "duration must be between 4 and 30 seconds for this model"
}Polling and status
Replace<TASK_ID> with the returned id and poll every 10 to 15 seconds:
curl "https://api.aiohub.org/v1/contents/generations/tasks/<TASK_ID>" \
-H "Authorization: Bearer <AIOHUB_API_KEY>"
status | Action |
|---|---|
queued / running | Keep polling |
succeeded | Download the video |
failed / cancelled / expired | Stop polling and read error.message when present |
Read a successful result
Key fields in a successful response are shown below. Use the URL returned by your request:{
"id": "task_example",
"status": "succeeded",
"content": {
"video_url": "https://api.aiohub.org/v1/videos/task_example/content"
}
}
Failures and retries
After a disconnect, keep polling the originalid. Task records remain for 7 days. If a task is missing, check the identifier and use a key belonging to the account that created it. Stop on failed, cancelled or expired.
After a 429 or temporary service error, wait before retrying the read; do not create another task. If a task is missing, check the identifier and the account that owns the API key.Authorizations
API key (sk-xxx)
Path Parameters
The id returned when the task was created
Response
Task object
Video task object.
Task ID
Example:
"task_ADQ5XK6AKWg36WePoJ3sZRyDvWl1ogGZ"
Example:
"doubao-seedance-2-5-260628"
Task status
Available options:
queued, running, succeeded, failed, cancelled, expired Error when the task did not succeed, otherwise null.
Show child attributes
Show child attributes
Artifact URLs when status is succeeded. Download with the same API key.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Example:
"mp4"
Example:
24
The requested value while running; the delivered value after success.
The requested value while running; the delivered value after success.
The requested value while running; the delivered value after success.
Example:
"default"
Example:
172800
Creation time, Unix seconds
Last update time, Unix seconds