API method

Zoom Out for Midjourney images via API

All three Zoom Out buttons from Discord are one method, zoom. Which of them runs depends on what you send.

Updated

Which button is which

Midjourney buttonRequest
Zoom Out 2x"choice": 50
Zoom Out 1.5x"choice": 75
Custom Zoom"prompt": "…" without choice

Typical reasons: the subject is cut off by the frame, a banner needs empty space for text, or you want a series of shots where the camera keeps pulling back. Judging by our logs, the softer 1.5x is used more: almost two zooms out of three are 75.

Request

POST/midjourney/v2/zoom

Base URL is https://api.userapi.ai. Every request needs two headers, api-key and Content-Type: application/json.

{
"hash": "6794f6ef-866a-4bc3-b0bc-7b28ec010d1b",
"choice": 50,
"webhook_url": "https://example.com/zoom/webhook-url",
"webhook_type": "result"
}

Parameters

FieldRequiredDescription
hashYesHash of the upscale to zoom out from.
choiceNo50 = Zoom Out 2x, 75 = Zoom Out 1.5x. Required if there is no prompt.
promptNoFor Custom Zoom. Required if there is no choice.
webhook_urlNoWhere we POST the task when its status changes.
webhook_typeNoresult: one call at the end (done or error). progress: also every progress update.

What comes back

The response is just the task hash, e.g. {"hash": "ed162774-9244-4038-bdf1-801b033809ec"}. The finished task is what you later get from GET /midjourney/v2/status?hash=… or in the webhook:

{
"account_hash": "f815cef1-49f2-4819-92c3-8be17d0b8514",
"hash": "15061f02-c54b-41ca-a66a-49da2988d62b",
"choice": 75,
"type": "zoom",
"progress": 100,
"status": "done",
"result": {
"url": "https://cdn.discordapp.com/attachments/...8be17d0b8514.png",
"proxy_url": "https://media.discordapp.net/attachments/...8be17d0b8514.png",
"filename": "...8be17d0b8514.png",
"content_type": "image/png",
"width": 2048,
"height": 2048,
"size": 3354153
},
"status_reason": null,
"created_at": "2023-10-26T09:06:27Z"
}

The result is again a grid of four. To zoom out further, upscale one of them and call zoom with its hash.

statusWhat it means
sentwe passed the task on for processing
waitingMidjourney accepted it and put it in the queue
progressit is running, progress goes from 0 to 100
donefinished, the output is in result
errorfailed, see status_reason

Example with cURL

1. Picture and upscale

curl -X POST https://api.userapi.ai/midjourney/v2/imagine \
-H "Content-Type: application/json" \
-H "api-key: $USERAPI_KEY" \
-d '{"prompt": "a tiny cabin on a cliff, morning fog"}'
curl "https://api.userapi.ai/midjourney/v2/status?hash=IMAGINE_HASH" \
-H "api-key: $USERAPI_KEY"
curl -X POST https://api.userapi.ai/midjourney/v2/upscale \
-H "Content-Type: application/json" \
-H "api-key: $USERAPI_KEY" \
-d '{"hash": "IMAGINE_HASH", "choice": 1}'

2. Zoom Out 2x

curl -X POST https://api.userapi.ai/midjourney/v2/zoom \
-H "Content-Type: application/json" \
-H "api-key: $USERAPI_KEY" \
-d '{"hash": "UPSCALE_HASH", "choice": 50}'

3. Or Custom Zoom with your own prompt

curl -X POST https://api.userapi.ai/midjourney/v2/zoom \
-H "Content-Type: application/json" \
-H "api-key: $USERAPI_KEY" \
-d '{"hash": "UPSCALE_HASH", "prompt": "a tiny cabin on a cliff above a stormy sea --zoom 1.8"}'

Wrappers for Python, Node.js and PHP are on separate pages. If you'd rather not write code, the same methods are available in n8n and Make. This method in the documentation.

Other methods

MethodEndpoint (POST /midjourney/v2…)Input
Imagine/imagineprompt
Upscale/upscalehash of imagine / blend / describe / animate + choice 1-4
Upsample (Subtle, Creative, 2x, 4x)/upsamplehash of upscale
Variation/variationhash of imagine / describe / blend + choice 1-4
Vary (Subtle) / Vary (Strong)/vary-subtle, /vary-stronghash of upscale
Reroll/rerollhash of a task
Animate (video)/animatehash of upscale + high / low
Inpaint (Vary Region)/inpainthash of upscale + mask + prompt
Zoom Out/zoomhash of upscale + 50 / 75 or prompt
Pan/panhash of upscale + direction
Blend/blend2-5 image URLs
Describe/describeimage URL
Seed/seedhash of a task
Upload/uploadPNG / JPG file or URL
Info, Speed, Prefer (Remix)/info, /speed, /preferaccount_hash

Try it on 50 free requests

Register, add a Discord account that has Midjourney, and you get an API key. The first 50 requests are free and you don't need to enter a card. Since 2023 more than 10,000 people have signed up and sent over 8 million requests through the API.

Questions

Why 50 and 75?

50 is Zoom Out 2x, 75 is Zoom Out 1.5x. Those are the values the method expects.

How do I run Custom Zoom?

Send prompt without choice.

Can I zoom a grid straight from imagine?

No, only an upscaled image. Upscale one picture from the grid first.

How do I make a long zoom out sequence?

zoom, upscale one of the four, zoom again, and so on. Every call is a separate request.

See also

Use image generation Magic with UserAPI