fashn-logo
FASHNAI

FASHN Virtual Try-On v1.6

Virtual Try-On v1.6 enables realistic garment visualization using just a single photo of a person and a garment. It’s our most advanced AI model for try-on experiences, designed to deliver high-quality, detailed results with minimal setup.

Model Specifications
  • Model Name: tryon-v1.6
  • Processing Resolution: 864×1296 pixels
  • Processing Time:
    • Performance: 5 seconds
    • Balanced: 8 seconds
    • Quality: 12–17 seconds (variable depending on input resolution)

Request

Generate a virtual try-on by submitting your model and garment images to the universal /v1/run endpoint:

POSThttps://api.fashn.ai/v1/run

Request Examples

curl -X POST https://api.fashn.ai/v1/run \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
           "model_name": "tryon-v1.6",
           "inputs": {
             "model_image": "http://example.com/path/to/model.jpg",
             "garment_image": "http://example.com/path/to/garment.jpg"
           }
         }'

Response

Returns a prediction ID for status polling:

{
  "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1",
  "error": null
}

Request Parameters

Required Parameters

model_image
Required
image URL | base64

Primary image of the person on whom the virtual try-on will be performed.

Models Studio users can use their saved models by passing saved:<model_name>.

garment_image
Required
image URL | base64

Reference image of the clothing item to be tried on the model_image.

Base64 Format

Base64 images must include the proper prefix (e.g., data:image/jpg;base64,<YOUR_BASE64>)

Optional Parameters

category'auto' | 'tops' | 'bottoms' | 'one-pieces'

Use auto to enable automatic classification of the garment type. For flat-lay or ghost mannequin images, the system detects the garment type automatically. For on-model images, full-body shots default to a full outfit swap. For focused shots (upper or lower body), the system selects the most likely garment type (tops or bottoms).

Default: auto

segmentation_freeboolean

Direct garment fitting without clothing segmentation, enabling bulkier garment try-ons with improved preservation of body shape and skin texture. Set to false if original garments are not removed properly.

Default: true

moderation_level'conservative' | 'permissive' | 'none'

Sets the content moderation level for garment images.

-conservative enforces stricter modesty standards suitable for culturally sensitive contexts. Blocks underwear, swimwear, and revealing outfits.
-permissive allows swimwear, underwear, and revealing garments, while still blocking explicit nudity.
-none disables all content moderation

Default: permissive

Responsible Use Notice

This technology is designed for ethical virtual try-on applications. Misuse—such as generating inappropriate imagery without consent—violates our Terms of Service.

Setting moderation_level: none does not remove your responsibility for ethical and lawful use. Violations may result in service denial.

garment_photo_typeauto | flat-lay | model

Specifies the type of garment photo to optimize internal parameters for better performance. 'model' is for photos of garments on a model, 'flat-lay' is for flat-lay or ghost mannequin images, and 'auto' attempts to automatically detect the photo type.

Default: auto

modeperformance | balanced | quality

Specifies the mode of operation.

-performance mode is faster but may compromise quality
-balanced mode is a perfect middle ground between speed and quality
-quality mode is slower, but delivers the highest quality results.

Default: balanced

seedint

Sets random operations to a fixed state. Use the same seed to reproduce results with the same inputs, or different seed to force different results.

Default: 42
Min: 0
Max: 2^32 - 1

num_samplesint

Number of images to generate in a single run. Image generation has a random element in it, so trying multiple images at once increases the chances of getting a good result.

Default: 1
Min: 1
Max: 4

output_format'png' | 'jpeg'

Specifies the desired output image format.

-png: Delivers the highest quality image, ideal for use cases such as content creation where quality is paramount.
-jpeg: Provides a faster response with a slightly compressed image, more suitable for real-time applications like consumer virtual try-on experiences.

Default: png

return_base64boolean

When set to true, the API will return the generated image as a base64-encoded string instead of a CDN URL. The base64 string will be prefixed according to the output_format (e.g., data:image/png;base64,... or data:image/jpeg;base64,...).

This option offers enhanced privacy as user-generated outputs are not stored on our servers when return_base64 is enabled.

Default: false

Response Polling

After submitting your request, poll the status endpoint using the returned prediction ID. See API Fundamentals for complete polling details.

Successful Response

When your virtual try-on completes successfully, the status endpoint will return:

{
  "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1",
  "status": "completed",
  "output": [
    "https://cdn.fashn.ai/123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1/output_0.png"
  ],
  "error": null
}

The output array contains URLs to your generated try-on images showing the model wearing the specified garment. The number of images depends on the num_samples parameter (default: 1).

Runtime Errors

If an error occurs during inference (while running the model), the API will return a 200 status code with a prediction status: failed. Additionally, an error object will be included under the error key in the response.

NameCauseSolution
ImageLoadErrorThe pipeline was unable to load the model or garment image from the provided inputs.For Image URLs:
  • Ensure the URL is publicly accessible and not restricted by permissions.
  • Verify that the Content-Type header specifies the correct image format (e.g., image/jpeg, image/png).
For Base64-encoded images:
  • Prefix the string with data:image/format;base64, where format is the image type (e.g., jpeg, png).
ContentModerationErrorProhibited content detected in the provided garment image based on your current moderation settings.
  • If your use case allows, adjust moderation_level to permissive or none.
  • Setting moderation_level: none disables content moderation but does not remove your responsibility to ensure ethical and lawful use, as outlined in our Terms of Service.
  • Misuse of this technology—such as generating inappropriate imagery of individuals without consent—may result in service denial.
PoseErrorThe pipeline was unable to detect a body pose in either the model image or the garment image (if the garment_photo_type is set to model).Improve the quality of the model or garment image by following our model photo guidelines.
PipelineErrorAn unexpected error occurred during the execution of the pipeline.Retry the request (you will not be charged for failed attempts). If the issue persists, please reach out to us at support@fashn.ai and include the prediction ID from the failed attempt to help us locate and address the issue promptly.
ThirdPartyErrorA third-party processor failed or refused to handle the request.Most likely caused by content restrictions enforced by supporting services (e.g., image captioning). If that’s the case, try modifying your image inputs. If the issue persists across different inputs, contact support@fashn.ai with the prediction ID.

The Error Object

{
  "error": {
    "name": "PipelineError",
    "message": "The error message"
  }
}

Example of an error when polling the /status endpoint:

{
  "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1",
  "status": "failed",
  "error": {
    "name": "ImageLoadError",
    "message": "Error loading model image: The URL's Content-Type is not an image. Content-Type: text/plain;charset=UTF-8"
  }
}

If you encounter an unrecognized error, please contact us at support@fashn.ai.

For detailed implementation guidance and best practices specific to Virtual Try-On:

On this page