Skip to main content

Poll Video Generation Status

GET 

https://api.knox.chat/v1/videos/:jobId

Poll a video generation job created by POST /v1/videos. Use the id (or polling_url) from the submit response. Keep polling while status is pending or in_progress. When status is completed, download the file from GET /v1/videos/{jobId}/content or use unsigned_urls.

Jobs are scoped to the authenticated user. Polling another account's jobId returns 404.

Request

Path Parameters

NameTypeRequiredDescription
jobIdStringYesJob ID returned by submit, for example job-3c91a0e8b7d24f11.

Request Headers

NameTypeRequiredDescription
AuthorizationStringYesBearer authentication in the form Bearer <token>.

This endpoint has no request body.

cURL Example

curl -X GET https://api.knox.chat/v1/videos/job-3c91a0e8b7d24f11 \
-H "Authorization: Bearer $KNOXCHAT_API_KEY"

Poll every few seconds until the job leaves pending / in_progress. Video generation often takes tens of seconds to a few minutes depending on model, duration, and resolution.

while true; do
resp=$(curl -s -X GET "https://api.knox.chat/v1/videos/job-3c91a0e8b7d24f11" \
-H "Authorization: Bearer $KNOXCHAT_API_KEY")
status=$(printf '%s' "$resp" | python -c "import sys,json; print(json.load(sys.stdin).get('status',''))")
echo "$status"
case "$status" in
completed|failed|cancelled|expired) echo "$resp"; break ;;
esac
sleep 5
done

Response

In progress (200)

{
"generation_id": "gen-8f2c1a9b4d6e7f01",
"id": "job-3c91a0e8b7d24f11",
"polling_url": "/v1/videos/job-3c91a0e8b7d24f11",
"status": "in_progress"
}

Completed (200)

{
"generation_id": "gen-8f2c1a9b4d6e7f01",
"id": "job-3c91a0e8b7d24f11",
"polling_url": "/v1/videos/job-3c91a0e8b7d24f11",
"status": "completed",
"unsigned_urls": [
"https://image.knox.chat/videos/job-3c91a0e8b7d24f11/0_e081f0c0ab29f22a.mp4"
],
"usage": {
"cost": 0.415
}
}

unsigned_urls are Knox-hosted download links (presigned object storage or custom domain). Upstream provider URLs are never returned.

Failed (200)

{
"generation_id": "gen-8f2c1a9b4d6e7f01",
"id": "job-3c91a0e8b7d24f11",
"polling_url": "/v1/videos/job-3c91a0e8b7d24f11",
"status": "failed",
"error": "The upstream provider rejected this generation request"
}

A failed poll still returns HTTP 200 with status: "failed". Use the error field for the reason.

Response Schema

NameTypeDescription
generation_idstringUnique generation identifier (gen-...).
idstringJob ID (job-...). Always the Knox job ID, not an upstream ID.
polling_urlstringRelative poll URL for this job.
statusstringpending, in_progress, completed, failed, cancelled, or expired.
errorstringPresent when status is failed.
unsigned_urlsarray of stringsKnox-hosted video URLs when status is completed.
usageobjectPresent when billing has been finalized.
usage.costnumberCost in USD.

Error Responses

{
"error": {
"code": 404,
"message": "Resource not found"
}
}
StatusMessageWhen
401Missing Authentication headerMissing or invalid API key.
404Resource not foundUnknown jobId, or the job belongs to another user.
500Internal Server ErrorUnexpected server error.