Midjourney Proxy
The Midjourney Proxy API submits MJ image jobs and polls them through the task retrieve endpoint. It currently supports text-to-image, variation, upscale, reroll, outpaint, inpaint, Remix, and background removal.
The retrieve endpoint returns generated image results. Read image URLs from images[].image_url.
Endpoints
| Capability | Method | Path |
|---|---|---|
| Text-to-image | POST | /mj/submit/imagine |
| Variation / Upscale / Reroll / Outpaint / Inpaint / Remix / Remove background | POST | /mj/submit/change |
| Short action syntax | POST | /mj/submit/simple-change |
| Retrieve task | GET | /mj/task/{id}/fetch |
Text-to-Image
POST /mj/submit/imagineParameters
| Parameter | Required | Description |
|---|---|---|
prompt | Yes | Image prompt |
Example
curl -X POST https://cubicspaces.cloud/mj/submit/imagine \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "A simple red ceramic mug on a clean white studio background"
}'Response
{
"code": 1,
"description": "submit_success",
"result": "mj-task-id"
}Save result and poll the retrieve endpoint.
Retrieve Task
GET /mj/task/{id}/fetchcurl https://cubicspaces.cloud/mj/task/mj-task-id/fetch \
-H "Authorization: Bearer YOUR_API_KEY"Response Example
{
"extra": {
"has_nsfw_contents": []
},
"task": {
"task_id": "mj-task-id",
"task_type": "MIDJOURNEY_TEXT_TO_IMAGE_FAST_MODE",
"status": "TASK_STATUS_SUCCEED",
"reason": "",
"eta": 0,
"progress_percent": 0
},
"images": [
{
"image_url": "https://example.com/generated-1.png",
"image_url_ttl": "0",
"image_type": "png",
"nsfw_detection_result": null
}
],
"videos": [],
"audios": []
}Statuses
| Status | Meaning |
|---|---|
TASK_STATUS_QUEUED | Queued |
TASK_STATUS_PROCESSING | Processing |
TASK_STATUS_SUCCEED | Completed; read images[].image_url |
TASK_STATUS_FAILED | Failed; inspect task.reason |
Poll every 5 seconds until the task succeeds or fails.
Variation
Variation creates a new image batch based on one image from the original task.
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use VARIATION |
index | Yes | Image index, from 1 to 4 |
prompt | No | Remix prompt |
curl -X POST https://cubicspaces.cloud/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"taskId": "mj-task-id",
"action": "VARIATION",
"index": 1
}'Upscale
Upscale enhances one image from the original task.
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use UPSCALE |
index | Yes | Image index, from 1 to 4 |
curl -X POST https://cubicspaces.cloud/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"taskId": "mj-task-id",
"action": "UPSCALE",
"index": 1
}'Reroll
Reroll regenerates a new batch from the original task.
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use REROLL |
curl -X POST https://cubicspaces.cloud/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"taskId": "mj-task-id",
"action": "REROLL"
}'Outpaint
Outpaint expands the canvas around one image from the original task. action can be ZOOM or OUTPAINT.
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | ZOOM or OUTPAINT |
index | Yes | Image index, from 1 to 4 |
prompt | Yes | Prompt for the expanded area |
scale | Yes | Outpaint scale, usually 1.1 to 2.0 |
curl -X POST https://cubicspaces.cloud/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"taskId": "mj-task-id",
"action": "ZOOM",
"index": 1,
"prompt": "extend the beach and sunset sky",
"scale": 1.2
}'Inpaint
Inpaint regenerates content inside a specified mask.
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use INPAINT |
index | Yes | Image index, from 1 to 4 |
prompt | No | Prompt for the masked area |
mask | Yes | Mask object, using either url or polygon area data. Do not pass a raw base64 string. |
curl -X POST https://cubicspaces.cloud/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"taskId": "mj-task-id",
"action": "INPAINT",
"index": 1,
"prompt": "replace the car with a bicycle",
"mask": {
"url": "https://example.com/mask.png"
}
}'Polygon mask example:
{
"taskId": "mj-task-id",
"action": "INPAINT",
"index": 1,
"prompt": "replace the center area with a glowing blue canvas",
"mask": {
"areas": [
{
"points": [350, 350, 674, 350, 674, 674, 350, 674],
"width": 1024,
"height": 1024
}
]
}
}Remix
Remix adjusts one image from the original task with a new prompt.
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use REMIX |
index | Yes | Image index, from 1 to 4 |
prompt | Yes | New prompt |
mode | No | Remix mode: 0 for strong adjustment, 1 for subtle adjustment. Defaults to 0 |
curl -X POST https://cubicspaces.cloud/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"taskId": "mj-task-id",
"action": "REMIX",
"index": 1,
"prompt": "make it cinematic, night lighting",
"mode": 0
}'Remove Background
Remove background creates a background-removal task for the given image URL. It does not require an original MJ task ID.
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
action | Yes | Use REMOVE_BACKGROUND |
url | Yes | Image URL to process |
curl -X POST https://cubicspaces.cloud/mj/submit/change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"action": "REMOVE_BACKGROUND",
"url": "https://example.com/source.png"
}'Short Action Syntax
You can also call /mj/submit/simple-change with a compact command:
curl -X POST https://cubicspaces.cloud/mj/submit/simple-change \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"content": "mj-task-id U1"
}'Common commands:
| Command | Equivalent action |
|---|---|
mj-task-id U1 | Upscale image 1 |
mj-task-id V1 | Vary image 1 |
mj-task-id R | Reroll |
Notes
indexuses the MJ-style range from1to4.- Action endpoints return a new task ID; poll
/mj/task/{id}/fetchfor the result. - Variation, upscale, reroll, outpaint, inpaint, and Remix must reference an original task accessible to the same account.
- The API currently supports
mj_imagine,mj_variation,mj_upscale,mj_reroll,mj_zoom,mj_outpaint,mj_inpaint,mj_remix, andmj_remove_background.