OmwAIOmwAI
API GuideAPI ReferenceProgramming Tools
Grok Image

Query Result

Grok Image async task result query endpoint

Queries the status and result of a Grok Image async generation task by task ID. After submitting an image generation task, poll this endpoint with the returned task_id until the task finishes.

Task status

  • queued / in_progress: running; progress holds the progress — retry later;
  • completed: done; the data array contains the final image URL (url field);
  • failed: failed; error explains why.

Images are kept for about 2 hours

The returned image URL is temporary (metadata.assetsExpireAt holds the expiry time in Unix seconds); images are kept for about 2 hours and then deleted automatically. Download them before they expire if you need long-term storage.

GET
/v1/images/async/generations/{task_id}

Authorization

BearerAuth

AuthorizationBearer <token>

使用 Bearer Token 认证。 格式: Authorization: Bearer sk-xxxxxx 只能查询当前令牌所属账号下的任务。

In: header

Path Parameters

task_id*string

提交图片生成任务时返回的任务 ID(id / task_id)

Response Body

application/json

application/json

curl -X GET "https://www.omwai.xyz/v1/images/async/generations/task_01J8ABCDEFGHIJKLMNOPQRST"
{
  "id": "task_01J8ABCDEFGHIJKLMNOPQRST",
  "task_id": "task_01J8ABCDEFGHIJKLMNOPQRST",
  "object": "image.task",
  "model": "grok-imagine-2.0",
  "status": "completed",
  "progress": "100%",
  "created_at": 1788256630,
  "completed_at": 1788256720,
  "error": {
    "code": "string",
    "message": "string"
  },
  "data": [
    {
      "url": "string"
    }
  ],
  "metadata": {
    "assetsExpireAt": 1788263830
  }
}
{
  "code": "task_not_exist",
  "message": "string"
}

Note

You can only query tasks created under your own account. Querying a task that does not exist or is not accessible returns 400. Once the images expire, data is empty and the URLs are no longer accessible.

How is this guide?

Last updated on