Skip to main content
POST
/
mj
/
submit
/
modal
cURL
curl https://api.cometapi.com/mj/submit/modal \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
      "taskId": "<task_id>",
      "customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
      "prompt": "a small red lantern on the boat",
      "maskBase64": "data:image/png;base64,<your-mask-base64>"
    }'
import os
import requests

response = requests.post(
"https://api.cometapi.com/mj/submit/modal",
headers={"Authorization": "Bearer " + os.environ["COMETAPI_KEY"]},
json={
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
},
)

task = response.json()
print(task["code"], task.get("result")) # code 1 means submitted; result is the task id
const response = await fetch("https://api.cometapi.com/mj/submit/modal", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.COMETAPI_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"taskId": "<task_id>",
"customId": "MJ::Inpaint::1::<custom_id_hash>::SOLO",
"prompt": "a small red lantern on the boat",
"maskBase64": "data:image/png;base64,<your-mask-base64>"
}),
});

const task = await response.json();
console.log(task.code, task.result); // code 1 means submitted; result is the task id
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/mj/submit/modal",
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([
'taskId' => '<task_id>',
'customId' => 'MJ::Inpaint::1::<custom_id_hash>::SOLO'
]),
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/modal"

payload := strings.NewReader("{\n \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\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/modal")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.cometapi.com/mj/submit/modal")

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 \"taskId\": \"<task_id>\",\n \"customId\": \"MJ::Inpaint::1::<custom_id_hash>::SOLO\"\n}"

response = http.request(request)
puts response.read_body
{
  "code": 123,
  "description": "<string>",
  "properties": {},
  "result": 123
}

Overview

Submit additional input when an Action task returns status: "MODAL". This is required for operations that need extra data, such as inpainting masks or custom zoom prompts.

When to use

OperationWhat to Submit
Vary (Region) / InpaintmaskBase64 (PNG mask) + prompt
Custom Zoomprompt (e.g., “your prompt —zoom 2”)
For a complete inpaint flow example, see Start with Midjourney API.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your CometAPI key.

Body

application/json
taskId
string
default:<task_id>
required

Task id from the parent task whose modal action you are continuing.

customId
string
required

The button customId that opened the modal, such as MJ::Inpaint::1::xxxx::SOLO from the Vary (Region) button. Required.

maskBase64
string

Base64-encoded mask image for partial inpainting. White areas are repainted; black areas are preserved.

prompt
string

Text prompt describing the desired change for the selected region.

Response

200 - application/json

Success

code
integer
required

The status of the task

description
string
required
properties
object
required
result
integer
required

The task ID of the returned task