Skip to main content
POST
cURL

Authorizations

API-KEY
string
header
required

You can obtain your API key from the Midjourney-api Dashboard.

Body

application/json
prompt
string
required

Text prompt for image generation.

Since this is a reverse-engineered model, it's recommended to include keywords in your prompt such as:
- "draw a xxx"
- "generate a xxx"

Language is not restricted; OpenAI itself supports multilingual models with excellent Chinese support.

Example:

"draw a boy play with a girl"

model
enum<string>

Supported models: gpt-image-2

Available options:
gpt-image-2
Example:

"gpt-image-2"

referImages
string[]

Reference image array

Example:
aspect_ratio
enum<string>

Support model: gpt-image-2

Available options:
- 1:1
- 1:2
- 2:1
- 3:4
- 4:3
- 16:9
- 9:16

Available options:
1:1,
1:2,
2:1,
3:4,
4:3,
16:9,
9:16
Example:

"1:1"

size
enum<string>

Support model: gpt-image-2

Available options: 1K, 4K
Default: 1K

4K is better at keeping other areas unchanged in image editing scenarios

Available options:
1K,
4K
Example:

"1K"

output_size
string

Support model: gpt-image-2. Custom output width and height in WIDTHxHEIGHT format, e.g. "1920x1080". Only takes effect when size is "4K"; ignored for 1K.

A parsed value overrides aspect_ratio. Unparseable values are ignored and the request keeps aspect_ratio sizing.

The server auto-corrects a parsed value:
- both sides snapped to multiples of 16
- longest edge ≤ 3840
- aspect ratio clamped to 1:3–3:1
- total pixels clamped to 655360–8294400

Examples:
- "100x100" → 816x816
- "1920x1080" → 1920x1088
- "5000x100" → 3840x1280
- "10000x10000" → 2880x2880

Example:

"1920x1080"

hookUrl
string

Callback notification URL

Example:

"https://api.example.com/webhook"

Response

Request successful

status
integer
required

Status code:
- 0: success
- 1001: quota not enough
- 1002: concurrency limit, max 30

Example:

0

data
object
required
message
string

Message

Example:

"success"