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_KEYProduction 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
/api/virtual_try_onVirtual outfit Try-On using Google Vertex AI. Upload a person image and clothing image to preview how outfits look before buying.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| personImage | file (formData) | Required | Image of the person wearing the product. |
| productImage | file (formData) | Required | Product image (garment) to try on. |
Task Status Endpoint
/api/task-status/{task_id}Get the status of a task and retrieve the processed image URL.
| Name | Type | Required | Description |
|---|---|---|---|
| task_id | string (path) | Required | The 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 Code | Description |
|---|---|
| 200 | Successfully retrieved task status. |
| 400 | Bad request. |
| 401 | Unauthorized. |
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}