Introduction

Hi, developers, welcome to use FitRoom's API. The following are some basic introductions to your access service. Hope you can find the AI technology capabilities that are suitable for your business here. Thank you for using!

Authentication

All requests must include the X-API-KEY header with the provided API Key.

Example:

curl -X POST https://platform.fitroom.app/api/tryon/v2/tasks \
  -H "X-API-KEY: your-api-key" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "cloth_type=upper"

Image Processing API

The Image Processing API provides a comprehensive solution for virtual try-on functionality, allowing users to visualize how clothing items would look on a model. The process involves four main APIs:

Image Guidelines:

Output Quality:
  • Maximum output image resolution: 2048px (may be increased in future updates)
Performance Tips:
  • Resize your images before uploading to improve processing speed
  • Maintain aspect ratio when resizing to prevent distortion
  • Ensure images are not compressed too heavily to maintain quality

API Overview:

  1. Check Model Image (/api/tryon/input_check/v1/model)

    Optional validation step for model images. This API checks pose, lighting, and image quality, then determines which types of clothing can be tried on. While not mandatory, using this API helps ensure your model image meets the requirements before proceeding with try-on.

  2. Check Clothes Image (/api/tryon/input_check/v1/clothes)

    Optional validation step for clothing images. Analyzes clothing type and quality. This step helps confirm your clothing image is suitable and identifies the correct clothing type (upper, lower, or full body).

  3. Create Try-on Task (/api/tryon/v2/tasks)

    Initiates the virtual try-on process by uploading model and clothing images. Supports both single clothing items and combo try-ons (upper + lower body clothing simultaneously).

  4. Get Task Status (/api/tryon/v2/tasks/:id)

    Retrieves the status and results of a try-on task. Provides progress updates during processing and returns the final rendered image URL upon completion.

Workflow Options:

Quick Workflow:
  1. Create try-on task by directly uploading images
  2. Poll the task status until completion

Note: Consider validating images first if you experience any issues with the results.

Best Practices:

  • Ensure model images are clear, well-lit, and show the full body when possible
  • Use high-quality clothing images with good contrast against their background
  • For combo try-ons, ensure the model pose is suitable for both upper and lower clothing
  • When polling for results, implement appropriate retry intervals (recommended: 1-2 seconds)
  • Implement proper error handling for cases where images don't meet requirements

Check Model Image

POST
/api/tryon/input_check/v1/model

This API is used to validate the suitability of a model image before performing virtual try-on. The API analyzes the following aspects:

  • Determines if the image meets the requirements for try-on processing
  • Analyzes and returns the types of clothing that can be tried on with the model (upper, lower, or full body)
  • Checks and warns about issues with pose, size, and camera angle

Model Image Requirements:

  • Only one person should be present in the image
  • Model must be standing straight and facing forward
  • Person in the image must be clearly visible and of sufficient size
  • Full body shot is recommended for trying different types of clothing
  • Simple background without complex patterns or distractions

Request

Form Data
Parameter Type Required Description
input_image File Yes Model image to check
Curl Example:
curl -X POST https://platform.fitroom.app/api/tryon/input_check/v1/model \
  -H "X-API-KEY: your-api-key" \
  -F "[email protected]"

Response

Success Response (200)
{
    "is_good": true,
    "good_clothes_types": [
        "upper",    // Suitable for tops, shirts, jackets
        "lower",    // Suitable for pants, skirts
        "full"      // Suitable for dresses, jumpsuits
    ]
}
Warning Response (200)
{
    "is_good": true,
    "error_code": "410xxx",    // Warning code
    "good_clothes_types": [
        "upper",
        "lower",
        "full"
    ]
}
Error Response (200)
{
    "is_good": false,
    "error_code": "400xxx",    // Error code
    "good_clothes_types": []   // No suitable clothing types
}
Clothes Types - Available Clothing Categories
Type Description Examples
upper Upper body clothing items T-shirts, shirts, jackets, sweaters, blazers
lower Lower body clothing items Pants, shorts, skirts
full Full body clothing items Dresses, jumpsuits, gowns
Error Codes

Codes starting with 410 are warnings - the API can still process the image but results may not be optimal.
Codes starting with 400 are errors - the API cannot process the image.

