Incorporating virtual try-on on websites is quick and developer-friendly. You can install our npm package (snapit_sdk) for JavaScript frameworks like React, Next.js, and Vue, or simply drop a tiny script tag onto a vanilla HTML site. Comprehensive API parameters, CSS customization options, and initialization guidelines are documented at docs.snapmydesign.com.
Back to all questionsDeveloper Integration
View Full API Reference
How do I set up the virtual try-on SDK on my website?
Developer Reference
Web Axios VTON Generation Request
import axios from 'axios';
// Trigger try-on generation using official API
const response = await axios.post(
"https://apisdk.snapmydesign.com/api/v1/vton/generate",
{
model_name: "medium",
inputClothesImageUrls: ["https://cdn.example.com/garment.jpg"],
userId: "user_abc123",
version: 1.0
},
{
headers: {
"X-API-Key": "smd_live_your_key_here",
"Content-Type": "application/json"
}
}
);
console.log("Generated try-on URL:", response.data.outputImageUrls[0]);REST Endpoint Specification
POST
https://apisdk.snapmydesign.com/api/v1/vton/generateTrigger the virtual try-on rendering engine. This is an asynchronous model call wrapped in a synchronous API endpoint that returns the finished URL when done.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model_name | string | Yes | Choose: 'fast', 'medium', or 'quality'. |
| inputClothesImageUrls | List[string] | Yes | List of 1 to 4 garment image URLs (obtained from /vton/upload or public URLs). |
| inputPersonImageUrls | List[string] | No | List of up to 4 reference model URLs. |
| prompt | string | No | Optional instruction prompt. If blank, is auto-generated. |
| userId | string | No | Optional. The developer account user ID. |
| version | number | No | Model version map: 1.0 or 1.1. |
Sample JSON Response
{
"success": true,
"statusCode": 200,
"message": "success",
"generationId": "50c76d05-4f40-424a-9ef8-11db9390234a",
"outputImageUrls": [
"https://firebasestorage.googleapis.com/.../vton_generated_image..."
],
"inputClothesImageUrls": [
"https://firebasestorage.googleapis.com/.../vton_uploaded_image..."
],
"userId": "user_abc123",
"creditCost": 0.5,
"modelName": "medium",
"version": 1.0
}Looking for more endpoints, models, or credit rates?