Skip to main content
POST
/
gpt
/
v1
/
generations
cURL
curl --request POST \
  --url https://api.midjourney-api.com/gpt/v1/generations \
  --header 'API-KEY: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "draw a boy play with a girl",
  "model": "gpt-image-2",
  "referImages": [
    "https://example.com/image.png",
    "https://example.com/image.png"
  ],
  "aspect_ratio": "1:1",
  "size": "1024x1024",
  "hookUrl": "https://api.example.com/webhook"
}
'
{
  "status": 0,
  "data": {
    "taskId": "MtAd7mCuc4YqK_a1iAQSW"
  },
  "message": "success"
}

Documentation Index

Fetch the complete documentation index at: https://docs.midjourney-api.com/llms.txt

Use this file to discover all available pages before exploring further.

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", 'draw 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:
[
"https://example.com/image.png",
"https://example.com/image.png"
]
aspect_ratio
enum<string>

Support model: gpt-image-2; Available options: 1:1, 3:4, 4:3, 16:9, 9:16

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

"1:1"

size
string

Image Size (width × height), Must meet the following constraints: Both width and height must be multiples of 16, Maximum edge ≤ 3840, Aspect ratio ≤ 3:1, Total pixels: 655,360 ~ 8,294,400, If the input size is invalid, it will be automatically adjusted to a valid range

Example:

"1024x1024"

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 10

Example:

0

data
object
required
message
string

Message

Example:

"success"