Skip to main content
POST
/
v1
/
midjourney
/
generations
curl --request POST \
  --url https://api.apimart.ai/v1/midjourney/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "a beautiful sunset over mountains",
    "size": "16:9",
    "version": "6.1",
    "speed": "fast"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
    }
  ]
}
curl --request POST \
  --url https://api.apimart.ai/v1/midjourney/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "prompt": "a beautiful sunset over mountains",
    "size": "16:9",
    "version": "6.1",
    "speed": "fast"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
    }
  ]
}
Default text-to-image / image-guided endpoint, equivalent to imagine. The explicit /v1/midjourney/generations/imagine endpoint behaves the same way.
ItemValue
actionIMAGINE
Billingmidjourney@imagine[-version][-speed]
Requiredprompt
Optionalimage_urls, prompt fields, speed, metadata

Request body

FieldTypeRequiredNotes
promptstringYesPrompt; native MJ flags allowed (e.g. --ar 16:9 --v 6.1)
speedstringNorelax (default) / fast / turbo
image_urlsstring[]NoImage URLs or base64 for image-guided generation
metadataobjectNoCustom metadata saved with the task for business-side tracking

Structured fields (optional)

You can set these in the JSON body or in prompt (e.g. --ar 16:9). Body values override prompt.
FieldTypeMJ equivalentNotes
sizestring--are.g. "16:9", "1:1", "9:16"
qualitystring--q"0.25", "0.5", "1", "2"
stylestring--stylee.g. "raw"
versionstring--vVersion. Main MJ versions append --v <version>; when used with niji: true and "7" / "6", it is normalized as a Niji version
seedint--seedSeed
negative_promptstring--noe.g. "ugly, blurry"
stylizeint--s0–1000
chaosint--c0–100
weirdint--w0–3000
tilebool--tileTile mode
nijibool--nijiNiji switch. Recommended: niji: true + version: "7" / "6"
iwfloat--iw0–3, image weight
cwint--cw0–100
swint--sw0–1000
crefstring--crefCharacter ref URL
srefstring--srefStyle ref URL
drefstring--drefDepth reference image URL
dwfloat--dwDepth weight (0–100)
repeatint--repeat2–40
rawbool--rawRaw style (v5.1+)
draftbool--draftDraft mode (v7+)
hdbool--hdHD mode (v8 / v8.1 only; backend auto-injects --v 8.1 when version is unspecified)
stopint--stopEarly stop (10–100; v5–6.1 / niji 5–6 only)
extrastringany --xxxEscape hatch; appended to prompt verbatim

Examples

All flags in prompt
{
  "prompt": "a beautiful sunset over mountains --ar 16:9 --v 6.1 --style raw --s 750"
}
Structured body (recommended)
{
  "prompt": "a beautiful sunset over mountains",
  "size": "16:9",
  "version": "6.1",
  "style": "raw",
  "stylize": 750
}
Main versions and Niji versions
{
  "prompt": "anime girl in a moonlit garden",
  "niji": true,
  "version": "7",
  "size": "9:16"
}
Verified online versions: 8.1, 7, 6.1, 5.2, 5.1, niji 7, and niji 6. Use body field version for main MJ versions. For Niji, use niji: true + version: "7" / "6"; the billing version is normalized to niji7 / niji6.
Mixed (body wins)
{
  "prompt": "a beautiful sunset --ar 1:1",
  "size": "16:9"
}
Final prompt: a beautiful sunset --ar 16:9 (size in body overrides --ar 1:1 in prompt.)
Image-guided
{
  "prompt": "turn this product into a luxury studio photo",
  "image_urls": ["https://example.com/product.png"],
  "size": "1:1",
  "iw": 1.2
}
Fast mode
{
  "prompt": "a cute cat",
  "speed": "fast"
}
speed=relax or omitted speed does not add a billing speed suffix. fast / turbo are applied through the corresponding speed routes and match the corresponding billing keys.

Response

{
  "code": 200,
  "data": [{
    "status": "submitted",
    "task_id": "task_01JWXXXXXXXXXXXX"
  }]
}
After submission, poll the result via Get task.