Inpaint AI

Remove or add objects by painting a mask over regions to edit. Provide an optional prompt for what to add or how to fill the masked area.

Endpoint

HTTP Method
POST https://api.mnmlai.dev/v1/inpaint

Request

Send a POST request with multipart/form-data containing your building image and design specifications.

Required Parameters

ParameterTypeDescription
imageFileThe source image to edit (multipart/form-data)
maskFileThe mask image with black background and white selected area (multipart/form-data)

Optional Parameters

ParameterTypeDefaultDescription
promptString""Text to guide the inpainting (optional)
negative_promptString""What to avoid in the generated result
seedNumberRandomRandom seed for reproducibility
mask_typeStringmanualMask type: "manual" or "automatic" (default: manual)

Response

The Inpaint AI endpoint processes your image asynchronously. You'll receive a request ID that you can use to check the status and retrieve the generated design.

Success Response (200 OK)

{
  "status": "success",
  "id": "b09ssvpzzhrj00cmzt1bykjzp1",
  "prompt": "Add a cherry on the cupcake",
  "negative_prompt": "no sprinkles",
  "seed": 123456
}

Examples

Basic Example

curl -X POST https://api.mnmlai.dev/v1/inpaint \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@/path/to/building.jpg" \
  -F "mask=@/path/to/mask.png" \
  -F "prompt=Add a cherry on the cupcake"

Advanced Example with All Parameters

curl -X POST https://api.mnmlai.dev/v1/inpaint \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: multipart/form-data" \
  -F "image=@/path/to/building.jpg" \
  -F "mask=@/path/to/mask.png" \
  -F "prompt=Add a cherry on the cupcake" \
  -F "negative_prompt=no sprinkles" \
  -F "seed=23421142"

Node.js Example

const FormData = require('form-data');
const fs = require('fs');
const axios = require('axios');

const form = new FormData();
form.append('image', fs.createReadStream('building.jpg'));
form.append('mask', fs.createReadStream('mask.png'));
form.append('prompt', 'Add a cherry on the cupcake');
form.append('negative_prompt', 'no sprinkles');
form.append('seed', '23421142');

const response = await axios.post(
  'https://api.mnmlai.dev/v1/inpaint',
  form,
  {
    headers: {
      'Accept': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY',
      ...form.getHeaders()
    }
  }
);

console.log('Request ID:', response.data.id);

Python Example

import requests

url = 'https://api.mnmlai.dev/v1/inpaint'

files = {
    'image': open('building.jpg', 'rb'),
    'mask': open('mask.png', 'rb')
}

data = {
    'prompt': 'Add a cherry on the cupcake',
    'negative_prompt': 'no sprinkles',
    'seed': '23423213',
}

headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer YOUR_API_KEY'
}

response = requests.post(url, headers=headers, files=files, data=data)
result = response.json()

print(f"Request ID: {result['id']}")

Processing Status

After submitting your request, use the Status Check endpoint with the returned ID to monitor processing progress:

Status Check Endpoint
GET https://api.mnmlai.dev/v1/status/{id}

Error Handling

Common Error Responses

// 400 Bad Request - Missing required parameters
{
  "error": "Missing required field: image"
}

// 401 Unauthorized - Invalid API key
{
  "error": "Invalid authentication credentials"
}

// 413 Payload Too Large - File size exceeded
{
  "error": "File size exceeds maximum limit of 10MB"
}

// 429 Too Many Requests - Rate limit exceeded
{
  "error": "Rate limit exceeded. Please try again later"
}

Related Endpoints

Explore other AI-powered design tools: