> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xingchaoyiqing.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT Image 2: Query Image Generation Task and Result

> GET /kyyReactApiServer/v1/result/{id} — Poll a GPT Image 2 task for status and result. Returns image_url on completion. URLs expire in 24 hours.

After creating a GPT Image 2 generation task, poll this endpoint with the task ID to check progress and retrieve the generated image URL when the task is complete. Because generation is asynchronous, you'll need to call this endpoint periodically until the task reaches a terminal state (`completed` or `failed`).

## Base URL

```
https://zcbservice.aizfw.cn/kyyReactApiServer
```

## Endpoint

```
GET /v1/result/{id}
```

## Authentication

Include your API key as a Bearer token in the `Authorization` header on every request:

```
Authorization: Bearer YOUR_API_KEY
```

***

## Path Parameters

<ParamField path="id" type="string" required>
  The task ID returned by the [Create Image Task](/api-reference/image/gpt-image2-create) endpoint. Example: `image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd`.
</ParamField>

***

## Response Fields

<ResponseField name="id" type="string">
  The unique task ID for this generation job.
</ResponseField>

<ResponseField name="object" type="string">
  The object type. Always `image.generation`.
</ResponseField>

<ResponseField name="created" type="integer">
  Unix timestamp indicating when the task was created.
</ResponseField>

<ResponseField name="model" type="string">
  The model name used for this generation task.
</ResponseField>

<ResponseField name="status" type="string">
  The current task status.

  | Value        | Meaning                                             |
  | ------------ | --------------------------------------------------- |
  | `queued`     | Task is waiting in the queue                        |
  | `processing` | Task is actively being processed                    |
  | `completed`  | Generation succeeded — `image_url` is now available |
  | `failed`     | Generation failed — see the `error` field           |
</ResponseField>

<ResponseField name="image_url" type="string">
  The URL of the generated image. Only present (and non-null) when `status` is `completed`. Image URLs are valid for **24 hours** — download and store the image promptly.
</ResponseField>

<ResponseField name="error" type="string">
  An error message describing what went wrong. Only present when `status` is `failed`.
</ResponseField>

***

## Status Flow

Tasks move through the following states in order. Once a task reaches `completed` or `failed`, it will not change again.

```
queued  →  processing  →  completed
                       ↘  failed
```

| Stage        | Description                                                    |
| ------------ | -------------------------------------------------------------- |
| `queued`     | Task has been created and is waiting for a worker              |
| `processing` | A worker has picked up the task and is generating your image   |
| `completed`  | Image generation succeeded — retrieve the URL from `image_url` |
| `failed`     | Image generation failed — retrieve the reason from `error`     |

***

## Code Example

```bash cURL theme={null}
curl -X GET https://zcbservice.aizfw.cn/kyyReactApiServer/v1/result/image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Response: Processing

```json theme={null}
{
  "id": "image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd",
  "object": "image.generation",
  "created": 1774836724,
  "model": "gpt-image-2",
  "status": "processing",
  "image_url": null,
  "error": null
}
```

### Response: Completed

```json theme={null}
{
  "id": "image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd",
  "object": "image.generation",
  "created": 1774836724,
  "model": "gpt-image-2",
  "status": "completed",
  "image_url": "https://cdn.example.com/generated/image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd.png",
  "error": null
}
```

### Response: Failed

```json theme={null}
{
  "id": "image_fd35ee52-2a98-44a6-b930-29a88ce9b8fd",
  "object": "image.generation",
  "created": 1774836724,
  "model": "gpt-image-2",
  "status": "failed",
  "image_url": null,
  "error": "Generation failed: content policy violation"
}
```

***

<Warning>
  **Image URLs expire in 24 hours.** Once `status` is `completed`, download and save the image to your own storage immediately. After expiry, the URL will become inaccessible and the image cannot be recovered.
</Warning>

<Tip>
  **Polling strategy:** Request the status every **2–5 seconds**. Stop polling as soon as `status` is either `completed` or `failed` — further requests after a terminal state will return the same response without change.
</Tip>
