Skip to main content
GET
/
mj
/
task
/
{id}
/
fetch
Fetch (query task)
curl --request GET \
  --url https://openp.ai/mj/task/{id}/fetch
import requests

url = "https://openp.ai/mj/task/{id}/fetch"

response = requests.get(url)

print(response.text)
const options = {method: 'GET'};

fetch('https://openp.ai/mj/task/{id}/fetch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://openp.ai/mj/task/{id}/fetch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://openp.ai/mj/task/{id}/fetch"

req, _ := http.NewRequest("GET", url, nil)

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://openp.ai/mj/task/{id}/fetch")
.asString();
require 'uri'
require 'net/http'

url = URI("https://openp.ai/mj/task/{id}/fetch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)

response = http.request(request)
puts response.read_body
Get a Midjourney task’s current status, progress and result-image link.

Request

curl https://openp.ai/mj/task/1737200000000000/fetch \
  -H "Authorization: Bearer $OPENPAI_API_KEY"

Response

{
  "id": "1737200000000000",
  "action": "IMAGINE",
  "status": "SUCCESS",
  "progress": "100%",
  "prompt": "A futuristic cyberpunk city at night",
  "promptEn": "A futuristic cyberpunk city at night, neon lights, --ar 16:9 --v 6",
  "description": "Submit success",
  "submitTime": 1715750400000,
  "startTime": 1715750405000,
  "finishTime": 1715750460000,
  "imageUrl": "https://...",
  "failReason": null,
  "properties": {
    "finalPrompt": "A futuristic cyberpunk city...",
    "messageId": "...",
    "discordChannelId": "..."
  },
  "buttons": [
    {"customId": "MJ::JOB::upsample::1::...", "emoji": "", "label": "U1", "style": 2, "type": 2},
    {"customId": "MJ::JOB::variation::1::...", "emoji": "", "label": "V1", "style": 2, "type": 2}
  ]
}

status values

ValueMeaning
NOT_STARTNot started yet
SUBMITTEDSubmitted, waiting on the upstream
IN_PROGRESSGenerating (see the progress field)
SUCCESSSucceeded
FAILUREFailed

buttons

After a Midjourney task completes, the clickable Discord buttons (U1-U4, V1-V4, 🔄) are returned as a buttons array. To perform a button’s action, use change + customId.

Batch query

curl -X POST https://openp.ai/mj/task/list-by-condition \
  -H "Authorization: Bearer $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "ids": ["task1", "task2", "task3"] }'
Returns an array of task objects to reduce the number of polling requests.

Callback vs. polling

  • Callback (notifyHook): OpenPAI proactively POSTs to your service when the task status changes — recommended for production.
  • Polling (fetch): simple but with latency, suited to local scripts.
Example callback request (POST to notifyHook):
{
  "id": "1737200000000000",
  "action": "IMAGINE",
  "status": "SUCCESS",
  "imageUrl": "https://...",
  "state": "<the state passed in at submission>"
}