task_id after accepting the request. You hold this task_id directly and can query this interface with it when needed, without needing to pass a custom trace_id (only required if you want to associate it with your own business identifier).
Tasks will only be persisted if the original image request includes a callback_url. Requests made in synchronous (non-callback) mode will not be stored.
Application Process
The OpenAI Tasks API shares authorization with existing OpenAI services. If you have already applied for OpenAI Images Generations, you can directly use the same token to call this interface without additional application. New users have a free quota for their first application.Interface Address
action:
Request Headers
accept: application/jsonauthorization: Bearer {token}content-type: application/json
Single Task Query (retrieve)
Request Body
At least one of
id and trace_id must be provided. Generally, you can directly use the id from the submission response; trace_id should only be passed if you want to associate it with a custom business identifier.
Code Example
CURL
Python
Response Example
When the task exists:Field Descriptions
id: The task ID generated when the original image request is accepted.trace_id: The custom tracking identifier passed in the original request, facilitating association with client business.type: Task type. Tasks written for thegpt-imageseries (e.g.,gpt-image-2) areimages;gpt-image-1, nano-banana, etc., useimages_generations/images_edits, and some chat interfaces arechat_completions_image.request: The complete request body of the original request.response: The final response body returned upon callback completion.created_at/started_at/finished_at: Unix timestamps (seconds, floating point).elapsed: Execution time (seconds, floating point).application_id/user_id/credential_id: The application, end user, and credential ID.
Batch Query (retrieve_batch)
Request Body
You can pass one of
ids / trace_ids / application_id / user_id or created_at_* time window.
CURL Example
Response Example
End-to-end Example: Submit and Poll
The Tasks API mainly serves asynchronous processes in callback mode. In callback mode, the submission interface will immediately return atask_id (i.e., task ID), and then you only need to directly use this task_id to poll the Tasks interface, without needing to generate a trace_id yourself.
Notes
- The Tasks interface itself does not incur charges, so you can poll with peace of mind. Only the original image generation/editing requests will incur charges.
- Task records will only be written if the original request includes a
callback_url; synchronous calls will not generate queryable tasks. - Task records that exceed the platform’s retention period may be cleared.

