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
| upscale | upsample | |
|---|---|---|
| Midjourney button | U1, U2, U3, U4 | Upscale (Subtle / Creative / 2x / 4x) |
| Input hash | imagine, blend, describe or animate task | upscale task |
| choice | 1-4, image position in the grid | Upscale type, depends on model version |
| Result | One separate image | A 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
/midjourney/v2/upscaleBase 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
| Field | Required | Description |
|---|---|---|
hash | Yes | Hash of a done task of type imagine, describe, animate or blend. |
choice | Yes | Picture number in the grid, 1 to 4. |
webhook_url | No | Where we POST the task when its status changes. |
webhook_type | No | result: 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.
| status | What it means |
|---|---|
sent | we passed the task on for processing |
waiting | Midjourney accepted it and put it in the queue |
progress | it is running, progress goes from 0 to 100 |
done | finished, the output is in result |
error | failed, 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
/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:
| choice | Version |
|---|---|
v8r2_2x_subtle, v8r2_2x_creative | Version 8.2 |
v7_2x_subtle, v7_2x_creative | --v 7 |
v6r1_2x_subtle, v6r1_2x_creative | Version 6.1 |
v6_2x_subtle, v6_2x_creative | Version 6 |
subtle, creative | Also accepted, see the docs |
v5_2x, v5_4x | Upscale (2x) / (4x) for version 5 |
Other methods
| Method | Endpoint (POST /midjourney/v2…) | Input |
|---|---|---|
| Imagine | /imagine | prompt |
| Upscale | /upscale | hash of imagine / blend / describe / animate + choice 1-4 |
| Upsample (Subtle, Creative, 2x, 4x) | /upsample | hash of upscale |
| Variation | /variation | hash of imagine / describe / blend + choice 1-4 |
| Vary (Subtle) / Vary (Strong) | /vary-subtle, /vary-strong | hash of upscale |
| Reroll | /reroll | hash of a task |
| Animate (video) | /animate | hash of upscale + high / low |
| Inpaint (Vary Region) | /inpaint | hash of upscale + mask + prompt |
| Zoom Out | /zoom | hash of upscale + 50 / 75 or prompt |
| Pan | /pan | hash of upscale + direction |
| Blend | /blend | 2-5 image URLs |
| Describe | /describe | image URL |
| Seed | /seed | hash of a task |
| Upload | /upload | PNG / JPG file or URL |
| Info, Speed, Prefer (Remix) | /info, /speed, /prefer | account_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.