Skip to navigation

Poll a generation

Retrieves the current status of an asynchronous generation, and its results once complete. Use the generation_id returned by any /v2 endpoint that runs asynchronously: every video and tool endpoint, and any image endpoint called with async or a webhook_url.

While the generation is pending or has failed, the response contains only generation_id, status, and created (plus failure_reason once failed). Once status is completed, the response includes response_type and data. Each data item carries an object_type that identifies its shape, so image and video results can be told apart. usage_cost_usd_micros reports the amount billed when the request uses variable usage-based pricing.

Polling is rate limited per organization; a 429 response carries a Retry-After header with the number of seconds to wait.

Authentication

Api-Keystring

API key for access control. Use in the header with the name "Api-Key"

Path parameters

generation_idstringRequired

URL-safe base64 ID of the generation, as returned when the request was accepted.

Response

Generation status retrieved successfully.
generation_idstring

URL-safe base64 ID of the generation.

statusenum

Current status of the generation. pending: still in progress; the response contains only generation_id, status, and created. completed: finished successfully; the response includes response_type and data, and may include usage_cost_usd_micros when the request uses variable usage-based pricing. failed: generation did not succeed; the response contains only generation_id, status, and created.

Allowed values:
createddatetime
The time the generation was created.
response_typeenumOptional

Present when status is completed; always "url" for this shape.

Allowed values:
usage_cost_usd_microslongOptional>=0

The total variable usage-based cost charged for the completed request, in millionths of a US dollar. Present only when status is completed and the request uses variable usage-based pricing; omitted otherwise.

failure_reasonstringOptional

A short machine-readable reason the generation failed, for example content_policy_violation. Present only when status is failed.

datalist of objectsOptional

A list of generated images or videos. Present when status is completed. Video entries carry an object_type of video.generation; layerized designs carry layerized_image; entries without an object_type are images.

Errors

400
Bad Request Error
401
Unauthorized Error
404
Not Found Error
429
Too Many Requests Error