Skip to main content
POST
/
mj
/
submit
/
imagine
Imagine (text-to-image)
curl --request POST \
  --url https://openp.ai/mj/submit/imagine
import requests

url = "https://openp.ai/mj/submit/imagine"

response = requests.post(url)

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

fetch('https://openp.ai/mj/submit/imagine', 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/submit/imagine",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);

$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/submit/imagine"

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

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://openp.ai/mj/submit/imagine")
.asString();
require 'uri'
require 'net/http'

url = URI("https://openp.ai/mj/submit/imagine")

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

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

response = http.request(request)
puts response.read_body
Submit a Midjourney text-to-image task (equivalent to Discord’s /imagine).

Request

curl https://openp.ai/mj/submit/imagine \
  -H "Authorization: Bearer $OPENPAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "A futuristic cyberpunk city at night, neon lights, --ar 16:9 --v 6",
    "notifyHook": "https://your-server.com/mj-callback"
  }'

Parameters

FieldTypeRequiredDescription
promptstringGeneration prompt, may include parameters like --ar, --v, --style
base64ArrayarrayArray of reference-image base64 (the image prompt attached to /imagine)
notifyHookstringCallback URL; OpenPAI POSTs the task result when it completes
statestringCustom pass-through field, returned verbatim in the callback
botTypestringMID_JOURNEY (default) or NIJI_JOURNEY

Response

{
  "code": 1,
  "description": "Submitted",
  "result": "1737200000000000",
  "properties": {}
}
result is the task ID — use it later to query progress or submit U/V actions.
codeMeaning
1Submitted successfully
21An identical task already exists (will be reused)
22The task entered the queue
-1Submission failed, see description

Query the task

See Fetch.

Follow-up actions (U/V/Reroll)

See Change.

Billing

A fixed charge per number of tasks + action type, tied to the upstream Midjourney subscription price. Failed tasks (no callback or an upstream error) are not billed.