Skip to Content
Cheapest Imagen
API reference

Get task

Gets the state of one asynchronous request by its task id: `in_progress`, then `succeeded` with the images or `failed` with the error. A task can be read for as long as its images are kept, 72 hours. Poll every few seconds; reading a task does not count as a request in progress. To wait for several tasks, use `GET /images/tasks?ids=` and read them in one call.

GET
/images/tasks/{id}

Gets the state of one asynchronous request by its task id: in_progress, then succeeded with the images or failed with the error. A task can be read for as long as its images are kept, 72 hours. Poll every few seconds; reading a task does not count as a request in progress. To wait for several tasks, use GET /images/tasks?ids= and read them in one call.

Authorization

apiKey
headerAuthorizationBearer <token>

Your API key, sent as Authorization: Bearer <key>.

Path Parameters

id*string

The task id: the id of the 202 answer, which is also its x-request-id.

Match^req_[0-9a-f]{24}$

Response Body

The task.

application/json
  1. response
id*string

The task id: the id of the 202 answer, which is also its x-request-id.

object*"image.task"
Value in"image.task"
status*string

in_progress until the request ends, then succeeded or failed.

Value in"in_progress""succeeded""failed"
created*integer

When the request was accepted, as a Unix timestamp in seconds.

finished*|

When it ended, or null while it is in progress.

model*string
result?

Present when succeeded: what the synchronous call would have returned.

error?

Present when failed: the error the synchronous call would have returned. A failed task is not charged, except a refusal on the Nano Banana stable channels.

Example Request
curl -X GET 'https://api.cheapestimagen.com/v1/images/tasks/string'
Example Response
{  "id": "string",  "object": "image.task",  "status": "in_progress",  "created": 0,  "finished": 0,  "model": "string",  "result": {    "created": 0,    "data": [      {        "b64_json": "string",        "url": "http://example.com"      }    ]  },  "error": {    "message": "string",    "type": "string",    "param": "string",    "code": "string"  }}