curl --request POST \
--url https://api.developer.pixelcut.ai/v1/remove-background \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"image_url": "https://cdn3.pixelcut.app/product.jpg",
"format": "png",
"crop": false,
"margin": "100px",
"margin_left": "50px",
"margin_right": "50px",
"margin_top": "50px",
"margin_bottom": "50px"
}
'import requests
url = "https://api.developer.pixelcut.ai/v1/remove-background"
payload = {
"image_url": "https://cdn3.pixelcut.app/product.jpg",
"format": "png",
"crop": False,
"margin": "100px",
"margin_left": "50px",
"margin_right": "50px",
"margin_top": "50px",
"margin_bottom": "50px"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image_url: 'https://cdn3.pixelcut.app/product.jpg',
format: 'png',
crop: false,
margin: '100px',
margin_left: '50px',
margin_right: '50px',
margin_top: '50px',
margin_bottom: '50px'
})
};
fetch('https://api.developer.pixelcut.ai/v1/remove-background', 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.developer.pixelcut.ai/v1/remove-background",
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_url' => 'https://cdn3.pixelcut.app/product.jpg',
'format' => 'png',
'crop' => false,
'margin' => '100px',
'margin_left' => '50px',
'margin_right' => '50px',
'margin_top' => '50px',
'margin_bottom' => '50px'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.developer.pixelcut.ai/v1/remove-background"
payload := strings.NewReader("{\n \"image_url\": \"https://cdn3.pixelcut.app/product.jpg\",\n \"format\": \"png\",\n \"crop\": false,\n \"margin\": \"100px\",\n \"margin_left\": \"50px\",\n \"margin_right\": \"50px\",\n \"margin_top\": \"50px\",\n \"margin_bottom\": \"50px\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.developer.pixelcut.ai/v1/remove-background")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"image_url\": \"https://cdn3.pixelcut.app/product.jpg\",\n \"format\": \"png\",\n \"crop\": false,\n \"margin\": \"100px\",\n \"margin_left\": \"50px\",\n \"margin_right\": \"50px\",\n \"margin_top\": \"50px\",\n \"margin_bottom\": \"50px\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.developer.pixelcut.ai/v1/remove-background")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_url\": \"https://cdn3.pixelcut.app/product.jpg\",\n \"format\": \"png\",\n \"crop\": false,\n \"margin\": \"100px\",\n \"margin_left\": \"50px\",\n \"margin_right\": \"50px\",\n \"margin_top\": \"50px\",\n \"margin_bottom\": \"50px\"\n}"
response = http.request(request)
puts response.read_body{
"result_url": "https://assets.pixelcut.app/public/result/a16646be-91c8-4e3a-b359.png"
}{
"error": "File size too large",
"error_code": "file_size_too_large"
}{
"error": "API Token not found",
"error_code": "invalid_auth_token"
}{
"error": "Insufficient credits available",
"error_code": "insufficient_api_credits"
}{
"error": "Too many requests",
"error_code": "rate_limit_exceeded"
}Remove Background
Removes the background from an image and optionally adds AI-generated shadows, crops to the subject, and applies margins. When AI shadows are requested, an additional 3 credits will be consumed.
Input Image Limits:
- Formats: JPEG, PNG, WebP, HEIC, AVIF
- Max size: 25MB
- Min resolution: 64x64px
- Max resolution: 10000x10000px
curl --request POST \
--url https://api.developer.pixelcut.ai/v1/remove-background \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"image_url": "https://cdn3.pixelcut.app/product.jpg",
"format": "png",
"crop": false,
"margin": "100px",
"margin_left": "50px",
"margin_right": "50px",
"margin_top": "50px",
"margin_bottom": "50px"
}
'import requests
url = "https://api.developer.pixelcut.ai/v1/remove-background"
payload = {
"image_url": "https://cdn3.pixelcut.app/product.jpg",
"format": "png",
"crop": False,
"margin": "100px",
"margin_left": "50px",
"margin_right": "50px",
"margin_top": "50px",
"margin_bottom": "50px"
}
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
image_url: 'https://cdn3.pixelcut.app/product.jpg',
format: 'png',
crop: false,
margin: '100px',
margin_left: '50px',
margin_right: '50px',
margin_top: '50px',
margin_bottom: '50px'
})
};
fetch('https://api.developer.pixelcut.ai/v1/remove-background', 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.developer.pixelcut.ai/v1/remove-background",
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_url' => 'https://cdn3.pixelcut.app/product.jpg',
'format' => 'png',
'crop' => false,
'margin' => '100px',
'margin_left' => '50px',
'margin_right' => '50px',
'margin_top' => '50px',
'margin_bottom' => '50px'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.developer.pixelcut.ai/v1/remove-background"
payload := strings.NewReader("{\n \"image_url\": \"https://cdn3.pixelcut.app/product.jpg\",\n \"format\": \"png\",\n \"crop\": false,\n \"margin\": \"100px\",\n \"margin_left\": \"50px\",\n \"margin_right\": \"50px\",\n \"margin_top\": \"50px\",\n \"margin_bottom\": \"50px\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.developer.pixelcut.ai/v1/remove-background")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"image_url\": \"https://cdn3.pixelcut.app/product.jpg\",\n \"format\": \"png\",\n \"crop\": false,\n \"margin\": \"100px\",\n \"margin_left\": \"50px\",\n \"margin_right\": \"50px\",\n \"margin_top\": \"50px\",\n \"margin_bottom\": \"50px\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.developer.pixelcut.ai/v1/remove-background")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"image_url\": \"https://cdn3.pixelcut.app/product.jpg\",\n \"format\": \"png\",\n \"crop\": false,\n \"margin\": \"100px\",\n \"margin_left\": \"50px\",\n \"margin_right\": \"50px\",\n \"margin_top\": \"50px\",\n \"margin_bottom\": \"50px\"\n}"
response = http.request(request)
puts response.read_body{
"result_url": "https://assets.pixelcut.app/public/result/a16646be-91c8-4e3a-b359.png"
}{
"error": "File size too large",
"error_code": "file_size_too_large"
}{
"error": "API Token not found",
"error_code": "invalid_auth_token"
}{
"error": "Insufficient credits available",
"error_code": "insufficient_api_credits"
}{
"error": "Too many requests",
"error_code": "rate_limit_exceeded"
}Authorizations
All API requests require a valid api key. Include your token as a HTTP request header in the following format: X-API-Key: skXXXXXXXXXXXXXXXX. You can obtain an api key by signing up for developer access in your Pixelcut account.
Headers
Acceptable response media type(s). application/json or image/*. Default is application/json.
Body
URL of the image to be processed.
"https://cdn3.pixelcut.app/product.jpg"
The format of the resultant image. Currently, only png is supported.
png Enable and configure AI-generated shadow. When enabled, +3 credits are consumed. Pass true for automatic shadow estimation or provide a light source for custom control.
Show child attributes
Show child attributes
When true, crops the image to the region of interest (the detected subject).
(Beta) General margin applied to all sides when crop is enabled. Only applies if crop is true. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).
"100px"
(Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).
"50px"
(Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).
"50px"
(Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).
"50px"
(Beta) Directional margin override that applies when crop is enabled. Only applies if crop is true. When specified, this overrides the general margin parameter for this specific side. When specified as a string with '%' (0-49%), it represents a percentage of the image dimensions. When specified as a string with 'px', it represents pixels (>=0px).
"50px"
Response
Success
A URL to access the resultant image which is valid for 1 hour. File format will be png.
"https://assets.pixelcut.app/public/result/a16646be-91c8-4e3a-b359.png"