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, and reroll.
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 | POST | /mj/submit/change |
| Short action syntax | POST | /mj/submit/simple-change |
| Retrieve task | GET | /mj/task/{id}/fetch |
Text-to-Image
http
POST /mj/submit/imagineParameters
| Parameter | Required | Description |
|---|---|---|
prompt | Yes | Image prompt |
Example
bash
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
json
{
"code": 1,
"description": "submit success",
"result": "mj-task-id"
}Save result and poll the retrieve endpoint.
Retrieve Task
http
GET /mj/task/{id}/fetchbash
curl https://cubicspaces.cloud/mj/task/mj-task-id/fetch \
-H "Authorization: Bearer YOUR_API_KEY"Response Example
json
{
"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
},
{
"image_url": "https://example.com/generated-2.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.
http
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use VARIATION |
index | Yes | Image index, from 1 to 4 |
bash
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.
http
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use UPSCALE |
index | Yes | Image index, from 1 to 4 |
bash
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.
http
POST /mj/submit/change| Parameter | Required | Description |
|---|---|---|
taskId | Yes | Original task ID |
action | Yes | Use REROLL |
bash
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"
}'Short Action Syntax
You can also call /mj/submit/simple-change with a compact command:
bash
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, and reroll must reference an original task accessible to the same account.
- The API currently supports
mj_imagine,mj_variation,mj_upscale, andmj_reroll.