Open AI Image API

API reference

Get a video task

Returns a task created by the authenticated account. While the status is pending or processing, poll this endpoint with backoff. A successful task includes its video URL in outputs.

GET/v1/tasks/{task_id}

Authorization

AuthorizationBearer <token>

Create a Open AI Image API key in Settings. Send it only from a trusted server.

In: header

Path Parameters

task_idstring

POST /v1/videos/generations returns this task ID.

Response Body

200
task_idstring

The task identifier.

statusstring

The current task status.

"pending" | "processing" | "success" | "failed" | "canceled"
credits_usednumber

The task’s credit cost. Credits are returned if generation fails.

outputsarray<object>

Output media for a successful task.

Array Item
urlstring

The output media URL.

thumbnail?string

The thumbnail URL, when available.

error?string

The error message when generation fails.

401
errorobject

A valid API key is required

Properties
messagestring

The error message.

codenumber

The HTTP status code.

403
errorobject

Product API is disabled

Properties
messagestring

The error message.

codenumber

The HTTP status code.

404
errorobject

Task not found

Properties
messagestring

The error message.

codenumber

The HTTP status code.

429
errorobject

Too many requests

Properties
messagestring

The error message.

codenumber

The HTTP status code.

500
errorobject

Unable to complete the request

Properties
messagestring

The error message.

codenumber

The HTTP status code.

curl "https://openaiimage.com/v1/tasks/d3a7b249c28a1e05f9210d16af47c86809a58cad92a36fc91138da677be03245" \
  -H "Authorization: Bearer sk_sd_example"
{
  "task_id": "d3a7b249c28a1e05f9210d16af47c86809a58cad92a36fc91138da677be03245",
  "status": "processing",
  "credits_used": 5,
  "outputs": []
}