Inpaint
https://api.imaginepro.ai/api/v1/midjourney/button
After a successful upscale (U1, U2, U3, U4). You have the option to use the Vary (Region)
button to redraw a section of your image; also known as Inpainting.
POST /api/v1/midjourney/button
Sample Request
{
"messageId": "e57fb09d-25f0-49f7-8f0f-2e902ffe9fdd",
"mask": "UklGRiQAAABXRUJQVlA4WAoAAAAQABAJAAABKAAATAwAAABAAEAAAAAAABIAAAAAQAAAEgAAA...",
"prompt": "A little cat running on the grass",
"button": "Vary (Region)"
}
Request Body
Name | Type | Required |
---|---|---|
messageId | string | true |
button | string | true |
mask | string | true |
prompt | string | false |
ref | string | false |
webhookOverride | string | false |
messageId
Use the messageId
returned from your previous generation process.
button
Vary (Region)
in this case.
mask
The mask is a base64 encoded string of the region you want to inpaint. You can use this tool (opens in a new tab) to generate the mask and retrieve its base64 encoded string.
prompt (optional)
You can optionally pass prompt
in your command - which can be used useful for the inpainting area.
ref (optional)
You can optionally pass ref
in your command - which can be used useful when using webhooks.
webhookOverride (optional)
You can optionally pass webhookOverride
that will route a response to a webhook of your choosing. Please note that using a webhook is completely optional. You are welcome to use the GET Message endpoint to retrieve responses. The webhook event payload is same as the Message endpoint response.
Sample Response
{
"success": true,
"messageId": "your-message-id",
"createdAt": "2023-08-01T14:03:01.817Z"
}
Response Body
Name | Type | Description |
---|---|---|
success | boolean | a boolean value for the generation job creation status |
messageId | string | the messageId for querying the progress later |
createdAt | string | timestamp of the task creation |
error | string | error message if any |
Examples
const axios = require("axios")
const config = {
method: "post",
url: "https://api.imaginepro.ai/api/v1/midjourney/button",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <your-token>",
},
data: {
messageId: "e57fb09d-25f0-49f7-8f0f-2e902ffe9fdd",
mask: "UklGRiQAAABXRUJQVlA4WAoAAAAQABAJAAABKAAATAwAAABAAEAAAAAAABIAAAAAQAAAEgAAA",
button: "Vary (Region)",
},
}
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data))
})
.catch(function (error) {
console.log(error)
})