Code Type Description
410001 Warning Person is slightly small in the image. Please crop to have good result.
410002 Warning Model pose is undetermined. Please make sure the model is standing straight.
410003 Warning Model pose may be not supported. Please make sure the model is standing straight.
400001 Error No person detected in the image
400002 Error More than one person detected in the image
400003 Error Person is not facing forward
400004 Error Person is too small in the image

Check Clothes Image

POST
/api/tryon/input_check/v1/clothes

This API helps validate clothing images before performing virtual try-on. It analyzes the image to:

  • Determine if the image contains valid clothing that can be processed
  • Identify the type of clothing (upper body, lower body, or full body)
  • Check image quality and suitability for virtual try-on

Image Requirements:

  • Clear, high-resolution image of the clothing item
  • Good lighting and contrast
  • Minimal background distractions
  • Clothing should be displayed flat or on a mannequin
  • The entire clothing item should be visible in the frame

Clothing Types:

  • Upper: Shirts, t-shirts, blouses, jackets, sweaters
  • Lower: Pants, shorts, skirts
  • Full: Dresses, jumpsuits, full-body outfits

Request

Form Data
Parameter Type Required Description
input_image File Yes The clothing image file to validate
Curl Example:
curl -X POST https://platform.fitroom.app/api/tryon/input_check/v1/clothes \
  -H "X-API-KEY: your-api-key" \
  -F "[email protected]"

Response

Success Response (200) - Valid clothing image
{
    "clothes_type": "upper",    // Detected clothing type
    "is_clothes": true         // Image contains valid clothing
}
Warning Response (200) - Potentially unsuitable image
{
    "clothes_type": "upper",    // Detected clothing type
    "is_clothes": false        // Image may not be suitable
}
Response Fields
Field Type Description
clothes_type String The detected type of clothing (upper/lower/full)
is_clothes Boolean Indicates if the image contains valid clothing suitable for try-on
Tips for Best Results:
  • Use images with white or solid color backgrounds
  • Ensure the clothing is well-spread and not wrinkled
  • Avoid images with multiple clothing items
  • Make sure the clothing edges are clearly visible
  • Use front-view images of the clothing

Create Try-on Task

POST
/api/tryon/v2/tasks

This API initiates the virtual try-on process by creating a task that will generate an image of the model wearing the specified clothing. The service supports both single item try-ons and combo try-ons (combining upper and lower body clothing).

Try-on Options:

Single Item Try-on:
  • Upper Body: Try on shirts, t-shirts, jackets, etc.
  • Lower Body: Try on pants, shorts, skirts, etc.
  • Full Body: Try on dresses, jumpsuits, etc.
Combo Try-on:
  • Simultaneously try on both upper and lower body clothing
  • Useful for coordinating complete outfits
  • Requires compatible model pose for both items

Processing Information:

  • Tasks are processed asynchronously in the background
  • Progress can be monitored using the Get Task Status API
  • The final result will be a high-quality image up to 2048px resolution

Request

Form Data (Case 1: Single Clothing Try-on)
Parameter Type Required Description
cloth_image File Yes Clothing image to try on (recommended size: 1024px)
model_image File Yes Model image (recommended size: 2048px)
cloth_type String Yes Type of clothing: "upper", "lower", or "full_set"
hd_mode String No High-definition mode: "true" for better quality output but slower processing (normal: ~9s → HD: ~30s)
Form Data (Case 2: Combo Try-on)
Parameter Type Required Description
cloth_type String Yes Must be "combo" for this case
cloth_image File Yes Upper clothing image (recommended size: 1024px)
lower_cloth_image File Yes Lower clothing image (recommended size: 1024px)
model_image File Yes Model image (recommended size: 2048px)
hd_mode String No High-definition mode: "true" for better quality output but slower processing (normal: ~9s → HD: ~30s)
Best Practices:
  • Resize images to recommended dimensions before uploading for optimal performance
  • Ensure model pose is compatible with the clothing type being tried on
  • For combo try-ons, verify the model image is suitable for both upper and lower clothing
  • Consider validating images using the Check Model/Clothes APIs first if unsure about compatibility
  • Use hd_mode=true when you need higher quality output and can accept longer processing time (~30s vs ~9s)
