Midjourney
Create a Midjourney blend task
Submit images to the POST /mj/submit/blend endpoint to blend one or more inputs into a new Midjourney-style image with CometAPI.
POST
/
mj
/
submit
/
blend
cURL
curl https://api.cometapi.com/mj/submit/blend \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"botType": "MID_JOURNEY",
"base64Array": [
"data:image/jpeg;base64,<base64-encoded-first-image>",
"data:image/jpeg;base64,<base64-encoded-second-image>"
],
"dimensions": "SQUARE"
}'
import base64
import os
import requests
def to_data_uri(path):
with open(path, "rb") as f:
return "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()
response = requests.post(
"https://api.cometapi.com/mj/submit/blend",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"botType": "MID_JOURNEY",
"base64Array": [to_data_uri("first.jpg"), to_data_uri("second.jpg")],
"dimensions": "SQUARE",
},
)
task = response.json()
print(task["code"], task.get("result"))
import { readFile } from "node:fs/promises";
async function toDataUri(path) {
return `data:image/jpeg;base64,${(await readFile(path)).toString("base64")}`;
}
const response = await fetch("https://api.cometapi.com/mj/submit/blend", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
botType: "MID_JOURNEY",
base64Array: [await toDataUri("first.jpg"), await toDataUri("second.jpg")],
dimensions: "SQUARE",
}),
});
const task = await response.json();
console.log(task.code, task.result);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/mj/submit/blend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'base64Array' => [
'data:image/png;base64,xxx1',
'data:image/png;base64,xxx2'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/mj/submit/blend"
payload := strings.NewReader("{\n \"base64Array\": [\n \"data:image/png;base64,xxx1\",\n \"data:image/png;base64,xxx2\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/mj/submit/blend")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base64Array\": [\n \"data:image/png;base64,xxx1\",\n \"data:image/png;base64,xxx2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/mj/submit/blend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"base64Array\": [\n \"data:image/png;base64,xxx1\",\n \"data:image/png;base64,xxx2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"description": "<string>",
"properties": {},
"result": 123
}Use this endpoint to blend 2 to 5 source images into a new Midjourney composition. It is a direct entry point and does not require a prior imagine task.
Before you call it
- Prepare 2 to 5 source images
- Keep the first test small and skip extra account-routing options unless you need them
- Save the returned task id, because blending is still asynchronous
Task flow
1
Submit the blend task
Send the source images through the blend endpoint and store the returned task id.
2
Poll the task
Use Fetch Single Task until the task reaches a terminal state.
3
Continue from the result
When action buttons appear, use Action for upscale, variation, or other follow-up steps.
Body
application/json
Last modified on June 23, 2026
⌘I
cURL
curl https://api.cometapi.com/mj/submit/blend \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"botType": "MID_JOURNEY",
"base64Array": [
"data:image/jpeg;base64,<base64-encoded-first-image>",
"data:image/jpeg;base64,<base64-encoded-second-image>"
],
"dimensions": "SQUARE"
}'
import base64
import os
import requests
def to_data_uri(path):
with open(path, "rb") as f:
return "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()
response = requests.post(
"https://api.cometapi.com/mj/submit/blend",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"botType": "MID_JOURNEY",
"base64Array": [to_data_uri("first.jpg"), to_data_uri("second.jpg")],
"dimensions": "SQUARE",
},
)
task = response.json()
print(task["code"], task.get("result"))
import { readFile } from "node:fs/promises";
async function toDataUri(path) {
return `data:image/jpeg;base64,${(await readFile(path)).toString("base64")}`;
}
const response = await fetch("https://api.cometapi.com/mj/submit/blend", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
botType: "MID_JOURNEY",
base64Array: [await toDataUri("first.jpg"), await toDataUri("second.jpg")],
dimensions: "SQUARE",
}),
});
const task = await response.json();
console.log(task.code, task.result);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/mj/submit/blend",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'base64Array' => [
'data:image/png;base64,xxx1',
'data:image/png;base64,xxx2'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/mj/submit/blend"
payload := strings.NewReader("{\n \"base64Array\": [\n \"data:image/png;base64,xxx1\",\n \"data:image/png;base64,xxx2\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.cometapi.com/mj/submit/blend")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"base64Array\": [\n \"data:image/png;base64,xxx1\",\n \"data:image/png;base64,xxx2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/mj/submit/blend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"base64Array\": [\n \"data:image/png;base64,xxx1\",\n \"data:image/png;base64,xxx2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"description": "<string>",
"properties": {},
"result": 123
}