HomeFAQDetails
Back to all questions
Developer Integration

How do I set up the virtual try-on SDK on my website?

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.

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

POSThttps://apisdk.snapmydesign.com/api/v1/vton/generate

Trigger 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

ParameterTypeRequiredDescription
model_namestringYesChoose: 'fast', 'medium', or 'quality'.
inputClothesImageUrlsList[string]YesList of 1 to 4 garment image URLs (obtained from /vton/upload or public URLs).
inputPersonImageUrlsList[string]NoList of up to 4 reference model URLs.
promptstringNoOptional instruction prompt. If blank, is auto-generated.
userIdstringNoOptional. The developer account user ID.
versionnumberNoModel 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?

View Full API Reference