Midjourney

Midjourney Overview

A summary of Midjourney task submission, task querying, image proxying, and common return codes.

Midjourney Overview

The Midjourney endpoints use their own set of routes and are not mixed with OpenAI Images or the unified video task structure.

  • Task submission mainly uses /mj/submit/* (face swap uses /mj/insight-face/swap)
  • Task querying mainly uses /mj/task/*
  • Public images are available via /mj/image/{id} (gateway addition, not covered by the doc)
  • Submission endpoints include IMAGINE, BLEND, ACTION, MODAL, DESCRIBE, SHORTEN, VIDEO, and SWAP_FACE
  • Task re-operations all go through /mj/submit/action; the action types appear in the query endpoint's action field (UPSCALE, VARIATION, REROLL, ZOOM, PAN, etc.)

Route List

MethodPathDescription
POST/mj/submit/imagineSubmit an Imagine task
POST/mj/submit/blendSubmit a Blend task
POST/mj/submit/actionSubmit an Action task (execute a button action)
POST/mj/submit/modalSubmit a Modal task
POST/mj/submit/describeSubmit a Describe task
POST/mj/submit/shortenSubmit a Shorten task
POST/mj/submit/videoSubmit a Video task
POST/mj/insight-face/swapSubmit a SwapFace task (multipart/form-data)
POST/mj/submit/upload-discord-imagesUpload images to Discord
GET/mj/task/{id}/fetchQuery a single task
POST/mj/task/list-by-conditionBatch query tasks
GET/mj/task/{id}/image-seedQuery the task seed
GET/mj/image/{id}Proxy the task image (not covered by the doc)

Common Return Codes

A typical submission response looks like this:

{
  "code": 1,
  "description": "Submit success",
  "result": "1712158011464906"
}

code values per the doc (code, description, and result are required response fields):

codeDescription
1Submitted successfully
22Queued
23Queue full, please try again later
24prompt may contain sensitive words
otherError

The following status codes are gateway-side additions (not listed in the doc):

codeDescription
21Task already exists, usually meaning one is in progress or a result already exists
4Local parameter validation or gateway processing error
30The current group's load is saturated

The gateway converts some upstream 21 and 22 statuses into success responses. You may therefore see a success response while the task is still effectively "already exists" or "queued". The reliable approach is still to take the task ID from result and query the task status.

Common Field Conventions

FieldDescription
modeDefault RELAX; RELAX slow mode, FAST fast mode. The gateway also has a TURBO billing mode (not listed in the doc)
botTypeBot type: mj = MID_JOURNEY, niji = NIJI_JOURNEY (not present on Imagine or Video)
dimensionsBlend aspect ratio: PORTRAIT (2:3), SQUARE (1:1), LANDSCAPE (3:2)
notifyHookCallback URL; the doc schema writes it as notifyhook, which is equivalent; no callback is made when empty
taskIdID of the original task, used to continue from an existing task
customIdButton action identifier, taken from buttons[].customId in the query response and passed to /mj/submit/action
base64ArrayArray of image Base64 strings
base64Single-image Base64 field for Describe
maskBase64Inpainting mask
stateCustom passthrough field

Suggested Reading Order

  1. Midjourney Task Submission
  2. Midjourney Task Query
  3. Image Series Overview