Pixelforge Clothing VTON API Documentation

Virtual Try-on V2 - Request Code

POST https://gateway.pixazo.ai/virtual-tryon/v1/r-vton Content-Type: application/json Cache-Control: no-cache Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY { "category": "upper_body", "garm_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/tshirtShortSleeve.jpg", "human_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png", "crop": true, "seed": 40, "steps": 30, "force_dc": false, "mask_only": false, "garment_des": "cute pink top" }
import requests url = "https://gateway.pixazo.ai/virtual-tryon/v1/r-vton" headers = { "Content-Type": "application/json", "Cache-Control": "no-cache", "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY" } data = { "category": "upper_body", "garm_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/tshirtShortSleeve.jpg", "human_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png", "crop": True, "seed": 40, "steps": 30, "force_dc": False, "mask_only": False, "garment_des": "cute pink top" } response = requests.post(url, json=data, headers=headers) print(response.json())
fetch('https://gateway.pixazo.ai/virtual-tryon/v1/r-vton', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY' }, body: JSON.stringify({ category: 'upper_body', garm_img: 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/tshirtShortSleeve.jpg', human_img: 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png', crop: true, seed: 40, steps: 30, force_dc: false, mask_only: false, garment_des: 'cute pink top' }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/virtual-tryon/v1/r-vton" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" --data-raw "{ \"category\": \"upper_body\", \"garm_img\": \"https://pub-582b7213209642b9b995c96c95a30381.r2.dev/tshirtShortSleeve.jpg\", \"human_img\": \"https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png\", \"crop\": true, \"seed\": 40, \"steps\": 30, \"force_dc\": false, \"mask_only\": false, \"garment_des\": \"cute pink top\" }"
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; public class VirtualTryOn { public static void main(String[] args) throws Exception { String json = """ { "category": "upper_body", "garm_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/tshirtShortSleeve.jpg", "human_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png", "crop": true, "seed": 40, "steps": 30, "force_dc": false, "mask_only": false, "garment_des": "cute pink top" } """; HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://gateway.pixazo.ai/virtual-tryon/v1/r-vton")) .header("Content-Type", "application/json") .header("Cache-Control", "no-cache") .header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
<?php $url = 'https://gateway.pixazo.ai/virtual-tryon/v1/r-vton'; $data = [ 'category' => 'upper_body', 'garm_img' => 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/tshirtShortSleeve.jpg', 'human_img' => 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png', 'crop' => true, 'seed' => 40, 'steps' => 30, 'force_dc' => false, 'mask_only' => false, 'garment_des' => 'cute pink top' ]; $jsonData = json_encode($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Cache-Control: no-cache', 'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY' ]); $response = curl_exec($ch); curl_close($ch); echo $response; ?>

Output

Successful API response:

{ "id": "zdj7tm1g5drj20ckswnsw3jmgc" }

Request Body - Virtual Try-on V2

Parameters for /r-vton:

ParameterRequiredTypeDescription
categoryYesstringDefault: "upper_body", Category of garment
garm_imgYesstringGarment, should match the category, can be a product image or even a photo of someone
human_imgYesstringModel, if this is not 3:4 check crop
cropNostringDefault: false
seedNostringDefault: 42, The seed value for random number generation to ensure reproducibility.
stepsNostringDefault: 30, The number of steps for the transformation process.
force_dcNostringDefault: false, Use the DressCode version of IDM-VTON (this is default false, except if category=dresses)
mask_onlyNostringDefault: false, Return only the mask
garment_desNostringDescription of garment e.g. Short Sleeve Round Neck T-shirt

Example Request - Virtual Try-on V2

JSON
{ "category": "upper_body", "garm_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/tshirtShortSleeve.jpg", "human_img": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png", "crop": true, "seed": 40, "steps": 30, "force_dc": false, "mask_only": false, "garment_des": "cute pink top" }

Response - Virtual Try-on V2

JSON
{ "id": "zdj7tm1g5drj20ckswnsw3jmgc" }

Request Headers

HeaderDescription
Content-Typeapplication/json
Cache-Controlno-cache
Ocp-Apim-Subscription-KeyYour subscription key for authentication

Response Handling

The virtual Tryon returns specific HTTP status codes and response bodies to indicate the success or failure of a request. Developers should implement error handling in their applications to manage these responses effectively.

Common Status Codes and Responses

Status CodeDescriptionResponse Body
200Success - The request was successfully processed.{ "success": true, ... }
Bad Request - The request contains invalid parameters or missing fields.{ "error": "Invalid request parameters" }
401Unauthorized - The provided subscription key is missing or invalid.{ "error": "Invalid or missing authentication" }
403Forbidden - The subscription does not have access to this API or action.{ "error": "Access denied for this operation" }
404Not Found - The requested resource or endpoint could not be found.{ "error": "Endpoint not found" }
Too Many Requests - The request rate limit has been exceeded.{ "error": "Rate limit exceeded, please retry later" }
500Internal Server Error - An unexpected error occurred on the server.{ "error": "An unexpected error occurred, please try again later" }

Example Error Response

{ "error": "Invalid parameters" }

Retrieving Results

After submitting your request, use this endpoint to check status and retrieve results.

Endpoint

POST https://gateway.pixazo.ai/vton-polling/v1/r-vton-get-image

Request Body

{ "id": "zdj7tm1g5drj20ckswnsw3jmgc" }

Example Requests

POST https://gateway.pixazo.ai/vton-polling/v1/r-vton-get-image Content-Type: application/json Cache-Control: no-cache { "id": "zdj7tm1g5drj20ckswnsw3jmgc" }
import requests url = "https://gateway.pixazo.ai/vton-polling/v1/r-vton-get-image" headers = { "Content-Type": "application/json", "Cache-Control": "no-cache" } data = { "id": "zdj7tm1g5drj20ckswnsw3jmgc" } response = requests.post(url, json=data, headers=headers) print(response.json())
fetch('https://gateway.pixazo.ai/vton-polling/v1/r-vton-get-image', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Cache-Control': 'no-cache' }, body: JSON.stringify({ id: 'zdj7tm1g5drj20ckswnsw3jmgc' }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/vton-polling/v1/r-vton-get-image" -H "Content-Type: application/json" -H "Cache-Control: no-cache" --data-raw "{ \"id\": \"zdj7tm1g5drj20ckswnsw3jmgc\" }"
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.time.Duration; public class PollingCheck { public static void main(String[] args) throws Exception { String json = """ { "id": "zdj7tm1g5drj20ckswnsw3jmgc" } """; HttpClient client = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) .build(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://gateway.pixazo.ai/vton-polling/v1/r-vton-get-image")) .header("Content-Type", "application/json") .header("Cache-Control", "no-cache") .POST(HttpRequest.BodyPublishers.ofString(json)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } }
<?php $url = 'https://gateway.pixazo.ai/vton-polling/v1/r-vton-get-image'; $data = [ 'id' => 'zdj7tm1g5drj20ckswnsw3jmgc' ]; $jsonData = json_encode($data); $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Cache-Control: no-cache' ]); $response = curl_exec($ch); curl_close($ch); echo $response; ?>

Response

{ "status": "succeeded", "output": "IMAGE_URL" }

Pixelforge Clothing VTON API Pricing

Resolution Price (USD)
All Resolution$0.14