Midjourney v8.2 / Niji 7 Image Generation API
Generate images asynchronously with midjourney-v8.2 and midjourney-niji-7 through APIMaster.
Midjourney v8.2 / Niji 7 image generation
Use the asynchronous image API at https://apimaster.ai/v1 with either midjourney-v8.2 or midjourney-niji-7. The model ID selects the version; do not add version override fields.
Create a task
POST https://apimaster.ai/v1/midjourney/generations
curl -s "https://apimaster.ai/v1/midjourney/generations" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "midjourney-v8.2",
"prompt": "a quiet Japanese garden at dawn, cinematic composition",
"size": "16:9",
"speed": "relax"
}'
For Niji 7, set model to midjourney-niji-7:
{"model":"midjourney-niji-7","prompt":"anime character under cherry blossoms","size":"9:16","speed":"fast"}
| Field | Type | Required | Description |
|---|---|---|---|
model |
string | Yes | midjourney-v8.2 or midjourney-niji-7 |
prompt |
string | Yes | Image description, including supported Midjourney parameters |
size |
string | No | Aspect ratio such as 1:1 or 16:9; defaults to 1:1 |
speed |
string | No | relax, fast, or turbo; defaults to relax |
image_urls |
string[] | No | 1–20 reference image URLs; supported image Data URLs are also accepted |
iw |
number | No | Reference image weight 0–3; requires image_urls |
quality |
string | No | 0.25, 0.5, 1, or 2; not supported by Niji 7 |
stylize / chaos / weird |
integer | No | Ranges: 0–1000, 0–100, and 0–3000, respectively |
seed |
integer | No | Random seed 0–4294967295 |
negative_prompt |
string | No | Content to exclude |
sref / sw |
string / integer | No | Public style reference URL and weight 0–1000; sw requires sref |
dref / dw |
string or string[] / number | No | Reference URLs (up to 20) and weight 0–100; dw requires dref |
raw / tile / hd |
boolean | No | Raw style, tiling, and HD; tile and hd are v8.2 only |
extra |
string | No | Supported parameter string such as --ar 16:9 --s 750; structured fields take precedence |
metadata |
object | No | Custom business metadata |
repeat |
integer | No | 2–40 to create multiple tasks |
Niji 7 does not support quality, tile=true, or hd=true. Both models reject draft=true, cref, cw, stop, and request fields version and niji. style=raw is normalized to raw=true. Do not use --v or --niji in prompt or extra to override the model version.
The response contains a batch ID and task IDs:
{
"id": "imagine_batch_xxxxxxxx",
"request_id": "req_xxxxxxxx",
"model": "midjourney-v8.2",
"status": "queued",
"data": [{"id": "imagine_xxxxxxxx", "task_id": "imagine_xxxxxxxx", "status": "submitted"}]
}
Check task status
curl -s "https://apimaster.ai/v1/tasks/imagine_batch_xxxxxxxx" \
-H "Authorization: Bearer YOUR_API_KEY"
The completed response includes image URLs in data; tasks contains each child task:
{
"id": "imagine_batch_xxxxxxxx",
"status": "completed",
"progress": 100,
"data": [{"url": "https://example.com/generated.png"}],
"tasks": [{"task_id": "imagine_xxxxxxxx", "status": "completed", "progress": 100, "data": [{"url": "https://example.com/generated.png"}]}]
}
Poll while the status is queued or processing. On failure, read tasks[].error and do not resubmit the same request. Download returned URLs promptly because they may expire.
If submission returns 502 with an X-Task-ID header, or a query returns pending_timeout, save the ID and keep checking its status instead of automatically submitting again. A batch can contain both successful and failed tasks; inspect tasks[] individually. Polling once every 15 seconds is recommended.
Errors and pricing
model and a non-empty prompt are required. Unsupported versions, invalid ratios, inaccessible references, and unsupported parameters return 400. 401 means an invalid key, 402 means insufficient balance, and 429 means rate limiting. See the Midjourney v8.2 card and Niji 7 card for current pricing and routes.
