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

# Jimeng Official Format Query Task

> Use `POST /jm` to query the status and result of Jimeng official format tasks.

# Jimeng Official Format Query Task

The task query API for Jimeng official format, used to query the status and result of image generation tasks.

* The route entry is `POST /jm`.
* `Action` and `Version` query parameters are required in the URL.
* Specify the task to query through `task_id` in the Body.
* Returns the task status (`generating`, `success`, `failed`) and image download URLs.

## Method and Path

```http theme={null}
POST /jm?Action=CVSync2AsyncGetResult&Version=2022-08-31
```

## Request Example

<CodeGroup>
  ```bash theme={null}
  curl -X POST "https://octopusx.ai/jm?Action=CVSync2AsyncGetResult&Version=2022-08-31" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{
      "req_key": "jimeng_t2i_v40",
      "task_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
      "req_json": "{\"return_url\": true}"
    }'
  ```

  ```python theme={null}
  import requests
  import json

  resp = requests.post(
      "https://octopusx.ai/jm",
      headers={
          "Authorization": "Bearer YOUR_API_KEY",
          "Content-Type": "application/json",
          "Accept": "application/json",
      },
      params={
          "Action": "CVSync2AsyncGetResult",
          "Version": "2022-08-31",
      },
      json={
          "req_key": "jimeng_t2i_v40",
          "task_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
          "req_json": json.dumps({"return_url": True}),
      },
      timeout=60,
  )
  print(resp.json())
  ```
</CodeGroup>

## Response Example

### Generating

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 10000,
    "data": {
      "binary_data_base64": [],
      "image_urls": null,
      "status": "generating"
    },
    "message": "Success",
    "request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
    "status": 10000,
    "time_elapsed": "35.381µs"
  }
  ```
</ResponseExample>

### Generation Successful

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 10000,
    "data": {
      "binary_data_base64": [],
      "image_urls": [
        "https://example.com/generated-image-1.png",
        "https://example.com/generated-image-2.png"
      ],
      "status": "success"
    },
    "message": "Success",
    "request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
    "status": 10000,
    "time_elapsed": "2.5s"
  }
  ```
</ResponseExample>

### Generation Failed

<ResponseExample>
  ```json 200 theme={null}
  {
    "code": 10001,
    "data": {
      "binary_data_base64": [],
      "image_urls": null,
      "status": "failed"
    },
    "message": "Task failed",
    "request_id": "67fb9e82-126e-4c71-bb16-a3bb3789e3b7",
    "status": 10001,
    "time_elapsed": "1.2s"
  }
  ```
</ResponseExample>

## Authentication

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Query Parameters

<ParamField query="Action" type="string">
  Operation type. Fixed value: `CVSync2AsyncGetResult` (query result).
</ParamField>

<ParamField query="Version" type="string">
  API version. Fixed value: `2022-08-31`.
</ParamField>

## Body

<ParamField body="req_key" type="string" required>
  Service identifier. Fixed value: `jimeng_t2i_v40`.
</ParamField>

<ParamField body="task_id" type="string" required>
  Task ID. The `task_id` returned when the task was created.
</ParamField>

<ParamField body="req_json" type="string" required>
  A JSON-serialized string. Currently supports watermark configuration and whether to return image links; this can be added in the response result. For example: `{"return_url": true}`.
</ParamField>

## Response

<ResponseField name="code" type="integer">
  Status code. `10000` indicates success.
</ResponseField>

<ResponseField name="data" type="object">
  Response data container.
</ResponseField>

<ResponseField name="data.binary_data_base64" type="array">
  An array of Base64-encoded images.
</ResponseField>

<ResponseField name="data.image_urls" type="array | null">
  An array of image URLs. Returned when `return_url: true` is set in `req_json`.
</ResponseField>

<ResponseField name="data.status" type="string">
  Task status. Possible values: `generating` (generating), `success` (success), `failed` (failed).
</ResponseField>

<ResponseField name="message" type="string">
  Status message.
</ResponseField>

<ResponseField name="request_id" type="string">
  Request ID.
</ResponseField>

<ResponseField name="status" type="integer">
  Status code.
</ResponseField>

<ResponseField name="time_elapsed" type="string">
  Request duration.
</ResponseField>

## Related APIs

* [Jimeng Image Overview](./overview)
* [Image Generation](./generation)
* [Image Editing](./edit)
* [Official Format Image Generation](./official-generation)
