Getting Started with WillItFit
Learn how to integrate virtual try-on into your application in just a few minutes.
Overview
WillItFit provides a powerful API for virtual try-on functionality. You can integrate it into your application using our REST API, official SDKs, or the JavaScript widget. This guide will walk you through the basics to get you up and running quickly.
What you'll need:
- • A WillItFit account (free tier available)
- • An API key from your dashboard
- • Node.js 18+ (for SDK usage)
Create Your Account
First, create a free WillItFit account. Our free tier includes 100 try-ons per month at no cost, perfect for testing and small projects.
Get Your API Key
Once you've created your account, navigate to the API Keys section in your dashboard to generate your API key. This key authenticates your requests to the WillItFit API.
- Store your API key securely (use environment variables)
- Never expose your API key in client-side code
- Rotate keys periodically for security
Install the SDK
Install our JavaScript SDK using npm, yarn, or pnpm. The SDK provides a convenient wrapper around our REST API with TypeScript support.
# Using npm
npm install @willitfit/sdk
# Using yarn
yarn add @willitfit/sdk
# Using pnpm
pnpm add @willitfit/sdkMake Your First Request
Now you're ready to make your first virtual try-on request. Here's a simple example:
1 import { WillItFit } from '@willitfit/sdk'; 2 3 // Initialize the client 4 const client = new WillItFit({ 5 apiKey: process.env.WILLITFIT_API_KEY, 6 }); 7 8 // Create a virtual try-on 9 async function tryOnClothes() { 10 try { 11 const result = await client.tryOn.create({ 12 productImageUrl: 'https://example.com/dress.jpg', 13 userPhoto: base64ImageString, // Base64 encoded user photo 14 productCategory: 'dress', // Optional: 'dress', 'top', 'pants', etc. 15 }); 16 17 console.log('Result:', result); 18 // Result contains: 19 // - resultImageUrl: URL to the processed image 20 // - fitScore: 0-100 score indicating fit quality 21 // - recommendations: Array of fit recommendations 22 } catch (error) { 23 console.error('Error:', error.message); 24 } 25 } 26 27 tryOnClothes();
Try it yourself!
Copy this code and replace YOUR_API_KEY with your actual key.
Next Steps
Now that you've made your first request, here are some resources to help you integrate WillItFit into your application: