ApiframeApiframe Docs
Follow-up ActionsMidjourney

Outpaint

Zoom out of an upsampled Midjourney image, extending the canvas in all directions.

POST /v2/images/midjourney/actionaction: "outpaint"

Equivalent to Midjourney's Zoom Out 1.5x / 2x buttons: keeps the upsampled image as-is and generates new content around it, as if the camera zoomed out. The result is a fresh 4-image grid of candidates, each of which can be upsampled again.

Request

ParameterTypeRequiredDescription
parentJobIdstring (uuid)YesID of the completed upsample job to act on
actionstringYes"outpaint"
zoomRationumberYes1.5 (Zoom Out 1.5x) or 2 (Zoom Out 2x)
webhookUrlstringNoHTTPS URL that receives a JSON POST when the job reaches a subscribed event — see Webhooks for payload formats
webhookEventsstring[]NoEvents to be notified about: "progress", "completed", "failed". Defaults to ["completed", "failed"] when webhookUrl is set

The parent must be a completed upsample action job — outpainting a 4-up grid directly returns 400; upsample one image first.

Credits

16 credits per outpaint.

Example result

Once the job is COMPLETED, the result object on GET /v2/jobs/:id contains a new 4-image grid:

{
  "images": [
    "https://cdn2.apiframe.ai/images/b2c3d4e5-...-1.png",
    "https://cdn2.apiframe.ai/images/b2c3d4e5-...-2.png",
    "https://cdn2.apiframe.ai/images/b2c3d4e5-...-3.png",
    "https://cdn2.apiframe.ai/images/b2c3d4e5-...-4.png"
  ],
  "gridUrl": "https://cdn2.apiframe.ai/images/b2c3d4e5-...-grid.png"
}

Code examples

curl -X POST https://api.apiframe.ai/v2/images/midjourney/action \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "parentJobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "action": "outpaint",
    "zoomRatio": 2
  }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/images/midjourney/action",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "parentJobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "action": "outpaint",
        "zoomRatio": 2,
    },
)
print(response.json())
const response = await fetch("https://api.apiframe.ai/v2/images/midjourney/action", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    parentJobId: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    action: "outpaint",
    zoomRatio: 2,
  }),
});
console.log(await response.json());
body := `{
  "parentJobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "action": "outpaint",
  "zoomRatio": 2
}`
req, _ := http.NewRequest("POST", "https://api.apiframe.ai/v2/images/midjourney/action",
    strings.NewReader(body))
req.Header.Set("X-API-Key", "afk_your_api_key_here")
req.Header.Set("Content-Type", "application/json")

resp, err := http.DefaultClient.Do(req)

Try it

POST/v2/images/midjourney/actionTry it

On this page