Docs / Image Series / Midjourney
Midjourney API Overview
Midjourney MJ Proxy-compatible API: endpoints, actions, per-call pricing, task states and error codes.
Overview#
The Midjourney API is compatible with the MJ Proxy protocol and covers the full set of actions: text-to-image, image-to-text, blends, upscales, variations, panning, inpainting, and video. All endpoints require Bearer token authentication and use an asynchronous task model: submissions return a task ID which you poll for results.
- Submission endpoints live under
/mj/submit/*; queries useGET /mj/task/:id/fetch - Each action maps to a billing model (
mj_imagine,mj_describe, ...) billed per call - Button interactions on results (upscale, variation, ...) are submitted through the
actionfield of/mj/submit/change
Quick Start#
Text-to-image:
curl --request POST \
--url https://api.apimax.ai/mj/submit/imagine \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "a cute cat sitting on the grass --ar 16:9"
}'Response:
{
"code": 1,
"description": "Submit success",
"result": "1791517439018579"
}result is the task ID. Poll the task for progress and results:
curl 'https://api.apimax.ai/mj/task/1791517439018579/fetch' \
--header 'Authorization: Bearer <token>'When the task finishes, imageUrl holds the 4-grid result image and buttons lists the available follow-up interactions (their customId is used for subsequent action submissions).
Submission Endpoints#
| Endpoint | Description | Billing model |
|---|---|---|
POST /mj/submit/imagine | Text-to-image; generates 4 candidates per prompt | mj_imagine |
POST /mj/submit/describe | Image-to-text; reverse-engineers a prompt from an image | mj_describe |
POST /mj/submit/blend | Blends 2–5 images | mj_blend |
POST /mj/submit/shorten | Analyzes and shortens a prompt | mj_shorten |
POST /mj/submit/change | Follow-up actions (upscale/variation/zoom, see below) | per action |
POST /mj/submit/modal | Submits modal interaction results (inpaint, etc.) | mj_modal |
POST /mj/submit/upload-discord-images | Uploads custom base images | mj_upload |
POST /mj/submit/video | Image-to-video | mj_video |
POST /mj/submit/edits | Image editing | mj_edits |
GET /mj/task/:id/fetch | Fetch a single task | not billed |
POST /mj/task/list-by-condition | Query tasks by condition | not billed |
Actions supported by change#
The request body carries action plus customId (from the result's buttons):
| action | Description | Billing model |
|---|---|---|
UPSCALE | Upscales the selected image | mj_upscale |
VARIATION | Subtle variation | mj_variation |
HIGH_VARIATION / LOW_VARIATION | Strong / subtle variation | mj_high_variation / mj_low_variation |
REROLL | Re-rolls the same prompt | mj_reroll |
ZOOM | Zooms out (outpaints) | mj_zoom |
CUSTOM_ZOOM | Custom zoom (submission is free; billed on modal submit) | mj_custom_zoom |
PAN | Extends the image in a direction | mj_pan |
INPAINT | Inpainting (submission is free; billed on modal submit) | mj_inpaint |
Actions and Pricing#
All actions are billed per call (fast mode by default):
| Billing model | Action | Price |
|---|---|---|
mj_imagine | Text-to-image | ¥0.288/call |
mj_describe | Image-to-text | ¥0.036/call |
mj_blend | Blend | ¥0.288/call |
mj_shorten | Prompt analysis | ¥0.288/call |
mj_upscale | Upscale | ¥0.024/call |
mj_variation / mj_high_variation / mj_low_variation | Variation | ¥0.288/call |
mj_reroll | Reroll | ¥0.288/call |
mj_zoom / mj_custom_zoom | Zoom / outpaint | ¥0.288/call |
mj_pan | Pan | ¥0.288/call |
mj_inpaint | Inpaint (billed on modal submit) | ¥0.288/call |
mj_modal | Modal submit | ¥0.288/call |
mj_edits | Image editing | ¥0.288/call |
mj_upload | Upload base image | ¥0.012/call |
mj_video | Image-to-video | ¥2.304/call |
Task States#
SUBMITTED → IN_PROGRESS → SUCCESS / FAILURE
| State | Description |
|---|---|
SUBMITTED | Submitted, queued |
IN_PROGRESS | Generating; progress is the percentage |
SUCCESS | Finished; imageUrl holds the result image |
FAILURE | Failed; failReason explains why; the charge is refunded automatically |
Result image URLs are hosted upstream and expire after a while — persist them in time. Poll every 5–10 seconds and stop once a terminal state is reached.
Modes#
The default mode is fast. Append --relax (cheaper, slower) or --turbo (faster, pricier) to the prompt to switch modes; billing currently applies the fast rate uniformly regardless of the selected mode.
Error Handling#
| code | Description |
|---|---|
| 1 | Success |
| 4 | Request error: missing or malformed parameters, JSON parsing failure, billing pre-deduction failure (insufficient balance), task not found (task_no_found), etc.; see description for details |
| 30 | Concurrency limit reached; retry later |
| 5 | Other internal errors |

