Skip to main content
POST
/
v1
/
midjourney
/
generations
/
modal
curl --request POST \
  --url https://api.apimart.ai/v1/midjourney/generations/modal \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "task_id": "task_01KQW1N9T6E3AHW6QZFDEK8M5C",
    "prompt": "replace the selected area with a red leather sofa",
    "mask_url": "https://example.com/mask.png",
    "speed": "fast"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
    }
  ]
}
curl --request POST \
  --url https://api.apimart.ai/v1/midjourney/generations/modal \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "task_id": "task_01KQW1N9T6E3AHW6QZFDEK8M5C",
    "prompt": "replace the selected area with a red leather sofa",
    "mask_url": "https://example.com/mask.png",
    "speed": "fast"
  }'
{
  "code": 200,
  "data": [
    {
      "status": "submitted",
      "task_id": "task_01KV52C0TEJSYZMCG0NCS4YWKK"
    }
  ]
}
Complete a MODAL-state inpaint task by supplying a mask + prompt. The system auto-detects the mode by whether mask_url is present: with mask_url → inpaint (local repaint); without → outpaint (expand).
ItemValue
actionMODAL
Billingmidjourney@modal[-speed]
Requiredtask_id
Optionalprompt, mask_url, speed, metadata

Parameters

FieldDescription
task_idLocal task id returned by the inpaint step (must be in MODAL state)
promptInpaint prompt; if empty, inherits the parent task’s prompt
mask_urlMask image URL or base64; required for inpaint (local repaint). White = the area to repaint, transparent = keep the original
speedrelax / fast / turbo
metadataOptional custom metadata

Mask requirements

ItemRecommendation
FormatPNG with transparent background (also accepts data:image/png;base64,...)
ResolutionPreferably same as the parent image (the system also auto-resizes)
White areaThe area to repaint; transparent areas keep the original
Size≤ 12 MiB per image
URLMust be publicly reachable (private addresses are blocked by SSRF)

Request example

{
  "task_id": "task_01KQW1N9T6E3AHW6QZFDEK8M5C",
  "prompt": "replace the selected area with a red leather sofa",
  "mask_url": "https://example.com/mask.png",
  "speed": "fast"
}

Response

The task_id stays the same (same task); its status goes from MODALSUBMITTED. Poll GET /v1/tasks/{task_id}; on SUCCESS image_urls holds 4 inpaint candidates. Billing settles on this endpoint’s SUCCESS and is not double-charged with the inpaint step. To price by speed, configure midjourney@modal-fast / midjourney@modal-turbo.