Skip to content

Midjourney接口文档

Midjourney Image Formats (Midjourney Proxy/Midjourney Proxy Plus)

Section titled “Midjourney Image Formats (Midjourney Proxy/Midjourney Proxy Plus)”

Midjourney is a powerful image generation and editing model that can create, edit, and modify images based on natural language descriptions. By exposing different endpoints, it supports a wide range of image generation and processing tasks.

:arrows_counterclockwise: Workflow Diagram

Section titled “:arrows_counterclockwise: Workflow Diagram”

  1. Initial Task
  2. Imagine: Text-to-image
  3. Blend: Multi-image blending
  4. Describe: Image description
  5. Swap Face: Face replacement
  6. Image Processing
  7. U1-U4: Upscaling
  8. V1-V4: Variation generation
  9. Pan: Image panning
  10. Zoom: Image scaling
  11. Special Workflows
  12. Action + Modal: Operations that require a confirmation dialog
  13. Action direct execution: Operations that do not require a confirmation dialog
  14. Task Management
  15. Get task details
  16. Get image seed
  17. Upload to Discord
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/submit/imagine' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"botType": "MID_JOURNEY",
"prompt": "Cat",
"base64Array": [],
"accountFilter": {
"channelId": "",
"instanceId": "",
"modes": [],
"remark": "",
"remix": true,
"remixAutoConsidered": true
},
"notifyHook": "",
"state": ""
}'

Response example:

{
"code": 1,
"description": "Submitted successfully",
"properties": {},
"result": 1320098173412546
}
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/submit/blend' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"botType": "MID_JOURNEY",
"base64Array": [
"data:image/png;base64,xxx1",
"data:image/png;base64,xxx2"
],
"dimensions": "SQUARE",
"accountFilter": {
"channelId": "",
"instanceId": "",
"modes": [],
"remark": "",
"remix": true,
"remixAutoConsidered": true
},
"notifyHook": "",
"state": ""
}'

Response example:

{
"code": 1,
"description": "Submitted successfully",
"properties": {},
"result": 1320098173412546
}
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/submit/describe' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"botType": "MID_JOURNEY",
"base64": "data:image/png;base64,xxx",
"accountFilter": {
"channelId": "",
"instanceId": "",
"modes": [],
"remark": "",
"remix": true,
"remixAutoConsidered": true
},
"notifyHook": "",
"state": ""
}'

Response example:

{
"code": 1,
"description": "Submitted successfully",
"properties": {},
"result": 1320098173412546
}
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/submit/modal' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"maskBase64": "",
"prompt": "",
"taskId": "14001934816969359"
}'

Response example:

{
"code": 1,
"description": "Submitted successfully",
"properties": {},
"result": 1320098173412546
}
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/insight-face/swap' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"sourceBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RDnYdriP1wsS81kwU8OVs/R3xu8s6bX7+zYnOH8coSqpmRSBjqerjcBlr2OB/lbAf/2Q==",
"targetBase64": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD849k="
}'

Response example:

{
"code": 0,
"description": "string",
"result": "string"
}
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/submit/action' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"chooseSameChannel": true,
"customId": "MJ::JOB::upsample::1::82c51c9d-bc33-4c07-a471-36c3dcb1a6f0",
"taskId": "1728781324658687",
"accountFilter": {
"channelId": "",
"instanceId": "",
"modes": [],
"remark": "",
"remix": true,
"remixAutoConsidered": true
},
"notifyHook": "",
"state": ""
}'

Response example:

{
"code": 1,
"description": "Submitted successfully",
"properties": {},
"result": 1320098173412546
}

Upload Files to Discord :check_mark_button:

Section titled “Upload Files to Discord :check_mark_button:”
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/submit/upload-discord-images' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"base64Array": [],
"filter": {
"channelId": "",
"instanceId": "",
"remark": ""
}
}'

Response example:

{
"code": 0,
"description": "string",
"result": [
"string"
]
}

Query Tasks by ID List :check_mark_button:

Section titled “Query Tasks by ID List :check_mark_button:”
Terminal window
curl --location --request POST 'https://api.4allapi.com/mj/task/list-by-condition' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": []
}'

Response example:

[
{
"action": "IMAGINE",
"buttons": [
{
"customId": "string",
"emoji": "string",
"label": "string",
"style": 0,
"type": 0
}
],
"description": "string",
"failReason": "string",
"finishTime": 0,
"id": "string",
"imageUrl": "string",
"progress": "string",
"prompt": "string",
"promptEn": "string",
"properties": {},
"startTime": 0,
"state": "string",
"status": "NOT_START",
"submitTime": 0
}
]
Terminal window
curl --location --request GET 'https://api.4allapi.com/mj/task/{id}/fetch' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Content-Type: application/json'

Response example:

{
"action": "IMAGINE",
"buttons": [
{
"customId": "string",
"emoji": "string",
"label": "string",
"style": 0,
"type": 0
}
],
"description": "string",
"failReason": "string",
"finishTime": 0,
"id": "string",
"imageUrl": "string",
"progress": "string",
"prompt": "string",
"promptEn": "string",
"properties": {},
"startTime": 0,
"state": "string",
"status": "NOT_START",
"submitTime": 0
}

Get the Image Seed for a Task :check_mark_button:

Section titled “Get the Image Seed for a Task :check_mark_button:”
Terminal window
curl --location --request GET 'https://api.4allapi.com/mj/task/{id}/image-seed' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Content-Type: application/json'

Response example:

{
"code": 0,
"description": "string",
"result": "string"
}
POST /mj/submit/imagine

