# Clothes Tryon

Our Virtual Try-On Clothes endpoint provides realistic garment visualization using only one photo of a person and one of a garment. It’s our most advanced AI model for try-on experiences, built to deliver high-quality, detailed results with minimal setup.

{% hint style="info" %}
Model Specifications

* **Processing Resolution**: 864×1296 pixels
* **Processing Time**:
  * Performance: 6 seconds
  * Balanced: 9 seconds
  * Quality: 12–18 seconds (depending on input resolution)
* **Tryon Cost**: 1 per image
  {% endhint %}

### Request <a href="#request" id="request"></a>

Generate a virtual try-on by sending your model and garment images to following endpoint:

> **POST** `https://tryiton.now/api/v1/tryon/clothes`

**Request Examples**

{% tabs %}
{% tab title="cURL" %}

```python
curl -X POST "https://tryiton.now/api/v1/tryon/clothes" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model_image": "https://example.com/path/to/model.png",
    "garment_image": "https://example.com/path/to/garment.png"
  }'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
fetch('https://tryiton.now/api/v1/tryon/clothes', {
  method: 'POST',
  body: JSON.stringify({
    model_image: "https://example.com/path/to/model.png",
    garment_image: "https://example.com/path/to/garment.png"
  }),
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  }
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
 
response = requests.post(
  "https://tryiton.now/api/v1/tryon/clothes",
  headers={
    "Authorization": "Bearer YOUR_API_KEY", 
    "Content-Type": "application/json"
  },
  json={
    "model_image": "https://example.com/path/to/model.png",
    "garment_image": "https://example.com/path/to/garment.png"
  }
)
```

{% endtab %}
{% endtabs %}

**Response**

{% tabs %}
{% tab title="200" %}
Returns a job ID for status polling:

<details>

<summary><strong>Response</strong></summary>

```python
{
  "id": "64b7f1a9d9a3b8e5c7f9a123",
  "error": null
}
```

</details>
{% endtab %}
{% endtabs %}

### Request Parameters <a href="#request-parameters" id="request-parameters"></a>

#### Required Parameters <a href="#required-parameters" id="required-parameters"></a>

{% hint style="info" %}

#### `model_image`                                                                                                                                         image URL | base64

Primary image of the person on whom the virtual try-on will be performed.
{% endhint %}

{% hint style="info" %}

#### `garment_image`                                                                                                                                    image URL | base64

Reference image of the clothing item to be tried on the `model_image`
{% endhint %}

{% hint style="danger" %}
**Base64 Format**

Base64 images must include the proper prefix (for example, `data:image/jpg;base64,<YOUR_BASE64>`)
{% endhint %}

<figure><img src="/files/IjId155YgCibXjAdlWSk" alt=""><figcaption></figcaption></figure>

#### Optional Parameters <a href="#optional-parameters" id="optional-parameters"></a>

{% hint style="info" %}

#### `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`
{% endhint %}

{% hint style="info" %}

#### `segmentation_free`                                                                                                                                                  boolean

Performs direct garment fitting without clothing segmentation, allowing bulkier garments to be tried on while better preserving body shape and skin texture. Set this to `false` if the original garments are not being removed correctly.

**Default:** `true`
{% endhint %}

{% hint style="info" %}

#### `moderation_level`                                                                                               'conservative' | 'permissive' | 'none'

Sets the content moderation level for garment images.

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

**Default:** `permissive`
{% endhint %}

{% hint style="danger" %}
**Responsible Use Notice**

