API Reference
Complete reference for the WillItFit REST API.
Overview
The WillItFit API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON request bodies, returns JSON responses, and uses standard HTTP response codes, authentication, and verbs.
Base URL
https://api.willitfit.aiAvailable Endpoints
POST
/v1/tryonCreate a virtual try-on sessionGET
/v1/tryon/:idGet try-on result by IDGET
/v1/sessionsList all sessionsPOST
/v1/measurementsSubmit body measurementsGET
/v1/products/:idGet product analysisAuthentication
The WillItFit API uses API keys to authenticate requests. You can manage your API keys from your dashboard. Your API key carries many privileges, so keep it secure!
Authentication Header
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYExample Requestbash
curl -X GET https://api.willitfit.ai/v1/sessions \
-H "Authorization: Bearer YOUR_API_KEY"Try-On API
Create Try-On
POST /v1/tryonCreate a virtual try-on session and get the result.
Request Bodyjson
{
"productImageUrl": "https://example.com/dress.jpg",
"userPhoto": "base64_encoded_image_data",
"productCategory": "dress",
"sessionId": "optional_session_id"
}Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| productImageUrl | string | Yes | URL of the product image |
| userPhoto | string | Yes | Base64 encoded user photo |
| productCategory | string | No | dress, top, pants, jacket, skirt |
| sessionId | string | No | Custom session identifier |
Sessions API
List Sessions
GET /v1/sessionsRetrieve a list of all try-on sessions for your account.
Requestbash
curl -X GET "https://api.willitfit.ai/v1/sessions?limit=10&offset=0" \
-H "Authorization: Bearer YOUR_API_KEY"Measurements API
Submit Measurements
POST /v1/measurementsSubmit body measurements for improved size recommendations.
Request Bodyjson
{
"height": 170,
"weight": 65,
"chest": 90,
"waist": 75,
"hips": 95,
"inseam": 80,
"unit": "cm"
}Error Handling
WillItFit uses conventional HTTP response codes to indicate the success or failure of an API request.
200Success - Request completed successfully400Bad Request - Invalid request parameters401Unauthorized - Invalid or missing API key403Forbidden - Insufficient permissions429Too Many Requests - Rate limit exceeded500Internal Server Error - Something went wrong on our endRate Limits
Rate limits vary by plan. All plans include rate limit headers in responses.
Free:100 requests/hour
Starter:500 requests/hour
Business:2,000 requests/hour
Enterprise:Custom limits