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

EndpointMethodDescription
/v1/generations/videoPOSTCreate a new video generation job from an image URL and prompt.
/v1/generations/video/:job_idGETRetrieve 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

ParameterTypeRequiredDescription
urlStringYesThe URL of the source image to use for video generation.
promptStringYesText description to guide the video generation.
modelStringYesThe AI model to use. Accepted values: klingai, veo2, veo3.
durationIntegerYesLength 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

AttributeTypeDescription
statusStringCurrent status of the job. Possible values: preparing, ready, errored.
created_atIntegerUnix timestamp when the job was created.
updated_atIntegerUnix timestamp when the job was last updated. Present when status is ready or errored.
result.urlObjectPresent when status is ready. Contains the url of the generated video.
error.codeIntegerPresent when status is errored. Contains the error code.
error.messageStringPresent 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 CodeDescription
200OK - Job created successfully or job status retrieved successfully.
400Bad Request - Invalid request parameters or source URL (e.g., missing prompt).
401Unauthorized - Invalid API key or account mismatch.
403Forbidden - Image-to-video capability not enabled for this source.
500Internal Server Error - Server error during job creation.

Job Status Values

Video generation jobs progress through several states:

StatusDescription
pendingJob has been created and is queued for processing.
processingVideo generation is in progress.
completedVideo generation has completed successfully. The result_url will be available.
failedVideo 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");
}