Curl Example (Case 1: Single Clothing):
curl -X POST https://platform.fitroom.app/api/tryon/v2/tasks \
  -H "X-API-KEY: your-api-key" \
  -F "[email protected]" \
  -F "[email protected]" \
  -F "cloth_type=upper" \
  -F "hd_mode=true"
Curl Example (Case 2: Combo):
curl -X POST https://platform.fitroom.app/api/tryon/v2/tasks \
  -H "X-API-KEY: your-api-key" \
  -F "cloth_image=@upper_cloth.jpg" \
  -F "lower_cloth_image=@lower_cloth.jpg" \
  -F "[email protected]" \
  -F "cloth_type=combo" \
  -F "hd_mode=true"

Response

Success Response (200)
{
    "task_id": "123456",    // Unique identifier for the task
    "status": "CREATED"     // Initial status of the task
}
Response Fields
Field Type Description
task_id String Unique identifier to track the task status and retrieve results
status String Initial status will be "CREATED". Use Get Task Status API to monitor progress.

Get Task Status

GET
/api/tryon/v2/tasks/:id

This API allows you to check the status of a try-on task and retrieve the final result. Since the try-on process runs asynchronously, you'll need to poll this endpoint until the task is completed.

Task Statuses:

Status Description Progress Next Action
CREATED Task has been created and is queued for processing 0% Continue polling
PROCESSING Task is currently being processed 1-99% Continue polling
COMPLETED Task has finished successfully 100% Download result using download_signed_url
FAILED Task processing failed N/A Check error details and retry if needed

Progress Tracking:

  • The progress field indicates the percentage of task completion (0-100)
  • Progress updates are available in real-time during the PROCESSING state
  • You can use this value to show progress bars or completion estimates to users
  • Progress increases as the AI processes different stages of the try-on task

Polling Guidelines:

  • Start polling immediately after creating the task
  • Implement exponential backoff to avoid rate limiting
  • The download_signed_url is temporary and should be used promptly
  • Consider implementing a timeout after extended polling

Request

URL Parameters
Parameter Type Required Description
id String Yes The task_id received from the Create Try-on Task API
Curl Example:
curl -X GET https://platform.fitroom.app/api/tryon/v2/tasks/123456 \
  -H "X-API-KEY: your-api-key"

Response Examples

Initial Status (200)
{
    "task_id": "123456",
    "status": "CREATED",
    "progress": 0,
    "created_at": 1744707904
}
Processing Status (200)
{
    "task_id": "123456",
    "status": "PROCESSING",
    "progress": 45,    // Task is 45% complete
    "created_at": 1744707904,
    "started_at": 1744707904
}
Completed Status (200)
{
    "task_id": "123456",
    "status": "COMPLETED",
    "download_signed_url": "https://storage.googleapis.com/enhance-asia-southeast1-dev/tryon/bc140fd58ece45c493...",
    "progress": 100,
    "created_at": 1744707904,
    "started_at": 1744707904,
    "completed_at": 1744707912
}
Failed Status (200)
{
    "task_id": "123456",
    "status": "FAILED",
    "error": "Failed to process try-on task",
    "created_at": 1744707904,
    "started_at": 1744707904,
    "completed_at": 1744707912
}
Response Fields
Field Type Description
task_id String Unique identifier of the task
status String Current status of the task (CREATED/PROCESSING/COMPLETED/FAILED)
progress Number Processing progress percentage (0-100)
download_signed_url String Temporary URL to download the result image (available when status is COMPLETED)
error String Error message if the task failed (available when status is FAILED)
created_at Number Unix timestamp when the task was created
started_at Number Unix timestamp when processing started
completed_at Number Unix timestamp when processing finished (success or failure)

Rate Limits

To ensure service stability and fair usage, the API has the following rate limit:

  • 60 requests per minute per API key

If you exceed this limit, you will receive a 429 (Too Many Requests) error response. Please ensure your application implements appropriate retry logic with exponential backoff.

Error Codes

Code Type Description
400 Error Bad Request -- Your request is invalid.
401 Error Unauthorized -- Your API key is wrong.
402 Error Payment Required -- Insufficient credit. Please upgrade your plan or purchase more credits.
429 Error Too Many Request -- You requested too much API. Try again later
500 Error Internal Server Error -- We had a problem with our server. Try again later.
503 Error Service Unavailable -- We're temporarily offline for maintenance. Please try again later.