Video REST API
The Video API supports generating URLs with RESTful endpoints, supporting better handling of long-running rendering processes and higher character limits for prompt based inputs.
Authentication
All calls to the Imgix REST API require an API key with any permission (billing, asset manager read, etc). To create a key, navigate to the API Keys view in your Dashboard.
Video Generation Operations
| Endpoint | Method | Description |
|---|---|---|
/v1/generations/video | POST | Create a new video generation job from an image URL and prompt. |
/v1/generations/video/:job_id | GET | Retrieve the status and details of a video generation job. |
Creating a Video Generation Job
To create a video generation job, make a POST request to /v1/generations/video with the following parameters:
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
url | String | Yes | The URL of the source image to use for video generation. |
prompt | String | Yes | Text description to guide the video generation. |
model | String | Yes | The AI model to use. Accepted values: klingai, veo2, veo3. |
duration | Integer | Yes | Length of the generated video in seconds. |
POST /v1/generations/video
{
"url": "https://assets-secured.imgix.net/docs/examples/building-01.jpg",
"prompt": "walking towards building POV",
"model": "veo3",
"duration": 8
}Retrieving Video Generation Job Status
To check the status of a video generation job, make a GET request to /v1/generations/video/:job_id.
Response Attributes
| Attribute | Type | Description |
|---|---|---|
status | String | Current status of the job. Possible values: preparing, ready, errored. |
created_at | Integer | Unix timestamp when the job was created. |
updated_at | Integer | Unix timestamp when the job was last updated. Present when status is ready or errored. |
result.url | Object | Present when status is ready. Contains the url of the generated video. |
error.code | Integer | Present when status is errored. Contains the error code. |
error.message | String | Present when status is errored. Contains a descriptive error message. |
# Request
GET /v1/generations/video/3f98a9b2c4d5e6f7a8b9c0d1{
"data": {
"type": "job",
"id": "3f98a9b2c4d5e6f7a8b9c0d1",
"attributes": {
"status": "preparing",
"created_at": 1760074634
}
}
}Status Codes
| Status Code | Description |
|---|---|
200 | OK - Job created successfully or job status retrieved successfully. |
400 | Bad Request - Invalid request parameters or source URL (e.g., missing prompt). |
401 | Unauthorized - Invalid API key or account mismatch. |
403 | Forbidden - Image-to-video capability not enabled for this source. |
500 | Internal Server Error - Server error during job creation. |
Job Status Values
Video generation jobs progress through several states:
| Status | Description |
|---|---|
pending | Job has been created and is queued for processing. |
processing | Video generation is in progress. |
completed | Video generation has completed successfully. The result_url will be available. |
failed | Video generation failed. Check the error message in the response. |
Polling for Results
Since video generation is asynchronous, we recommend polling the GET endpoint to check job status.
async function pollJobStatus(jobId) {
const maxAttempts = 60;
const pollInterval = 5000; // 5 seconds
for (let i = 0; i < maxAttempts; i++) {
const response = await fetch(
`https://api.imgix.com/v1/generations/video/${jobId}`,
{
headers: {
Authorization: "Bearer YOUR_API_KEY",
},
},
);
const data = await response.json();
const status = data.data.attributes.status;
if (status === "ready") {
return data.data.attributes.result.url;
} else if (status === "errored") {
throw new Error(data.data.attributes.error.message);
}
// Wait before next poll
await new Promise((resolve) => setTimeout(resolve, pollInterval));
}
throw new Error("Job timed out");
}