Midjourney Inpainting
curl --request POST \
--url https://api.highwayapi.ai/v3/async/mj-inpaint \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [
123
],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [
123
],
"width": 123,
"height": 123
}
}
'import requests
url = "https://api.highwayapi.ai/v3/async/mj-inpaint"
payload = {
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [123],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [123],
"width": 123,
"height": 123
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
image_no: 123,
task_id: '<string>',
remix_prompt: '<string>',
mask: {url: '<string>', areas: [{points: [123], width: 123, height: 123}]},
area: {points: [123], width: 123, height: 123}
})
};
fetch('https://api.highwayapi.ai/v3/async/mj-inpaint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/v3/async/mj-inpaint",
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([
'image_no' => 123,
'task_id' => '<string>',
'remix_prompt' => '<string>',
'mask' => [
'url' => '<string>',
'areas' => [
[
'points' => [
123
],
'width' => 123,
'height' => 123
]
]
],
'area' => [
'points' => [
123
],
'width' => 123,
'height' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/async/mj-inpaint"
payload := strings.NewReader("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.highwayapi.ai/v3/async/mj-inpaint")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/mj-inpaint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}Images
Midjourney Inpainting
POST
/
v3
/
async
/
mj-inpaint
Midjourney Inpainting
curl --request POST \
--url https://api.highwayapi.ai/v3/async/mj-inpaint \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [
123
],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [
123
],
"width": 123,
"height": 123
}
}
'import requests
url = "https://api.highwayapi.ai/v3/async/mj-inpaint"
payload = {
"image_no": 123,
"task_id": "<string>",
"remix_prompt": "<string>",
"mask": {
"url": "<string>",
"areas": [
{
"points": [123],
"width": 123,
"height": 123
}
]
},
"area": {
"points": [123],
"width": 123,
"height": 123
}
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
image_no: 123,
task_id: '<string>',
remix_prompt: '<string>',
mask: {url: '<string>', areas: [{points: [123], width: 123, height: 123}]},
area: {points: [123], width: 123, height: 123}
})
};
fetch('https://api.highwayapi.ai/v3/async/mj-inpaint', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.highwayapi.ai/v3/async/mj-inpaint",
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([
'image_no' => 123,
'task_id' => '<string>',
'remix_prompt' => '<string>',
'mask' => [
'url' => '<string>',
'areas' => [
[
'points' => [
123
],
'width' => 123,
'height' => 123
]
]
],
'area' => [
'points' => [
123
],
'width' => 123,
'height' => 123
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.highwayapi.ai/v3/async/mj-inpaint"
payload := strings.NewReader("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")
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.highwayapi.ai/v3/async/mj-inpaint")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.highwayapi.ai/v3/async/mj-inpaint")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"image_no\": 123,\n \"task_id\": \"<string>\",\n \"remix_prompt\": \"<string>\",\n \"mask\": {\n \"url\": \"<string>\",\n \"areas\": [\n {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n ]\n },\n \"area\": {\n \"points\": [\n 123\n ],\n \"width\": 123,\n \"height\": 123\n }\n}"
response = http.request(request)
puts response.read_body{
"task_id": "<string>"
}Use Midjourney inpainting to redraw specified areas of a generated image. You can specify the inpainting area using polygon regions or a black-and-white mask image. This API uses asynchronous processing, and the client needs to query the final generated result via
task_id.
Request Headers
string
required
Enum value:
application/jsonstring
required
Bearer authentication format: Bearer {{API key}}.
Request Body
integer
required
Image number, used to specify the image to inpaint.Value range: 0~3
string
required
Unique identifier of the original image generation task.
string
Inpainting prompt, used to describe the desired content for the inpainted area.Length limit: 1-8192 characters.
object
required
Inpainting area configuration. Replaces the area parameter and supports multi-region inpainting. Choose either areas or url.
Show Properties
Show Properties
string
Specify polygon regions using a black-and-white binary image. Multiple regions are supported; white areas are the inpainting regions.
object[]
Polygon region array. Multiple regions are supported.
object
required
Single polygon region configuration (use either this parameter or the mask parameter).
Response Parameters
string
required
The
task_id of the asynchronous task. You should use this task_id to request the Query Task Result API to obtain the generated result.⌘I