our logo

Virtual Try-On API Documentation

The Virtual Try-On API lets users preview outfits digitally by combining a person image with a clothing item. It is ideal for fashion e‑commerce, styling apps, and virtual fitting rooms.

Introduction

Upload a person image and a garment image, and the API returns a photorealistic render of the person wearing the outfit. You can integrate this into product pages, styling flows, or in‑store kiosks.

Base URL

https://taiapi.aiphotocraft.com/

Authentication

All Virtual Try-On API calls require an API key from the Developer Dashboard.

X-Api-Key: YOUR_API_KEY

Production guidance

For the best UX, run Try-On jobs asynchronously and show progress indicators while the outfit is being rendered.

Virtual Try-On Endpoint

Virtual Try-On

POST/api/virtual_try_on

Virtual outfit Try-On using Google Vertex AI. Upload a person image and clothing image to preview how outfits look before buying.

Parameters

NameTypeRequiredDescription
personImagefile (formData)RequiredImage of the person wearing the product.
productImagefile (formData)RequiredProduct image (garment) to try on.

Task Status Endpoint

GET/api/task-status/{task_id}

Get the status of a task and retrieve the processed image URL.

NameTypeRequiredDescription
task_idstring (path)RequiredThe ID of the task to get the status for.

Example Request

curl -X GET "https://taiapi.aiphotocraft.com/api/task-status/{task_id}"-H "accept: application/json"-H "X-Api-Key: YOUR_API_KEY"

Example Response

{
  "image_url": "https://taiapi.aiphotocraft.com/results/swapped_image.jpg"
}

Response Status Codes

Status CodeDescription
200Successfully retrieved task status.
400Bad request.
401Unauthorized.

Examples

import requests

url = "https://taiapi.aiphotocraft.com/api/virtual_try_on"
headers = {
    "X-Api-Key": "YOUR_API_KEY",
    "accept": "application/json",
}

files = {
    "personImage": ("person.jpg", open("person.jpg", "rb"), "image/jpeg"),
    "productImage": ("product.jpg", open("product.jpg", "rb"), "image/jpeg"),
}

response = requests.post(url, headers=headers, files=files)
response.raise_for_status()
data = response.json()
task_id = data.get("task_id")
print("Task started. Task ID:", task_id)
# Use task_id to check status at /api/task-status/{task_id}