Tasks
Poll generation task status and retrieve AI-generated videos and images. Real-time progress updates, error handling, and direct download URLs for all completed generations.
Poll task status and retrieve generated content.
Get Task Status
Check the status of a generation task.
GET /api/v1/tasks/{id}Example Request
curl https://vicsee.com/api/v1/tasks/task_abc123 \
-H "Authorization: Bearer sk-your-api-key"Response (Processing)
{
"success": true,
"data": {
"id": "task_abc123",
"model": "sora-2",
"status": "processing",
"mediaType": "video",
"prompt": "A timelapse of a flower blooming",
"createdAt": "2024-12-27T10:30:00.000Z",
"result": null
}
}Response (Complete)
{
"success": true,
"data": {
"id": "task_abc123",
"model": "sora-2",
"status": "completed",
"mediaType": "video",
"prompt": "A timelapse of a flower blooming",
"createdAt": "2024-12-27T10:30:00.000Z",
"result": {
"url": "https://cdn.vicsee.com/videos/abc123.mp4",
"type": "video"
}
}
}Status Values
| Status | Description |
|---|---|
pending | Task queued, not yet started |
processing | Generation in progress |
completed | Complete, result available |
failed | Generation failed |
Polling Strategy
We recommend polling with exponential backoff:
async function waitForResult(taskId, apiKey) {
const maxAttempts = 60;
let delay = 1000; // Start with 1 second
for (let i = 0; i < maxAttempts; i++) {
const response = await fetch(
`https://vicsee.com/api/v1/tasks/${taskId}`,
{ headers: { Authorization: `Bearer ${apiKey}` } }
);
const data = await response.json();
if (data.data.status === 'completed') {
return data.data.result;
}
if (data.data.status === 'failed') {
throw new Error('Generation failed');
}
await new Promise(r => setTimeout(r, delay));
delay = Math.min(delay * 1.5, 10000); // Max 10 seconds
}
throw new Error('Timeout waiting for result');
}Errors
| Code | Description |
|---|---|
TASK_NOT_FOUND | Task ID doesn't exist |
FORBIDDEN | Task belongs to another user |
NO_RESULT | Task completed but no result available |