curl https://api.snapgen.org/v1/tasks/task_01HXYZ \
-H "Authorization: Bearer $SNAPGEN_API_KEY"
import json
import os
from urllib.request import Request, urlopen
request = Request(
"https://api.snapgen.org/v1/tasks/task_01HXYZ",
headers={"Authorization": f"Bearer {os.environ['SNAPGEN_API_KEY']}"},
)
with urlopen(request) as response:
task = json.load(response)
print(task["status"], task.get("result"))
const response = await fetch(
"https://api.snapgen.org/v1/tasks/task_01HXYZ",
{ headers: { Authorization: `Bearer ${process.env.SNAPGEN_API_KEY}` } },
);
const task = await response.json();
console.log(task.status, task.result);
{
"id": "task_01HXYZ",
"object": "task",
"status": "completed",
"model": "gemini-omni-t2v",
"progress": 100,
"created": 1784324432,
"completed": 1784324660,
"cost": 0.25,
"result": {
"videos": [
{
"url": ["https://storage.example.com/videos/output.mp4"],
"expires_at": 1785534260
}
]
},
"error": null
}
{
"id": "task_01HXYZ",
"object": "task",
"status": "failed",
"model": "gemini-omni-t2v",
"progress": 100,
"created": 1784324432,
"completed": 1784324655,
"cost": 0,
"result": null,
"error": { "message": "Upstream generation failed" }
}
{
"id": "task_01HXYZ",
"object": "task",
"status": "in_progress",
"model": "gemini-omni-t2v",
"progress": 30,
"created": 1784324432,
"completed": null,
"cost": 0.25,
"result": null,
"error": null
}
Task Management
Get task status
One endpoint to check any asynchronous generation task by its ID.
GET
/
v1
/
tasks
/
{id}
curl https://api.snapgen.org/v1/tasks/task_01HXYZ \
-H "Authorization: Bearer $SNAPGEN_API_KEY"
import json
import os
from urllib.request import Request, urlopen
request = Request(
"https://api.snapgen.org/v1/tasks/task_01HXYZ",
headers={"Authorization": f"Bearer {os.environ['SNAPGEN_API_KEY']}"},
)
with urlopen(request) as response:
task = json.load(response)
print(task["status"], task.get("result"))
const response = await fetch(
"https://api.snapgen.org/v1/tasks/task_01HXYZ",
{ headers: { Authorization: `Bearer ${process.env.SNAPGEN_API_KEY}` } },
);
const task = await response.json();
console.log(task.status, task.result);
{
"id": "task_01HXYZ",
"object": "task",
"status": "completed",
"model": "gemini-omni-t2v",
"progress": 100,
"created": 1784324432,
"completed": 1784324660,
"cost": 0.25,
"result": {
"videos": [
{
"url": ["https://storage.example.com/videos/output.mp4"],
"expires_at": 1785534260
}
]
},
"error": null
}
{
"id": "task_01HXYZ",
"object": "task",
"status": "failed",
"model": "gemini-omni-t2v",
"progress": 100,
"created": 1784324432,
"completed": 1784324655,
"cost": 0,
"result": null,
"error": { "message": "Upstream generation failed" }
}
{
"id": "task_01HXYZ",
"object": "task",
"status": "in_progress",
"model": "gemini-omni-t2v",
"progress": 30,
"created": 1784324432,
"completed": null,
"cost": 0.25,
"result": null,
"error": null
}
Query any asynchronous task (video generation today) with the task ID returned
when you submitted it.
Poll every 10 to 20 seconds, or skip polling entirely with a
webhook — the webhook payload is exactly this
response object.
string
required
The task ID returned when you submitted the request, for example
task_01HXYZ.Response fields
string
The task ID you submitted.
string
queued, in_progress, completed, or failed.string
The model that ran the task.
number
0–100.
number
Unix timestamp (seconds) of submission.
number | null
Unix timestamp (seconds) of completion.
null while running.number
Amount billed in USD. Failed tasks are automatically refunded.
object | null
Present when
status is completed. result.videos[].url is an array of
direct download URLs (some models return more than one file);
result.videos[].expires_at is the Unix timestamp when the URLs stop
working.object | null
error.message holds the failure reason when status is failed.Result URLs expire (media is retained for 14 days — see
expires_at).
Download the files to your own storage promptly.curl https://api.snapgen.org/v1/tasks/task_01HXYZ \
-H "Authorization: Bearer $SNAPGEN_API_KEY"
import json
import os
from urllib.request import Request, urlopen
request = Request(
"https://api.snapgen.org/v1/tasks/task_01HXYZ",
headers={"Authorization": f"Bearer {os.environ['SNAPGEN_API_KEY']}"},
)
with urlopen(request) as response:
task = json.load(response)
print(task["status"], task.get("result"))
const response = await fetch(
"https://api.snapgen.org/v1/tasks/task_01HXYZ",
{ headers: { Authorization: `Bearer ${process.env.SNAPGEN_API_KEY}` } },
);
const task = await response.json();
console.log(task.status, task.result);
{
"id": "task_01HXYZ",
"object": "task",
"status": "completed",
"model": "gemini-omni-t2v",
"progress": 100,
"created": 1784324432,
"completed": 1784324660,
"cost": 0.25,
"result": {
"videos": [
{
"url": ["https://storage.example.com/videos/output.mp4"],
"expires_at": 1785534260
}
]
},
"error": null
}
{
"id": "task_01HXYZ",
"object": "task",
"status": "failed",
"model": "gemini-omni-t2v",
"progress": 100,
"created": 1784324432,
"completed": 1784324655,
"cost": 0,
"result": null,
"error": { "message": "Upstream generation failed" }
}
{
"id": "task_01HXYZ",
"object": "task",
"status": "in_progress",
"model": "gemini-omni-t2v",
"progress": 30,
"created": 1784324432,
"completed": null,
"cost": 0.25,
"result": null,
"error": null
}