Create an image from a text prompt.

POST /mj/submit/blend

Blend multiple input images to generate a new image.

POST /mj/submit/describe

Generate a text description from an input image.

POST /mj/submit/modal

Submit modal information for fine-tuning image generation details.

POST /mj/insight-face/swap

Perform face swapping between a source image and a target image.

POST /mj/submit/action

Perform follow-up actions on a generated image, such as upscaling or adjustments.

POST /mj/submit/upload-discord-images

Upload images to the Discord platform.

POST /mj/task/list-by-condition

Query task details by a specified list of task IDs.

GET /mj/task/{id}/fetch

Get task details by task ID.

GET /mj/task/{id}/image-seed

Get the seed value of the image generated for the specified task.

Include the following header to authenticate with your API key:

Authorization: Bearer $API_KEY

Where $API_KEY is your API key.

  • Type: enum string
  • Required: No
  • Default: MID_JOURNEY
  • Options:
    • MID_JOURNEY: Midjourney model
    • NIJI_JOURNEY: Niji Journey model
  • Description: Selects the bot type to use
  • Type: string
  • Required: Yes
  • Description: The text prompt used for image generation
  • Notes:
    • Use clear and specific descriptions
    • You can include artistic style, composition, and other details
    • English and Chinese inputs are supported
  • Type: string array
  • Required: No
  • Description: Base64-encoded image array for image references
  • Format: Each element should be a complete base64 image string, including the MIME type prefix
  • Type: object
  • Required: No
  • Properties:
    • channelId: Channel ID
    • instanceId: Account instance ID
    • modes: Array of account modes; options: RELAX, FAST, TURBO
    • remark: Content included in the remark
    • remix: Whether the account supports remix
    • remixAutoConsidered: Remix auto-submit setting
  • Type: string
  • Required: No
  • Description: Callback URL after the task is completed; if empty, the global notifyHook is used
  • Type: string
  • Required: No
  • Description: Custom state parameter for request tracking
  • Type: string array
  • Required: Yes
  • Description: Base64-encoded array of images to blend
  • Format: Must contain base64 strings for 2-5 images
  • Type: enum string
  • Required: No
  • Options:
    • PORTRAIT: 2:3 aspect ratio
    • SQUARE: 1:1 aspect ratio
    • LANDSCAPE: 3:2 aspect ratio
  • Description: Aspect ratio setting for the output image
  • Type: string
  • Required: Yes
  • Description: Base64-encoded image to be described
  • Format: Complete base64 string, including the MIME type prefix
  • Type: string
  • Required: No
  • Description: Base64-encoded mask image for partial inpainting
  • Type: string
  • Required: No
  • Description: Text prompt for the inpainted area
  • Type: string
  • Required: Yes
  • Description: ID of the original task
  • Type: string
  • Required: Yes
  • Description: Base64-encoded source image for the face
  • Requirement: The image must contain a clear face
  • Type: string
  • Required: Yes
  • Description: Base64-encoded target image
  • Requirement: The image must contain the face to be replaced
  • Type: boolean
  • Required: No
  • Default: false
  • Description: Whether to select an account in the same channel
  • Type: string
  • Required: Yes
  • Description: Action identifier
  • Format: A string in a specific format, such as “MJ::JOB::upsample::1::xxx”
  • Type: string
  • Required: Yes
  • Description: The task ID on which to perform the action
  • Type: string array
  • Required: Yes
  • Description: Array of base64-encoded images to upload
  • Type: object
  • Required: No
  • Properties:
    • channelId: Target channel ID
    • instanceId: Account instance ID
    • remark: Remark information
  • Type: string array
  • Required: Yes
  • Description: List of task IDs to query

All endpoints return a similar response structure:

  • Type: integer
  • Description: Status code
Status CodeDescription
1Submitted successfully
22Task queued
21Invalid parameters
23System error
24Account unavailable
25Insufficient balance
  • Type: string
  • Description: Response message
  • Type: object
  • Description: Extended properties
  • Type: string or array
  • Description: Return value, which may be a task ID or other data
  • Type: enum string
  • Description: Task type
String ValueDescription
IMAGINECreate image
UPSCALEUpscale image
VARIATIONGenerate variations
ZOOMZoom image
PANPan image
DESCRIBEImage description
BLENDBlend images
SHORTENShorten prompt
SWAP_FACEFace replacement
  • Type: array of objects
  • Description: Action buttons that can be executed
Array FieldDescription
customIdAction identifier
emojiButton icon
labelButton text
styleStyle (2=Primary, 3=Green)
typeInternal system type
  • Type: string
  • Description: Task description
  • Type: string
  • Description: Reason the task failed
  • Type: integer
  • Description: Task completion timestamp
  • Type: string
  • Description: Unique task identifier
  • Type: string
  • Description: URL of the generated image
  • Type: string
  • Description: Task progress information
  • Type: string
  • Description: Original prompt
  • Type: string
  • Description: English prompt
  • Type: enum string
  • Description: Task status
String ValueDescription
NOT_STARTNot started
SUBMITTEDSubmitted
MODALModal in progress
IN_PROGRESSIn progress
FAILUREFailed
SUCCESSSuccessful
CANCELCanceled
  • Type: integer
  • Description: Task submission timestamp
  • Type: integer
  • Description: Task start timestamp

When a request encounters a problem, the API returns an error response:

  • 400 Bad Request: Invalid request parameters
  • 401 Unauthorized: API key is invalid or missing
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Resource not found
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Internal server error
{
"code": <error_code>,
"description": "Error description",
"result": null
}