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",
  "hookUrl": "https://api.example.com/webhook"
}
'
{
  "status": 0,
  "data": {
    "taskId": "MtAd7mCuc4YqK_a1iAQSW"
  },
  "message": "success"
}

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"

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"