Skip to main content
POST
/
mj
/
submit
/
blend
cURL
IMG1=$(base64 < first.jpg | tr -d '\n')
IMG2=$(base64 < second.jpg | tr -d '\n')

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,$IMG1\",
      \"data:image/jpeg;base64,$IMG2\"
    ],
    \"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.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your CometAPI key.

Body

application/json
base64Array
string[]
required

Two or more base64-encoded images to blend. Each item should be a data URI such as data:image/png;base64,xxx.

dimensions
enum<string>

Output aspect ratio.

Available options:
PORTRAIT,
SQUARE,
LANDSCAPE
notifyHook
string

Webhook URL to receive task status updates. Falls back to your account-level webhook if omitted.

state
string

Custom state string. Returned as-is in the task result and webhook callback for your own tracking.

botType
enum<string>

Bot type to use. MID_JOURNEY for Midjourney (default), NIJI_JOURNEY for Niji.

Available options:
MID_JOURNEY,
NIJI_JOURNEY

Response

200 - application/json

Success

code
integer
required

Status code

description
string
required

Human-readable description message corresponding to the status code

properties
object
required

Additional properties or metadata

result
integer
required

Returned task ID