Cleanup
curl --request POST \
--url https://api.novita.ai/v3/cleanup \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"extra": {
"response_image_type": "<string>",
"enterprise_plan": {
"enabled": true
}
},
"image_file": "<string>",
"mask_file": "<string>"
}
'import requests
url = "https://api.novita.ai/v3/cleanup"
payload = {
"extra": {
"response_image_type": "<string>",
"enterprise_plan": { "enabled": True }
},
"image_file": "<string>",
"mask_file": "<string>"
}
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({
extra: {response_image_type: '<string>', enterprise_plan: {enabled: true}},
image_file: '<string>',
mask_file: '<string>'
})
};
fetch('https://api.novita.ai/v3/cleanup', 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.novita.ai/v3/cleanup",
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([
'extra' => [
'response_image_type' => '<string>',
'enterprise_plan' => [
'enabled' => true
]
],
'image_file' => '<string>',
'mask_file' => '<string>'
]),
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.novita.ai/v3/cleanup"
payload := strings.NewReader("{\n \"extra\": {\n \"response_image_type\": \"<string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"<string>\",\n \"mask_file\": \"<string>\"\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.novita.ai/v3/cleanup")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"extra\": {\n \"response_image_type\": \"<string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"<string>\",\n \"mask_file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v3/cleanup")
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 \"extra\": {\n \"response_image_type\": \"<string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"<string>\",\n \"mask_file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"image_file": "<string>",
"image_type": "<string>"
}Image Editor
Cleanup
POST
/
v3
/
cleanup
Cleanup
curl --request POST \
--url https://api.novita.ai/v3/cleanup \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"extra": {
"response_image_type": "<string>",
"enterprise_plan": {
"enabled": true
}
},
"image_file": "<string>",
"mask_file": "<string>"
}
'import requests
url = "https://api.novita.ai/v3/cleanup"
payload = {
"extra": {
"response_image_type": "<string>",
"enterprise_plan": { "enabled": True }
},
"image_file": "<string>",
"mask_file": "<string>"
}
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({
extra: {response_image_type: '<string>', enterprise_plan: {enabled: true}},
image_file: '<string>',
mask_file: '<string>'
})
};
fetch('https://api.novita.ai/v3/cleanup', 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.novita.ai/v3/cleanup",
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([
'extra' => [
'response_image_type' => '<string>',
'enterprise_plan' => [
'enabled' => true
]
],
'image_file' => '<string>',
'mask_file' => '<string>'
]),
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.novita.ai/v3/cleanup"
payload := strings.NewReader("{\n \"extra\": {\n \"response_image_type\": \"<string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"<string>\",\n \"mask_file\": \"<string>\"\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.novita.ai/v3/cleanup")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"extra\": {\n \"response_image_type\": \"<string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"<string>\",\n \"mask_file\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novita.ai/v3/cleanup")
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 \"extra\": {\n \"response_image_type\": \"<string>\",\n \"enterprise_plan\": {\n \"enabled\": true\n }\n },\n \"image_file\": \"<string>\",\n \"mask_file\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"image_file": "<string>",
"image_type": "<string>"
}Easily remove unwanted objects, defects, people, or text from your pictures in just seconds.
HTTP status codes in the 2xx range indicate that the request has been successfully accepted. A code of 400 means there is an error with the request parameters, while status codes in the 5xx range indicate internal server errors.
You can retrieve the image URL in the

Request Headers
string
required
Enum:
application/jsonstring
required
Bearer authentication format, for example: Bearer {{API Key}}.
Request Body
object
Optional extra parameters for the request.
Show properties
Show properties
string
The returned image type. Default is png.
Enum:
Enum:
png, webp, jpegobject
Dedicated Endpoints settings, which only take effect for users who have already subscribed to the Dedicated Endpoints Documentation.
Show properties
Show properties
boolean
Set to true to schedule this task to use your Dedicated Endpoints’s dedicated resources. Default is false.
string
required
The base64-encoded original image, with a maximum resolution of 16 megapixels and a maximum file size of 30 MB.
string
required
The base64-encoded mask image, with a maximum resolution of 16 megapixels and a maximum file size of 30 MB.
Response
string
The Base64-encoded content of the returned image.
string
The returned image type.
Enum:
Enum:
png, webp, jpegExample
Cleanup allows you to easily remove unwanted objects, defects, people, or text from your pictures in just seconds. Try it in the playground.Request:
curl --location --request POST 'https://api.novita.ai/v3/cleanup' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"image_file":"{{Base64 encoded image}}",
"mask_file":"{{Base64 encoded image}}"
}'
Response:
{
"image_file": "{{Base64 encoded image}}",
"image_type": "png"
}
image_file field of the response in base64 format.
Response:
{
"image_file": "{{Base64 encoded image}}",
"image_type": "png"
}


Last modified on February 19, 2025
Was this page helpful?
⌘I