Try On (Beta)
curl --request POST \
--url https://api.developer.pixelcut.ai/v1/try-on \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"person_image_url": "https://cdn3.pixelcut.app/virtual-try-on/person.png",
"garment_image_url": "https://cdn3.pixelcut.app/virtual-try-on/garment.png",
"garment_mode": "auto",
"preprocess_garment": "true",
"remove_background": "false",
"wait_for_result": "true"
}
'import requests
url = "https://api.developer.pixelcut.ai/v1/try-on"
payload = {
"person_image_url": "https://cdn3.pixelcut.app/virtual-try-on/person.png",
"garment_image_url": "https://cdn3.pixelcut.app/virtual-try-on/garment.png",
"garment_mode": "auto",
"preprocess_garment": "true",
"remove_background": "false",
"wait_for_result": "true"
}
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({
person_image_url: 'https://cdn3.pixelcut.app/virtual-try-on/person.png',
garment_image_url: 'https://cdn3.pixelcut.app/virtual-try-on/garment.png',
garment_mode: 'auto',
preprocess_garment: 'true',
remove_background: 'false',
wait_for_result: 'true'
})
};
fetch('https://api.developer.pixelcut.ai/v1/try-on', 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/try-on",
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([
'person_image_url' => 'https://cdn3.pixelcut.app/virtual-try-on/person.png',
'garment_image_url' => 'https://cdn3.pixelcut.app/virtual-try-on/garment.png',
'garment_mode' => 'auto',
'preprocess_garment' => 'true',
'remove_background' => 'false',
'wait_for_result' => 'true'
]),
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/try-on"
payload := strings.NewReader("{\n \"person_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/person.png\",\n \"garment_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/garment.png\",\n \"garment_mode\": \"auto\",\n \"preprocess_garment\": \"true\",\n \"remove_background\": \"false\",\n \"wait_for_result\": \"true\"\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/try-on")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"person_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/person.png\",\n \"garment_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/garment.png\",\n \"garment_mode\": \"auto\",\n \"preprocess_garment\": \"true\",\n \"remove_background\": \"false\",\n \"wait_for_result\": \"true\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.developer.pixelcut.ai/v1/try-on")
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 \"person_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/person.png\",\n \"garment_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/garment.png\",\n \"garment_mode\": \"auto\",\n \"preprocess_garment\": \"true\",\n \"remove_background\": \"false\",\n \"wait_for_result\": \"true\"\n}"
response = http.request(request)
puts response.read_body{
"result_url": "https://assets.pixelcut.app/public/result/a16646be-91c8-4e3a-b359.jpg"
}{
"job_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}{
"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"
}Try On
Try On (Beta)
BETA - This endpoint is currently in beta and may change without notice.
Places a garment onto a person image.
For Best Results:
- Person Image:
- There should only be one person in the image.
- Plain backgrounds and no accessories are best
- The person should take up most of the frame, a 3/4 body view works best.
- The person should be standing facing forward, side/seated views work less well.
- Garment Image:
- The garment image should only contain a single garment.
- Plain “stock photos” of garments work best, however the model is capable of transferring garments from one person to another.
- The garment should take up most of the frame.
- Note: If the garment image contains a person wearing the garment or other objects, garment extraction will be required, which costs an additional 5 credits.
Limitations:
- The API may not work with all garments, it works best with top garments like t-shirts, blouses, etc.
- Text and fine details in the garment image may not be reproduced perfectly in the resulting image.
- Colors in the resulting image may be slightly different to the colors in the garment image.
Input Image Limits:
- Max size: 25MB
- Min resolution: 64x64px
- Max resolution: 6000x6000px
POST
/
v1
/
try-on
Try On (Beta)
curl --request POST \
--url https://api.developer.pixelcut.ai/v1/try-on \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"person_image_url": "https://cdn3.pixelcut.app/virtual-try-on/person.png",
"garment_image_url": "https://cdn3.pixelcut.app/virtual-try-on/garment.png",
"garment_mode": "auto",
"preprocess_garment": "true",
"remove_background": "false",
"wait_for_result": "true"
}
'import requests
url = "https://api.developer.pixelcut.ai/v1/try-on"
payload = {
"person_image_url": "https://cdn3.pixelcut.app/virtual-try-on/person.png",
"garment_image_url": "https://cdn3.pixelcut.app/virtual-try-on/garment.png",
"garment_mode": "auto",
"preprocess_garment": "true",
"remove_background": "false",
"wait_for_result": "true"
}
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({
person_image_url: 'https://cdn3.pixelcut.app/virtual-try-on/person.png',
garment_image_url: 'https://cdn3.pixelcut.app/virtual-try-on/garment.png',
garment_mode: 'auto',
preprocess_garment: 'true',
remove_background: 'false',
wait_for_result: 'true'
})
};
fetch('https://api.developer.pixelcut.ai/v1/try-on', 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/try-on",
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([
'person_image_url' => 'https://cdn3.pixelcut.app/virtual-try-on/person.png',
'garment_image_url' => 'https://cdn3.pixelcut.app/virtual-try-on/garment.png',
'garment_mode' => 'auto',
'preprocess_garment' => 'true',
'remove_background' => 'false',
'wait_for_result' => 'true'
]),
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/try-on"
payload := strings.NewReader("{\n \"person_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/person.png\",\n \"garment_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/garment.png\",\n \"garment_mode\": \"auto\",\n \"preprocess_garment\": \"true\",\n \"remove_background\": \"false\",\n \"wait_for_result\": \"true\"\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/try-on")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"person_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/person.png\",\n \"garment_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/garment.png\",\n \"garment_mode\": \"auto\",\n \"preprocess_garment\": \"true\",\n \"remove_background\": \"false\",\n \"wait_for_result\": \"true\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.developer.pixelcut.ai/v1/try-on")
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 \"person_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/person.png\",\n \"garment_image_url\": \"https://cdn3.pixelcut.app/virtual-try-on/garment.png\",\n \"garment_mode\": \"auto\",\n \"preprocess_garment\": \"true\",\n \"remove_background\": \"false\",\n \"wait_for_result\": \"true\"\n}"
response = http.request(request)
puts response.read_body{
"result_url": "https://assets.pixelcut.app/public/result/a16646be-91c8-4e3a-b359.jpg"
}{
"job_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}{
"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
ApiKeyAuthOAuth2
Body
application/jsonmultipart/form-data
⚠️ DEPRECATED: This parameter is deprecated and will be removed in a future version.
The API now automatically detects garment type without requiring manual specification.
Indicates the garment type for the try-on service. Determines how the garment is applied on the person image.
- auto: Automatically detects if the garment is full-body, upper-body, or lower-body.
- full: Garment covers the full body (e.g., dresses, jumpsuits).
- upper: Garment covers the upper body (e.g., shirts, jackets).
- lower: Garment covers the lower body (e.g., pants, skirts).
Available options:
auto, full, upper, lower