API method

Upscaling Midjourney images via API

In Midjourney "upscale" means two different things, so the API has two methods for it. upscale is the U1-U4 buttons under a grid. upsample is Upscale (Subtle), (Creative), (2x) and (4x) on an image that is already upscaled.

Updated

upscale and upsample side by side

upscaleupsample
Midjourney buttonU1, U2, U3, U4Upscale (Subtle / Creative / 2x / 4x)
Input hashimagine, blend, describe or animate taskupscale task
choice1-4, image position in the gridUpscale type, depends on model version
ResultOne separate imageA larger, more detailed version of that image

You will need upscale almost always anyway: Vary, Zoom, Pan, Inpaint and Animate only take the hash of an upscale task.

A small observation from our logs: the first picture of the grid is upscaled far more often than the others, 43% of the time against 17-20% for each of the other three. Probably because many integrations simply always take the first one. If you show the grid to people, let them pick.

Request

POST/midjourney/v2/upscale

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": 1,
"webhook_url": "https://example.com/upscale/webhook-url",
"webhook_type": "result"
}

Parameters

FieldRequiredDescription
hashYesHash of a done task of type imagine, describe, animate or blend.
choiceYesPicture number in the grid, 1 to 4.
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": "a7d44910-88a6-4673-acc8-d60ffc3479a6",
"hash": "2c8abb2d-5f4d-4c55-8830-102a4fe754ed",
"choice": 3,
"type": "upscale",
"status": "done",
"result": {
"url": "https://cdn.discordapp.com/...039b7de3d18f.png",
"proxy_url": "https://media.discordapp.net/...039b7de3d18f.png",
"filename": "...039b7de3d18f.png",
"content_type": "image/png",
"width": 1024,
"height": 1024,
"size": 1512812
},
"status_reason": null,
"created_at": "2006-01-02T15:04:05+00:00"
}

Upscale has no progress, the status goes straight to done or error. There is no account_hash in the request: an upscale can only run on the account that made the grid.

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. Grid

curl -X POST https://api.userapi.ai/midjourney/v2/imagine \
-H "Content-Type: application/json" \
-H "api-key: $USERAPI_KEY" \
-d '{"prompt": "a vintage camera on a wooden table --v 7"}'

2. U2

Once imagine is done:

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": 2}'

3. Upscale (Subtle) for a v7 image

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

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.

upsample

POST/midjourney/v2/upsample
{
"hash": "6794f6ef-866a-4bc3-b0bc-7b28ec010d1b",
"choice": "v7_2x_subtle",
"webhook_url": "https://example.com/upsample/webhook-url",
"webhook_type": "result"
}

hash is a finished upscale. Which choice to send depends on the model version the picture was made with:

choiceVersion
v8r2_2x_subtle, v8r2_2x_creativeVersion 8.2
v7_2x_subtle, v7_2x_creative--v 7
v6r1_2x_subtle, v6r1_2x_creativeVersion 6.1
v6_2x_subtle, v6_2x_creativeVersion 6
subtle, creativeAlso accepted, see the docs
v5_2x, v5_4xUpscale (2x) / (4x) for version 5

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

What's the difference between upscale and upsample?

upscale takes one picture out of the grid of four (U1-U4). upsample makes that picture bigger and more detailed: Subtle, Creative, 2x or 4x.

Which upsample choice do I need?

It depends on the version: v8r2_2x_subtle / v8r2_2x_creative for 8.2, v7_2x_subtle / v7_2x_creative for --v 7, v6r1_* for 6.1, v6_* for 6, v5_2x / v5_4x for 5. The upscale result also lists the available options in next_actions.

Does upscale work on video?

Yes, in the sense that upscale with the hash of an animate task and choice 1-4 gives you one of the four animations as a separate file.

Can I choose the account for an upscale?

No. Midjourney only lets the account that made the grid upscale it, so we always run it there.

See also

Use image generation Magic with UserAPI