Pixelforge Accessories VTON API Documentation

Glass Virtual Try On - Request Code

POST https://gateway.pixazo.ai/glass-virtual-try-on/v1/api/glass-virtual-tryon HTTP/1.1
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "model_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png",
  "glass_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png",
  "num_images": 1,
  "output_format": "jpeg"
}
import requests
import json

url = "https://gateway.pixazo.ai/glass-virtual-try-on/v1/api/glass-virtual-tryon"

headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}

data = {
    "model_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png",
    "glass_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png",
    "num_images": 1,
    "output_format": "jpeg"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
const url = 'https://gateway.pixazo.ai/glass-virtual-try-on/v1/api/glass-virtual-tryon';

const data = {
    model_image_path: 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png',
    glass_image_path: 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png',
    num_images: 1,
    output_format: 'jpeg'
};

fetch(url, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Cache-Control': 'no-cache',
        'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/glass-virtual-try-on/v1/api/glass-virtual-tryon" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
--data-raw '{
    "model_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png",
    "glass_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png",
    "num_images": 1,
    "output_format": "jpeg"
}'
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 ApiExample {
    public static void main(String[] args) throws Exception {
        String url = "https://gateway.pixazo.ai/glass-virtual-try-on/v1/api/glass-virtual-tryon";
        
        String json = "{" + "\n" +
            "  \"model_image_path\": \"https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png\"," + "\n" +
            "  \"glass_image_path\": \"https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png\"," + "\n" +
            "  \"num_images\": 1," + "\n" +
            "  \"output_format\": \"jpeg\"" + "\n" +
            "}";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Content-Type", "application/json")
            .header("Cache-Control", "no-cache")
            .header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY")
            .timeout(Duration.ofSeconds(10))
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
<?php
$url = 'https://gateway.pixazo.ai/glass-virtual-try-on/v1/api/glass-virtual-tryon';

$data = [
    'model_image_path' => 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png',
    'glass_image_path' => 'https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png',
    'num_images' => 1,
    'output_format' => 'jpeg'
];

$jsonData = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Cache-Control: no-cache',
    'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo $response;
?>

Output

Successful API response:

{ "success": true, "request_id": "abc-123-xyz", "status": "submitted" }

Request Body - Glass Virtual Try On

Parameters for https://gateway.pixazo.ai/glass-virtual-try-on/v1/api/glass-virtual-tryon:

ParameterRequiredTypeDescription
model_image_pathYesstringSupport inputting image Base64 encoding or image URL (ensure accessibility). Ex: https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png. Please note, if you use the Base64 method, make sure all image data parameters you pass are in Base64 encoding format. When submitting data, do not add any prefixes to the Base64-encoded string, such as data:image/png;base64. The correct parameter format should be the Base64-encoded string itself. Supported image formats include .jpg / .jpeg / .png. The image file size cannot exceed 10MB, and the image resolution should not be less than 300*300px
glass_image_pathNostringDefault: null. Support inputting image Base64 encoding or image URL (ensure accessibility). Ex: https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png. Please note, if you use the Base64 method, make sure all image data parameters you pass are in Base64 encoding format. When submitting data, do not add any prefixes to the Base64-encoded string, such as data:image/png;base64. The correct parameter format should be the Base64-encoded string itself. Supported image formats include .jpg / .jpeg / .png. The image file size cannot exceed 10MB, and the image resolution should not be less than 300*300px
num_imagesNonumberDefault: 1. Number of images to generate
output_formatNostringDefault: "jpeg". Output format for the images. Possible values: "jpeg", "png"

Example Request - Glass Virtual Try On

JSON
{
  "model_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/model.png",
  "glass_image_path": "https://pub-582b7213209642b9b995c96c95a30381.r2.dev/Capturade-tela-2025-07-17%20171034.png",
  "num_images": 1,
  "output_format": "jpeg"
}

Response - Glass Virtual Try On

JSON
{
  "success": true,
  "request_id": "abc-123-xyz",
  "status": "submitted",
  "message": "Request submitted"
}

Request Headers

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

Response Handling

The Glass Virtual Try On 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/glass-virtual-try-on-polling/api/glass-virtual-tryon-result

Request Body

{ "request_id": "abc-123-xyz" }
POST https://gateway.pixazo.ai/glass-virtual-try-on-polling/api/glass-virtual-tryon-result HTTP/1.1
Content-Type: application/json
Cache-Control: no-cache
Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY

{
  "request_id": "abc-123-xyz"
}
import requests
import json

url = "https://gateway.pixazo.ai/glass-virtual-try-on-polling/api/glass-virtual-tryon-result"

headers = {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    "Ocp-Apim-Subscription-Key": "YOUR_SUBSCRIPTION_KEY"
}

data = {
    "request_id": "abc-123-xyz"
}

response = requests.post(url, headers=headers, json=data)
print(response.json())
const url = 'https://gateway.pixazo.ai/glass-virtual-try-on-polling/api/glass-virtual-tryon-result';

const data = {
    request_id: 'abc-123-xyz'
};

fetch(url, {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Cache-Control': 'no-cache',
        'Ocp-Apim-Subscription-Key': 'YOUR_SUBSCRIPTION_KEY'
    },
    body: JSON.stringify(data)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
curl -v -X POST "https://gateway.pixazo.ai/glass-virtual-try-on-polling/api/glass-virtual-tryon-result" \
-H "Content-Type: application/json" \
-H "Cache-Control: no-cache" \
-H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY" \
--data-raw '{
    "request_id": "abc-123-xyz"
}'
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 PollingExample {
    public static void main(String[] args) throws Exception {
        String url = "https://gateway.pixazo.ai/glass-virtual-try-on-polling/api/glass-virtual-tryon-result";
        
        String json = "{" + "\n" +
            "  \"request_id\": \"abc-123-xyz\"" + "\n" +
            "}";

        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create(url))
            .header("Content-Type", "application/json")
            .header("Cache-Control", "no-cache")
            .header("Ocp-Apim-Subscription-Key", "YOUR_SUBSCRIPTION_KEY")
            .timeout(Duration.ofSeconds(10))
            .POST(HttpRequest.BodyPublishers.ofString(json))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
<?php
$url = 'https://gateway.pixazo.ai/glass-virtual-try-on-polling/api/glass-virtual-tryon-result';

$data = [
    'request_id' => 'abc-123-xyz'
];

$jsonData = json_encode($data);

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    'Cache-Control: no-cache',
    'Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY'
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo $response;
?>

Response

{
  "request_id": "37be1b13XXXXXX",
  "status": "completed",
  "image_url": "https://example.com/generated-image.jpg",
  "content_type": "image/jpeg",
  "file_size": 174795
}

Pixelforge Accessories VTON API Pricing

Resolution Price (USD)
All Resolution$0.3

Ready to generate Pixelforge Accessories VTON API assets?

Start with an API key, then automate your pipeline.