> ## 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.

# Midjourney Task Query

> Query Midjourney single tasks, batch tasks, and task image seed.

# Midjourney Task Query

The Midjourney query API is used to poll task progress, retrieve final image information, and read task buttons and seed.

* Single task queries use `GET /mj/task/{id}/fetch`
* Batch queries use `POST /mj/task/list-by-condition`
* Image seed queries use `GET /mj/task/{id}/image-seed`

## Query a Single Task

```http theme={null}
GET /mj/task/{id}/fetch
```

```bash theme={null}
curl https://octopusx.ai/mj/task/1712158011464906/fetch \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Response Fields

<ResponseField name="id" type="string">
  Task ID.
</ResponseField>

<ResponseField name="action" type="string">
  Task action. Common values include `IMAGINE`, `UPSCALE`, `VARIATION`, `ZOOM`, `PAN`, `DESCRIBE`, `BLEND`, `SHORTEN`, `SWAP_FACE`.
</ResponseField>

<ResponseField name="prompt" type="string">
  Original prompt.
</ResponseField>

<ResponseField name="promptEn" type="string">
  English prompt.
</ResponseField>

<ResponseField name="description" type="string">
  Task description.
</ResponseField>

<ResponseField name="submitTime" type="integer">
  Submission time.
</ResponseField>

<ResponseField name="startTime" type="integer">
  Start execution time.
</ResponseField>

<ResponseField name="finishTime" type="integer">
  End time.
</ResponseField>

<ResponseField name="imageUrl" type="string">
  Primary image URL.
</ResponseField>

<ResponseField name="videoUrl" type="string">
  Video URL.
</ResponseField>

<ResponseField name="status" type="string">
  Task status. Common values are `NOT_START`, `SUBMITTED`, `MODAL`, `IN_PROGRESS`, `FAILURE`, `SUCCESS`, `CANCEL`.
</ResponseField>

<ResponseField name="progress" type="string">
  Task progress, for example `0%`, `65%`, `100%`.
</ResponseField>

<ResponseField name="failReason" type="string">
  Reason for failure.
</ResponseField>

<ResponseField name="buttons" type="array<object> | null">
  Array of action buttons that can still be triggered below the image.
</ResponseField>

<ResponseField name="state" type="string">
  Custom parameter.
</ResponseField>

<ResponseField name="imageUrls" type="array<object> | array<string>">
  Image list.
</ResponseField>

### Response Example

<ResponseExample>
  ```json 200 - In Progress theme={null}
  {
    "id": "1712158011464906",
    "action": "IMAGINE",
    "prompt": "Cat",
    "promptEn": "Cat",
    "description": "Submit success",
    "submitTime": 1735689600000,
    "startTime": 1735689610000,
    "finishTime": 0,
    "imageUrl": "",
    "videoUrl": "",
    "status": "IN_PROGRESS",
    "progress": "65%",
    "failReason": "",
    "buttons": null,
    "state": "",
    "imageUrls": []
  }
  ```

  ```json 200 - Completed theme={null}
  {
    "id": "1712158011464906",
    "action": "IMAGINE",
    "prompt": "Cat",
    "promptEn": "Cat",
    "description": "success",
    "submitTime": 1735689600000,
    "startTime": 1735689610000,
    "finishTime": 1735689720000,
    "imageUrl": "https://.../image.png",
    "videoUrl": "",
    "status": "SUCCESS",
    "progress": "100%",
    "failReason": "",
    "buttons": [
      {
        "customId": "MJ::JOB::upsample::1::xxx",
        "emoji": "",
        "label": "U1",
        "type": 2,
        "style": 2
      }
    ],
    "state": "",
    "imageUrls": [
      {
        "url": "https://.../image.png"
      }
    ]
  }
  ```
</ResponseExample>

## Query Tasks in Batch

```http theme={null}
POST /mj/task/list-by-condition
```

```json theme={null}
{
  "ids": [
    "1712158011464906"
  ]
}
```

The return value is an array of task objects, and the fields are basically the same as those in the single task query.

## Get Task Image Seed

```http theme={null}
GET /mj/task/{id}/image-seed
```

```json theme={null}
{
  "code": 1,
  "description": "",
  "result": "1234567890"
}
```

## Get Public Image

```http theme={null}
GET /mj/image/{id}
```

This endpoint proxies the task image and is suitable for directly downloading the final image:

```bash theme={null}
curl -L https://octopusx.ai/mj/image/1712158011464906 --output output.png
```

## Related Endpoints

* [Midjourney Overview](/en/images/midjourney/overview)
* [Midjourney Task Submission](/en/images/midjourney/submit)