This technology is designed for ethical virtual try-on applications. Any misuse, such as generating inappropriate images without consent, is a violation of our [Terms of Service](https://tryiton.now/legal/tos).

Setting `moderation_level: none` does not remove your responsibility for ethical and lawful use. \
**Violations may result in service denial**.
{% endhint %}

{% hint style="info" %}

#### `garment_photo_type`                                                                                                               'auto' | 'flat-lay' | 'model'

Defines the type of garment photo to help optimize internal settings for better results. Use 'model' for photos of garments worn by a model, 'flat-lay' for flat-lay or ghost mannequin images, and 'auto' to let the system automatically detect the photo type.

**Default:** `auto`
{% endhint %}

{% hint style="info" %}

#### `mode`                                                                                                                            'performance' | 'balanced' | 'quality'

Specifies the mode of operation.

* `performance` mode is faster but may compromise quality
* `balanced` mode offers an ideal compromise between speed and quality
* `quality` mode is slower, but delivers the highest quality results

Default: `balanced`                           &#x20;
{% endhint %}

{% hint style="info" %}

#### `seed`                                                                                                                                                                                               int

Specifies how many images to generate in one run. Since image generation involves some randomness, creating multiple images at once increases the chance of getting a good result.

**Default**: `42`\
**Min**: `0`\
**Max**: `2^32 - 1`
{% endhint %}

{% hint style="info" %}

#### `num_samples`                                                                                                                                                                             **int**

Specifies how many images to generate in a single run. Because image generation involves some randomness, generating multiple images at once increases the likelihood of getting a good result.

**Default**: `1`\
**Min**: `1`\
**Max**: `4`
{% endhint %}

{% hint style="info" %}

#### `output_format`                                                                                                                                                     'png' | 'jpeg'

Specifies the desired output image format.

* `png`  delivers the highest image quality, making it ideal for content creation and other cases where quality is the top priority
* `jpeg` provides a faster response with slight compression, making it better suited for real-time applications like consumer virtual try-on experiences

**Default:** `png`
{% endhint %}

### Response Polling <a href="#response-polling" id="response-polling"></a>

After submitting your request, poll the status endpoint using the returned job ID. See [API Fundamentals](/api-overview/api-fundamentals.md) for complete polling details.

#### Successful Response <a href="#successful-response" id="successful-response"></a>

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

```json
{
  "id": "64b7f1a9d9a3b8e5c7f9a123",
  "status": "completed",
  "output": [
    "https://cdn.tryiton.now/tryons/XXX/output.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 <a href="#runtime-errors" id="runtime-errors"></a>

If an error occurs during inference (while the model is running), the API will return a 200 status code with a prediction `status: failed`. The response will also include an error object under the error key.

<table><thead><tr><th width="217">Name</th><th width="253">Cause</th><th>Solution</th></tr></thead><tbody><tr><td><code>ImageLoadError</code></td><td>The pipeline couldn’t load the model or garment image from the provided inputs.</td><td><p>For Image URLs:</p><ul><li>Make sure the URL is publicly accessible and not restricted by permissions.</li><li>Verify that the <code>Content-Type</code> header specifies the correct image format (<code>image/jpeg</code> or <code>image/png</code>)</li></ul><p>For Base64-encoded images:</p><ul><li>Prefix the string with <code>data:image/&#x3C;format>;base64</code>where format is the image type (such as <code>jpeg</code> or <code>png</code>)</li></ul></td></tr><tr><td><code>ContentModerationError</code></td><td>Prohibited content was detected in the provided garment image according to your current moderation settings.</td><td><ul><li>If your use case allows, adjust <code>moderation_level</code> to <code>permissive</code> or <code>none</code>.</li><li>Setting <code>moderation_level: none</code> disables content moderation but does not remove your responsibility to ensure ethical and lawful use, as outlined in our <a href="https://tryiton.now/legal/tos">Terms of Service</a>.</li><li>Misuse of this technology such as generating inappropriate imagery of individuals without consent may result in service denial.</li></ul></td></tr><tr><td><code>PoseError</code></td><td>The pipeline couldn’t detect a body pose in either the model image or the garment image (when <code>garment_photo_type</code> is set to model).</td><td>Improve the quality of the model or garment image by following our <a href="#required-parameters">model photo guidelines</a>.</td></tr><tr><td><code>PipelineError</code></td><td>An unexpected error occurred while running the pipeline.</td><td>Retry the request (you won't be charged for failed attempts). If the issue persists, please reach out to us at contact@tryiton.now and include the job ID from the failed attempt to help us locate and address the issue promptly.</td></tr><tr><td><code>ThirdPartyError</code></td><td>A third-party processor encountered an error or refused to process the request.</td><td>This is most likely due to content restrictions enforced by supporting services (such as image captioning). Try adjusting your image inputs. If the issue continues with different inputs, contact contact@tryiton.now with the job ID.</td></tr></tbody></table>

#### The Error Object <a href="#the-error-object" id="the-error-object"></a>

```json
{
  "error": {
    "name": "ErrorName",
    "message": "The error message"
  }
}
```

Example of an error when polling the `/status` endpoint:

```json
{
  "id": "64b7f1a9d9a3b8e5c7f9a123",
  "status": "failed",
  "error": {
    "name": "ImageLoadError",
    "message": "The image could not be found at the specified URL (404)."
  }
}
```

If you encounter an unrecognized error, please contact us at <contact@tryiton.now>

### Related Guides <a href="#related-guides" id="related-guides"></a>

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

* [**Python Quickstart Guide**](/guides/try-on-python-quickstart.md) - Complete Python implementation examples
* [**JavaScript Quickstart Guide**](/guides/try-on-javascript-quickstart.md) - Complete JavaScript implementation examples
* [**Data Retention & Privacy**](/api-overview/data-retention-and-privacy.md) - Understand how TryItOn handles your data


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tryiton.now/api-reference/clothes-tryon.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
