Tasks
Check generation status and download results
Poll task status and download 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": "success",
"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 |
success | Complete, result available |
failed | Generation failed |
Download Content
Get the download URL or stream the content directly.
GET /api/v1/tasks/{id}/downloadExample Request
curl https://vicsee.com/api/v1/tasks/task_abc123/download \
-H "Authorization: Bearer sk-your-api-key"Response
{
"success": true,
"data": {
"url": "https://cdn.vicsee.com/videos/abc123.mp4",
"type": "video",
"expiresAt": null
}
}Proxy Mode
To stream content directly through the API (useful for avoiding CORS):
curl "https://vicsee.com/api/v1/tasks/task_abc123/download?mode=proxy" \
-H "Authorization: Bearer sk-your-api-key" \
-o output.mp4Polling 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 === 'success') {
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 |
TASK_NOT_COMPLETE | Tried to download before completion |
NO_RESULT | Task completed but no result available |