curl --request POST \
--url https://api.bitstudio.ai/v1/images/{id}/inpaint \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mask_image_id": "22222222-2222-4222-8222-222222222222",
"prompt": "White fabric"
}
'import requests
url = "https://api.bitstudio.ai/v1/images/{id}/inpaint"
payload = {
"mask_image_id": "22222222-2222-4222-8222-222222222222",
"prompt": "White fabric"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({mask_image_id: '22222222-2222-4222-8222-222222222222', prompt: 'White fabric'})
};
fetch('https://api.bitstudio.ai/v1/images/{id}/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.bitstudio.ai/v1/images/{id}/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([
'mask_image_id' => '22222222-2222-4222-8222-222222222222',
'prompt' => 'White fabric'
]),
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.bitstudio.ai/v1/images/{id}/inpaint"
payload := strings.NewReader("{\n \"mask_image_id\": \"22222222-2222-4222-8222-222222222222\",\n \"prompt\": \"White fabric\"\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.bitstudio.ai/v1/images/{id}/inpaint")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mask_image_id\": \"22222222-2222-4222-8222-222222222222\",\n \"prompt\": \"White fabric\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bitstudio.ai/v1/images/{id}/inpaint")
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 \"mask_image_id\": \"22222222-2222-4222-8222-222222222222\",\n \"prompt\": \"White fabric\"\n}"
response = http.request(request)
puts response.read_body{
"jobs": [
{
"id": "11111111-1111-4111-8111-111111111111",
"status": "pending",
"task": "inpaint",
"created_at": "2026-09-15T12:00:00Z",
"result": null,
"error": null,
"credits_used": 1
}
]
}{
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": "<string>",
"cta": true,
"next_action": "<string>"
}Inpaint an area
Use a mask to change part of an image.
curl --request POST \
--url https://api.bitstudio.ai/v1/images/{id}/inpaint \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"mask_image_id": "22222222-2222-4222-8222-222222222222",
"prompt": "White fabric"
}
'import requests
url = "https://api.bitstudio.ai/v1/images/{id}/inpaint"
payload = {
"mask_image_id": "22222222-2222-4222-8222-222222222222",
"prompt": "White fabric"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({mask_image_id: '22222222-2222-4222-8222-222222222222', prompt: 'White fabric'})
};
fetch('https://api.bitstudio.ai/v1/images/{id}/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.bitstudio.ai/v1/images/{id}/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([
'mask_image_id' => '22222222-2222-4222-8222-222222222222',
'prompt' => 'White fabric'
]),
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.bitstudio.ai/v1/images/{id}/inpaint"
payload := strings.NewReader("{\n \"mask_image_id\": \"22222222-2222-4222-8222-222222222222\",\n \"prompt\": \"White fabric\"\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.bitstudio.ai/v1/images/{id}/inpaint")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"mask_image_id\": \"22222222-2222-4222-8222-222222222222\",\n \"prompt\": \"White fabric\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bitstudio.ai/v1/images/{id}/inpaint")
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 \"mask_image_id\": \"22222222-2222-4222-8222-222222222222\",\n \"prompt\": \"White fabric\"\n}"
response = http.request(request)
puts response.read_body{
"jobs": [
{
"id": "11111111-1111-4111-8111-111111111111",
"status": "pending",
"task": "inpaint",
"created_at": "2026-09-15T12:00:00Z",
"result": null,
"error": null,
"credits_used": 1
}
]
}{
"code": "<string>",
"message": "<string>",
"request_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"error": "<string>",
"cta": true,
"next_action": "<string>"
}mask_image_id.
The defaults are model v1, mode inpaint, and denoise: 1.0. This operation creates one image. A lower denoise value makes a gentler change.
A successful request returns HTTP 202 with a jobs array. Save each id, then get the job until it finishes. Read the completed media from result.url and its reusable ID from result.id. Use an Idempotency-Key when submitting work that may be retried.Authorizations
Create an API key in Studio → account menu → API Keys. Keep it on your server.
Headers
Use a unique key for each intended creation. Retry the same method, path and JSON with the same key to replay its response for 24 hours after completion. Conflicting requests and unfinished or uncertain outcomes return 409. An uncertain receipt is never automatically rerun.
1 - 128^[!-~]+$Path Parameters
Source resource ID.
Body
Uploaded black-and-white PNG mask: white marks the region to change; black preserves the surrounding area. Must match the selected source dimensions.
Model for this operation. Account and plan limits apply.
v1 Output quality; dimensions depend on the model and aspect ratio.
standard, high Number of outputs. Defaults to 1. Account limits still apply.
1 <= x <= 11
Optional seed; it does not guarantee identical results.
What should appear in the masked area.
inpaint, extend Optional reference, mutually exclusive with reference_asset_id.
Optional reusable reference, mutually exclusive with reference_image_id.
Additional reusable reference asset IDs. Supported types depend on the operation.
Strength of the change.
0.05 <= x <= 11
Optional style directions.
Optional processing speed; accepted values depend on the operation and model.
Response
Accepted; poll each job.
1Show child attributes
Show child attributes