Virtual Try-On API
The Try-On API allows you to programmatically apply garments to person images.
Endpoints
Core endpoints for virtual try-on integration.
Upload Person Image
Upload a person's photo to the virtual try-on system. This stores the image and returns a tryon_person_image_id which you will need for the task generation.
Parameters
- imageRequiredThe person's photo file.
- image_nameOptionalA label for the image (e.g., 'front_model_1').
Headers
x-api-key: "YOUR_API_KEY"
Content-Type: "multipart/form-data"
{
"id": 181,
"image_url": "https://cdn.vtryon.com/img/..."
}List Person Images
Retrieves a paginated list of all person images you have uploaded.
Parameters
- image_nameOptionalFilter by image name (e.g., 'front_model_1').
- pageOptionalThe page number to retrieve (e.g., page=1).
- page_sizeOptionalThe number of items to return per page (e.g., page_size=10).
Headers
x-api-key: "YOUR_API_KEY"
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 181,
"image_url": "https://cdn.vtryon.com/img/...",
"image_name": "front_model"
}
]
}Delete Person Image
Permanently deletes a specific person image from the system using its ID.
Parameters
- person_image_idRequiredUnique ID of the person image to delete.
Headers
x-api-key: "YOUR_API_KEY"
{
"detail": "Deleted successfully"
}Upload Garment Image
Upload the garment photo file. This returns a unique garment_image_id for the uploaded clothing item.
Parameters
- imageRequiredThe garment photo file.
- image_nameOptionalA label for the garment (e.g., 'red_tshirt').
Headers
x-api-key: "YOUR_API_KEY"
Content-Type: "multipart/form-data"
{
"id": 88,
"image_url": "https://cdn.vtryon.com/img/garments/..."
}List Garment Images
Retrieves a list of all garment images stored in your library.
Parameters
- image_nameOptionalFilter by image name (e.g., 'red_tshirt').
- pageOptionalThe page number to retrieve (e.g., page=1).
- page_sizeOptionalThe number of items to return per page (e.g., page_size=10).
Headers
x-api-key: "YOUR_API_KEY"
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 88,
"image_url": "https://cdn.vtryon.com/img/garments/...",
"image_name": "red_tshirt"
}
]
}Delete Garment Image
Permanently deletes a specific garment image from your library using its ID.
Parameters
- idRequiredUnique ID of the garment image to delete.
Headers
x-api-key: "YOUR_API_KEY"
{
"detail": "Deleted successfully"
}Validate Person Image (Recommended)
Check if the uploaded person image is suitable for the AI model (e.g., correct lighting, pose, and visibility). Returns validation details indicating whether the image passes quality checks.
Parameters
- tryon_person_image_idRequiredID of the person image to validate.
Headers
x-api-key: "YOUR_API_KEY"
Body (JSON)
{
"tryon_person_image_id": 185
}{
"tryon_person_image_id": 185,
"is_valid": true,
"issues": []
}Get Validation Result
Retrieve the existing validation result for a person image to check its suitability.
Parameters
- tryon_person_image_idRequiredID of the person image.
Headers
x-api-key: "YOUR_API_KEY"
{
"tryon_person_image_id": 185,
"is_valid": true,
"issues": []
}Initiate the Try-On Task
Once you have valid IDs for both the person and the garment, you can start the generation job. The API queues the task for processing and returns a Task Object.
Parameters
- tryon_person_image_idRequiredUnique ID of the uploaded person photo.
- garment_image_idsRequiredArray of garment IDs to apply.
Headers
x-api-key: "YOUR_API_KEY"
Body (JSON)
{
"tryon_person_image_id": 181,
"garment_image_ids": [88]
}{
"id": 200,
"status": "queued",
"created_at": "2024-05-05T12:00:00Z"
}List All Try-On Tasks
Retrieves a paginated list of all virtual try-on tasks associated with your account.
Parameters
- garment_imagesOptionalFilter tasks by garment image ID.
- tryon_person_imageOptionalFilter tasks by person image ID.
- pageOptionalThe page number to retrieve (e.g., page=1).
- page_sizeOptionalThe number of items to return per page (e.g., page_size=10).
Headers
x-api-key: "YOUR_API_KEY"
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 200,
"status": "completed",
"tryon_person_image": 181,
"garment_image_ids": [88],
"result_url": "https://cdn.vtryon.com/res/...",
"created_at": "2024-05-05T12:05:00Z"
}
]
}Poll for Task Status & Results
Because AI image generation is asynchronous, you must poll the server (e.g., every 3-5 seconds) to get the final image.
Task Statuses
Headers
x-api-key: "YOUR_API_KEY"
{
"id": 200,
"status": "completed",
"result_url": "https://cdn.vtryon.com/res/..."
}