API method

Midjourney blend via API

Same thing as /blend in Discord: you give Midjourney two to five pictures, it mixes them and returns a grid of four new images. No text prompt needed.

Updated

When it comes in handy

  • A product photo plus a picture whose style or background you want.
  • Two characters, or a character and a place, when describing them in words doesn't work well.
  • Getting your own images into Midjourney so you can then upscale, vary, zoom or animate them.

Request

POST/midjourney/v2/blend

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

{
"urls": [
{ "url": "https://example.com/image1.jpg", "ext": "jpg" },
{ "url": "https://example.com/image2.png", "ext": "png" }
],
"webhook_url": "https://example.com/blend/webhook-url",
"webhook_type": "result",
"account_hash": "a7d44910-88a6-4673-acc8-d60ffc3479a6"
}

Parameters

FieldRequiredDescription
urlsYesFrom 2 to 5 items, each with url and ext (jpg or png).
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.
account_hashNoWhich Discord account to use. If omitted, accounts on the key take turns.

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": "3b2c7341-ec22-0301-810d-9cf0543e20ba",
"hash": "fd88479e-455f-6a6f-6284-b0c49117d76f",
"urls": [
{ "url": "https://example.com/image1.jpg", "ext": "jpg" },
{ "url": "https://example.com/image2.jpg", "ext": "jpg" }
],
"type": "blend",
"status": "done",
"result": {
"url": "https://cdn.discordapp.com/...6a65992f3587.png",
"proxy_url": "https://media.discordapp.net/...6a65992f3587.png",
"filename": "...-6a65992f3587.png",
"content_type": "image/png",
"width": 2048,
"height": 2048,
"size": 2145293
},
"status_reason": null
}

You get a grid of four, just like from imagine. The blend hash can go straight into upscale or variation with choice 1-4.

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. Two images in

curl -X POST https://api.userapi.ai/midjourney/v2/blend \
-H "Content-Type: application/json" \
-H "api-key: $USERAPI_KEY" \
-d '{"urls": [{"url": "https://example.com/product.png", "ext": "png"}, {"url": "https://example.com/style.jpg", "ext": "jpg"}]}'

2. Wait for the grid

curl "https://api.userapi.ai/midjourney/v2/status?hash=BLEND_HASH" \
-H "api-key: $USERAPI_KEY"

3. Upscale the one you like

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

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

How many images can I blend?

Two to five per request, as with /blend in Discord.

Which formats?

jpg and png. Each image is a URL plus ext.

What does "Image denied" mean?

It is the error we see most often with blend: Midjourney refused one of the source images. Replace that image, retrying with the same set usually gives the same answer.

Can I add text to a blend?

blend itself only takes images. If you want text as well, use imagine and put the image URLs at the start of the prompt, then the text. Or turn on Remix for the account and run variation on the blend result with a prompt.

What next?

Anything you would do with an imagine result: upscale or variation, and on the upscaled image also upsample, vary, zoom, pan, inpaint or animate.

See also

Use image generation Magic with UserAPI