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.ai

Available Endpoints

POST/v1/tryonCreate a virtual try-on session
GET/v1/tryon/:idGet try-on result by ID
GET/v1/sessionsList all sessions
POST/v1/measurementsSubmit body measurements
GET/v1/products/:idGet product analysis

Authentication

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_KEY
Example Requestbash
curl -X GET https://api.willitfit.ai/v1/sessions \
  -H "Authorization: Bearer YOUR_API_KEY"

Try-On API

Create Try-OnPOST /v1/tryon
Create 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

FieldTypeRequiredDescription
productImageUrlstringYesURL of the product image
userPhotostringYesBase64 encoded user photo
productCategorystringNodress, top, pants, jacket, skirt
sessionIdstringNoCustom session identifier

Sessions API

List SessionsGET /v1/sessions
Retrieve 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 MeasurementsPOST /v1/measurements
Submit 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 successfully
400Bad Request - Invalid request parameters
401Unauthorized - Invalid or missing API key
403Forbidden - Insufficient permissions
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Something went wrong on our end

Rate 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