ApiframeApiframe Docs
Follow-up ActionsMidjourney

Pan

Extend an upsampled Midjourney image's canvas in one direction.

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

Equivalent to Midjourney's ⬅️ ➡️ ⬆️ ⬇️ pan arrows: keeps the upsampled image and extends the canvas in the chosen direction, generating new content in the added space. 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"pan"
directionstringYes"up", "down", "left", or "right"
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 — panning a 4-up grid directly returns 400; upsample one image first.

Note that panned results are no longer square: the grid images take on the extended aspect ratio.

Credits

16 credits per pan.

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": "pan",
    "direction": "left"
  }'
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": "pan",
        "direction": "left",
    },
)
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: "pan",
    direction: "left",
  }),
});
console.log(await response.json());
body := `{
  "parentJobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "action": "pan",
  "direction": "left"
}`
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