# Virtual Try-On API Reference

{% hint style="info" %}
**Good to know:** A quick start guide can be good to help folks get up and running with your API in a few steps. Some people prefer diving in with the basics rather than meticulously reading every page of documentation!
{% endhint %}

## Get your API keys

Your `API` requests are authenticated using `API` keys. Any request that doesn't include an `API` key will return an `error`.

You can generate an `API` key from your user `dashboard` in [Miragic](https://miragic.ai/) website anytime.

<figure><img src="https://3797193121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ft2ubAKYPEaJXBQZaRNa5%2Fuploads%2FQRG37HdbiuNEPYckUX7g%2FScreenshot%202025-10-10%20084345.png?alt=media&#x26;token=9b926638-0508-4358-8eee-6a9913c50034" alt=""><figcaption></figcaption></figure>

## Authentication

All requests must include the `X-API-Key` header containing your assigned `API` key.

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

```bash
curl -X POST "https://backend.miragic.ai/api/v1/virtual-try-on" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "garmentType=full_body" \
  -F "humanImage=@path/to/human_image.jpg;type=image/jpeg" \
  -F "clothImage=@path/to/cloth_image.jpg;type=image/jpeg"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
import axios from "axios";
import FormData from "form-data";
import fs from "fs";

const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://backend.miragic.ai";

async function virtualTryOn() {
  const url = `${BASE_URL}/api/v1/virtual-try-on`;

  // Prepare form data
  const formData = new FormData();
  formData.append("garmentType", "full_body");
  formData.append("humanImage", fs.createReadStream("path/to/human_image.jpg"));
  formData.append("clothImage", fs.createReadStream("path/to/cloth_image.jpg"));

  try {
    const response = await axios.post(url, formData, {
      headers: {
        ...formData.getHeaders(),
        "X-API-Key": API_KEY,
      },
      maxBodyLength: Infinity, // useful for large files
    });

    console.log("✅ Success!");
    console.log(response.data);
  } catch (error) {
    if (error.response) {
      console.error("❌ API Error:", error.response.status, error.response.data);
    } else {
      console.error("❌ Request Error:", error.message);
    }
  }
}

virtualTryOn();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import time

api_key = 'YOUR_API_KEY' # ← Replace with your actual API key
base_url = 'https://backend.miragic.ai'

def virtualtryon():
    url = f'{base_url}/api/v1/virtual-try-on'
    data = {'garmentType': 'full_body'}

    files=[
    ('humanImage',('human_image.jpg',open('path/to/human_image.jpg','rb'),'image/jpeg')),
    ('clothImage',('cloth_image.jpg',open('path/to/cloth_image.jpg','rb'),'image/jpeg'))
    ]
    headers = {'X-API-Key': api_key}
    response = requests.request("POST", url, headers=headers, data=data, files=files)
    print(response.text)
    
if __name__ == '__main__':
    virtualtryon()
```

{% endtab %}
{% endtabs %}

## How To Create VTO Process

<mark style="background-color:green;">POST</mark>   `/api/v1/virtual-try-on`

This `API` starts the `virtualtry-on` process by creating a task that generates an image of the model wearing the specified clothing. It supports both `single-item try-ons` and `combo try-ons` (upper and lower body clothing combined).

### Try-on Options

<mark style="color:green;">**Single Item Try-on:**</mark>

* `Upper Body`: Try on shirts, t-shirts, jackets, etc.
* `Lower Body`: Try on pants, shorts, skirts, etc.
* `Full Body`: Try on dresses, jumpsuits, etc.

<mark style="color:green;">**Combo Try-on:**</mark>

* Try on upper and lower body clothing simultaneously.
* Particularly useful for coordinating complete outfits.
* Requires a compatible model pose for both items.

{% hint style="info" %}
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 `2048`px resolution
  {% endhint %}

### Request

<mark style="color:green;">**Form Data (Case 1: Single Clothing Try-on)**</mark>

<table><thead><tr><th width="135">Parameter</th><th width="82">Type</th><th width="106">Required</th><th>Description</th></tr></thead><tbody><tr><td>humanImage</td><td>File</td><td>Yes</td><td>Human image (recommended size: <code>2048</code>px)</td></tr><tr><td>clothImage</td><td>File</td><td>Yes</td><td>Garment image to try on (recommended size: <code>1024</code>px)</td></tr><tr><td>garmentType</td><td>String</td><td>Yes</td><td>Type of garment: <code>upper_body</code>, <code>lower_body</code>, or <code>full_body</code></td></tr></tbody></table>

<mark style="color:green;">**Form Data (Case 2: Combo Try-on)**</mark>

<table><thead><tr><th width="180">Parameter</th><th width="86">Type</th><th width="107">Required</th><th>Description</th></tr></thead><tbody><tr><td>garmentType</td><td>String</td><td>Yes</td><td>Can be any text for this case</td></tr><tr><td>clothImage</td><td>File</td><td>Yes</td><td>Upper garment image (recommended size: <code>1024</code>px)</td></tr><tr><td>bottomClothImage</td><td>File</td><td>Yes</td><td>Lower garment image (recommended size: <code>1024</code>px)</td></tr><tr><td>humanImage</td><td>File</td><td>Yes</td><td> Human image (recommended size: <code>2048</code>px)</td></tr></tbody></table>

The best way to interact with our `API` is to use one of our official libraries:

{% hint style="info" %}
**Best Practices:**

* Resize images to the recommended dimensions before uploading to ensure optimal performance.
* Make sure the human’s pose matches the garment type being tried on.
* For combo try-ons, ensure the human image is appropriate for both upper and lower clothing.
  {% endhint %}

<mark style="color:green;">**Request Example (Case 1: Single Clothing Try-on)**</mark>

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

```bash
curl -X POST "https://backend.miragic.ai/api/v1/virtual-try-on" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "garmentType=full_body" \
  -F "humanImage=@path/to/human_image.jpg;type=image/jpeg" \
  -F "clothImage=@path/to/cloth_image.jpg;type=image/jpeg"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
import axios from "axios";
import FormData from "form-data";
import fs from "fs";

const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://backend.miragic.ai";

async function virtualTryOn() {
  const url = `${BASE_URL}/api/v1/virtual-try-on`;

  // Prepare form data
  const formData = new FormData();
  formData.append("garmentType", "full_body");
  formData.append("humanImage", fs.createReadStream("path/to/human_image.jpg"));
  formData.append("clothImage", fs.createReadStream("path/to/cloth_image.jpg"));

  try {
    const response = await axios.post(url, formData, {
      headers: {
        ...formData.getHeaders(),
        "X-API-Key": API_KEY,
      },
      maxBodyLength: Infinity, // useful for large files
    });

    console.log("✅ Success!");
    console.log(response.data);
  } catch (error) {
    if (error.response) {
      console.error("❌ API Error:", error.response.status, error.response.data);
    } else {
      console.error("❌ Request Error:", error.message);
    }
  }
}

virtualTryOn();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import time

api_key = 'YOUR_API_KEY' # ← Replace with your actual API key
base_url = 'https://backend.miragic.ai'

def virtualtryon():
    url = f'{base_url}/api/v1/virtual-try-on'
    data = {'garmentType': 'full_body'}

    files=[
    ('humanImage',('human_image.jpg',open('path/to/human_image.jpg','rb'),'image/jpeg')),
    ('clothImage',('cloth_image.jpg',open('path/to/cloth_image.jpg','rb'),'image/jpeg'))
    ]
    headers = {'X-API-Key': api_key}
    response = requests.request("POST", url, headers=headers, data=data, files=files)
    print(response.text)

if __name__ == '__main__':
    virtualtryon()
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">**Request Example (Case 2: Combo Try-on)**</mark>

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

```bash
curl -X POST "https://backend.miragic.ai/api/v1/virtual-try-on" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "garmentType=comb" \
  -F "humanImage=@path/to/human_image.jpg;type=image/jpeg" \
  -F "clothImage=@path/to/cloth_image.jpg;type=image/jpeg" \
  -F "bottomClothImage=@path/to/bottom_cloth_image.jpg;type=image/jpeg"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
import axios from "axios";
import FormData from "form-data";
import fs from "fs";

const API_KEY = "YOUR_API_KEY";
const BASE_URL = "https://backend.miragic.ai";

async function virtualTryOn() {
  const url = `${BASE_URL}/api/v1/virtual-try-on`;

  // Prepare form data
  const formData = new FormData();
  formData.append("garmentType", "comb");
  formData.append("humanImage", fs.createReadStream("path/to/human_image.jpg"));
  formData.append("clothImage", fs.createReadStream("path/to/cloth_image.jpg"));
  formData.append("bottomClothImage", fs.createReadStream("path/to/bottom_cloth_image.jpg"));

  try {
    const response = await axios.post(url, formData, {
      headers: {
        ...formData.getHeaders(),
        "X-API-Key": API_KEY,
      },
      maxBodyLength: Infinity, // useful for large files
    });

    console.log("✅ Success!");
    console.log(response.data);
  } catch (error) {
    if (error.response) {
      console.error("❌ API Error:", error.response.status, error.response.data);
    } else {
      console.error("❌ Request Error:", error.message);
    }
  }
}

virtualTryOn();
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import time

api_key = 'YOUR_API_KEY' # ← Replace with your actual API key
base_url = 'https://backend.miragic.ai'

def virtualtryon():
    url = f'{base_url}/api/v1/virtual-try-on'
    data = {'garmentType': 'comb'}

    files=[
    ('humanImage',('human_image.jpg',open('path/to/human_image.jpg','rb'),'image/jpeg')),
    ('clothImage',('cloth_image.jpg',open('path/to/cloth_image.jpg','rb'),'image/jpeg')),
    ('bottomClothImage',('bottom_cloth_image.jpg',open('path/to/bottom_cloth_image.jpg','rb'),'image/jpeg'))
    ]
    headers = {'X-API-Key': api_key}
    response = requests.request("POST", url, headers=headers, data=data, files=files)
    print(response.text)

if __name__ == '__main__':
    virtualtryon()
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">**Response (Case 1: Single Clothing Try-on)**</mark>

```bash
{"success":true,"message":"Virtual try-on job created and processing started","data":{"jobId":"25331fb2-d0b0-44bd-b932-44f6fcc85e3e","status":"PENDING","mode":"SINGLE","createdAt":"2025-10-08T13:46:57.867Z"}}
```

<mark style="color:green;">**Response (Case 2: Combo Try-on)**</mark>

```bash
{"success":true,"message":"Virtual try-on job created and processing started","data":{"jobId":"89011007-ea00-4160-9f3d-b15e77b719bc","status":"PENDING","mode":"TOP_BOTTOM","createdAt":"2025-10-08T14:25:18.213Z"}}
```

**Response Field**

<table><thead><tr><th width="107">Field</th><th width="88">Type</th><th>Description</th></tr></thead><tbody><tr><td>jobId</td><td>String</td><td>A unique identifier used to track task status and retrieve results.</td></tr><tr><td>status</td><td>String</td><td>The initial status will be <code>PENDING</code>. Use the <code>Get Task Status API</code> to track progress.</td></tr><tr><td>mode</td><td>String</td><td>String to indicate single clothing try-on(<code>SINGLE</code>) or combo try-on(<code>TOP_BOTTOM</code>).</td></tr><tr><td>createdAt</td><td>String</td><td>Date</td></tr><tr><td>success</td><td>Logic</td><td><code>true</code> or <code>false</code> to indicate whether task is successful or not.</td></tr></tbody></table>

## How To Get Process Status

<mark style="background-color:green;">GET</mark>   `/api/v1/virtual-try-on/:jobId`

This `API` lets you check the status of a try-on task and retrieve the final result. Because the try-on process runs asynchronously, you’ll need to poll this endpoint until the task is finished.

### Task Status:

<table><thead><tr><th width="110">Status</th><th width="213">Description</th><th width="110">Progress</th><th>Next Action</th></tr></thead><tbody><tr><td><code>PENDING</code></td><td>Task is currently being processed.</td><td><code>0</code>~<code>99</code>%</td><td>Continue polling</td></tr><tr><td><code>COMPLETED</code></td><td>Task has finished successfully.</td><td><code>100</code>%</td><td>Download result using download_signed_url</td></tr><tr><td><code>FAILED</code></td><td>Task processing failed.</td><td>N/A</td><td>Check error details and retry if needed</td></tr></tbody></table>

{% hint style="info" %} <mark style="color:green;">**Progress Tracking:**</mark>

* The `progress` field indicates the percentage of task completion (`0`-`100`)
* Progress updates are available in real-time during the `PENDING` state
* Progress increases as the AI processes different stages of the try-on task
  {% endhint %}

{% hint style="info" %}
**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
  {% endhint %}

### Request:

<mark style="color:blue;">**URL Parameters**</mark>

<table><thead><tr><th width="122">Parameter</th><th width="94">Type</th><th width="111">Required</th><th>Description</th></tr></thead><tbody><tr><td>JobId</td><td>String</td><td>Yes</td><td>This value indicates task ID assigned by requesting <code>VTO</code> process <code>API</code></td></tr></tbody></table>

<mark style="color:blue;">**Request Example**</mark>

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

```bash
curl -X GET https://backend.miragic.ai/api/v1/virtual-try-on/25331fb2-d0b0-44f6fcc85e3e \
  -H "X-API-Key: YOUR_API_KEY"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
const fetch = require("node-fetch"); // for Node.js

const apiKey = "YOUR_API_KEY";
const jobId = "25331fb2-d0b0-44f6fcc85e3e";
const url = `https://backend.miragic.ai/api/v1/virtual-try-on/${jobId}`;

const options = {
  method: "GET",
  headers: {
    "X-API-Key": apiKey
  }
};

fetch(url, options)
  .then(response => response.json())
  .then(data => {
    console.log("Response:", data);
  })
  .catch(error => {
    console.error("Error:", error);
  });
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_key = 'YOUR_API_KEY' # ← Replace with your actual API key
job_id = "25331fb2-d0b0-44f6fcc85e3e"
url = f"https://backend.miragic.ai/api/v1/virtual-try-on/{job_id}"

headers = {
    "X-API-Key": api_key
}
response = requests.get(url, headers=headers)

# Print status code and response JSON
print("Status Code:", response.status_code)
print("Response:", response.json())
```

{% endtab %}
{% endtabs %}

<mark style="color:blue;">**Response Example**</mark>

#### Completed Status (200):

```bash
{
    'success': True,
    'data': {
        'id': '25331fb2-d0b0-44f6fcc85e3e',
        'status': 'COMPLETED', 
        'mode': 'SINGLE', 
        'humanImagePath': 'https://backend.miragic.ai/uploads/temp/1759935012047-9783377-1.jpg', 
        'clothImagePath': 'https://backend.miragic.ai/uploads/virtualtryon/original/clothes/single/0f01f45d-37e5-4796-ae1d-aca695a0d792/3baecbdb-d7fe-4599-b542-b86f4d28fa90.jpg', 
        'bottomClothImagePath': None, 
        'resultImagePath': 'https://backend.miragic.ai/uploads/virtualtryon/processed/single/0f01f45d-37e5-ae1d-aca695a0d792/b86386c0-7626-4d3b-9572-5dae9c59fccd.jpg', 
        'processedUrl': 'https://backend.miragic.ai/uploads/virtualtryon/processed/single/0f01f45d-4796-ae1d-aca695a0d792/b86386c0-7626-4d3b-9572-5dae9c59fccd.jpg', 
        'createdAt': '2025-10-08T14:50:12.191Z', 
        'processingStartedAt': '2025-10-08T14:50:12.194Z', 
        'processingCompletedAt': '2025-10-08T14:50:32.211Z', 
        'errorMessage': None
    }
}
```

<mark style="color:blue;">**Response Fields**</mark>

<table><thead><tr><th width="203">Field</th><th width="85">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>Unique identifier of the task</td></tr><tr><td>status</td><td>String</td><td>Current status of the task (<code>PENDING</code>/<code>COMPLETED</code>/<code>FAILED</code>)</td></tr><tr><td>mode</td><td>String</td><td>String to indicate single clothing try-on(<code>SINGLE</code>) or combo try-on(<code>TOP_BOTTOM</code>).</td></tr><tr><td>humanImagePath</td><td>String</td><td><code>URL</code> to human image</td></tr><tr><td>bottomClothImagePath</td><td>String</td><td><code>URL</code> to lower garment image</td></tr><tr><td>clothImagePath</td><td>String</td><td><code>URL</code> to uppper garment image</td></tr><tr><td>resultImagePath</td><td>String</td><td><code>URL</code> to result image</td></tr><tr><td>createdAt</td><td>Number</td><td>Unix timestamp when processing is created</td></tr><tr><td>processingStartedAt</td><td>Number</td><td>Unix timestamp when processing is started</td></tr><tr><td>processingCompletedAt</td><td>Number</td><td>Unix timestamp when processing is completed</td></tr><tr><td>errorMessage</td><td>String</td><td>Error message</td></tr></tbody></table>

## Rate Limits

To maintain service stability and fair usage, the `API` enforces the following rate limit:

* **`60` requests per minute** per `API` key

If this limit is exceeded, an  error (`Too Many Requests`) will be returned. Please ensure your application includes proper retry logic with exponential backoff.

## Full Code Example

The following code lines are quick example to use our `API` in multiple languages.

<mark style="color:green;">**Case 1: Single Clothing Try-on**</mark>

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

```bash
curl -X POST "https://backend.miragic.ai/api/v1/virtual-try-on" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "garmentType=full_body" \
  -F "humanImage=@path/to/human_image.jpg;type=image/jpeg" \
  -F "clothImage=@path/to/cloth_image.jpg;type=image/jpeg"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
import axios from "axios";
import fs from "fs";
import FormData from "form-data";

const apiKey = "YOUR_API_KEY";
const baseUrl = "https://backend.miragic.ai";

async function virtualTryOn() {
  const url = `${baseUrl}/api/v1/virtual-try-on`;

  const formData = new FormData();
  formData.append("garmentType", "full_body");
  formData.append("humanImage", fs.createReadStream("path/to/human_image.jpg"));
  formData.append("clothImage", fs.createReadStream("path/to/cloth_image.jpg"));

  try {
    // Step 1: Create virtual try-on job
    const response = await axios.post(url, formData, {
      headers: {
        "X-API-Key": apiKey,
        ...formData.getHeaders(),
      },
    });

    console.log("Response:", response.data);

    if (response.data.success) {
      const jobId = response.data.data.jobId;
      console.log(`Job ID: ${jobId}`);

      // Step 2: Poll for result
      while (true) {
        const result = await axios.get(`${baseUrl}/api/v1/virtual-try-on/${jobId}`, {
          headers: {
            "X-API-Key": apiKey,
          },
        });

        const status = result.data.data.status;
        console.log("Status:", status);

        if (status === "COMPLETED") {
          console.log("Result:", result.data);
          break;
        } else if (status === "FAILED") {
          console.error("Job failed:", result.data);
          break;
        }

        // Wait 2 seconds before next poll
        await new Promise((resolve) => setTimeout(resolve, 2000));
      }
    } else {
      console.error("Error:", response.data);
    }
  } catch (error) {
    console.error("Error occurred:", error.response?.data || error.message);
  }
}

virtualTryOn();

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import time

api_key = 'YOUR_API_KEY' # ← Replace with your actual API key
base_url = 'https://backend.miragic.ai'

def virtualtryon():
    url = f'{base_url}/api/v1/virtual-try-on'
    data = {'garmentType': 'full_body'}
    
    files=[
    ('humanImage',('human_image.jpg',open('path/to/human_image.jpg','rb'),'image/jpeg')),
    ('clothImage',('cloth_image.jpg',open('path/to/cloth_image.jpg','rb'),'image/jpeg'))
    ]
    headers = {'X-API-Key': api_key}
    response = requests.request("POST", url, headers=headers, data=data, files=files)
    print(response.text)
    
    if response.json()['success']:
        job_id = response.json()['data']['jobId']
        print(f'Job ID: {job_id}')
        # Poll for results
        while True:
            result = requests.get(
                f'{base_url}/api/v1/virtual-try-on/{job_id}',
                headers=headers
            )
            if result.json()['data']['status'] == 'COMPLETED':
                print('Result:', result.json())
                break
            elif result.json()['data']['status'] == 'FAILED':
                print('Job failed:', result.json())
                break
            time.sleep(2)
    else:
        print('Error:', response.json())

if __name__ == '__main__':
    virtualtryon()
```

{% endtab %}
{% endtabs %}

<mark style="color:green;">**Case 2: Combo Try-on**</mark>

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

```bash
curl -X POST "https://backend.miragic.ai/api/v1/virtual-try-on" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "garmentType=comb" \
  -F "humanImage=@path/to/human_image.jpg;type=image/jpeg" \
  -F "clothImage=@path/to/cloth_image.jpg;type=image/jpeg" \
  -F "bottomClothImage=@path/to/bottom_cloth_image.jpg;type=image/jpeg"
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
import axios from "axios";
import FormData from "form-data";
import fs from "fs";

const apiKey = "YOUR_API_KEY";
const baseUrl = "https://backend.miragic.ai";

async function virtualTryOn() {
  const url = `${baseUrl}/api/v1/virtual-try-on`;

  // Prepare form data
  const formData = new FormData();
  formData.append("garmentType", "comb");
  formData.append("humanImage", fs.createReadStream("path/to/human_image.jpg"));
  formData.append("clothImage", fs.createReadStream("path/to/cloth_image.jpg"));
  formData.append(
    "bottomClothImage",
    fs.createReadStream("path/to/bottom_cloth_image.jpg")
  );

  const headers = {
    "X-API-Key": apiKey,
    ...formData.getHeaders(),
  };

  try {
    // Step 1: Submit try-on request
    const response = await axios.post(url, formData, { headers });
    console.log(response.data);

    if (response.data.success) {
      const jobId = response.data.data.jobId;
      console.log(`Job ID: ${jobId}`);

      // Step 2: Poll for results
      while (true) {
        const result = await axios.get(`${baseUrl}/api/v1/virtual-try-on/${jobId}`, {
          headers: { "X-API-Key": apiKey },
        });

        const status = result.data.data.status;
        if (status === "COMPLETED") {
          console.log("Result:", result.data);
          break;
        } else if (status === "FAILED") {
          console.log("Job failed:", result.data);
          break;
        }

        // Wait before next check
        await new Promise((resolve) => setTimeout(resolve, 2000));
      }
    } else {
      console.log("Error:", response.data);
    }
  } catch (error) {
    console.error("Request failed:", error.response?.data || error.message);
  }
}

virtualTryOn();

```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import time

api_key = 'YOUR_API_KEY' # ← Replace with your actual API key
base_url = 'https://backend.miragic.ai'

def virtualtryon():
    url = f'{base_url}/api/v1/virtual-try-on'
    data = {'garmentType': 'comb'}
    
    files=[
    ('humanImage',('human_image.jpg',open('path/to/human_image.jpg','rb'),'image/jpeg')),
    ('clothImage',('cloth_image.jpg',open('path/to/cloth_image.jpg','rb'),'image/jpeg')),
    ('bottomClothImage',('bottom_cloth_image.jpg',open('path/to/bottom_cloth_image.jpg','rb'),'image/jpeg'))
    ]
    headers = {'X-API-Key': api_key}
    response = requests.request("POST", url, headers=headers, data=data, files=files)
    print(response.text)
    
    if response.json()['success']:
        job_id = response.json()['data']['jobId']
        print(f'Job ID: {job_id}')
        
        # Poll for results
        while True:
            result = requests.get(
                f'{base_url}/api/v1/virtual-try-on/{job_id}',
                headers=headers
            )
            if result.json()['data']['status'] == 'COMPLETED':
                print('Result:', result.json())
                break
            elif result.json()['data']['status'] == 'FAILED':
                print('Job failed:', result.json())
                break
            time.sleep(2)
    else:
        print('Error:', response.json())

if __name__ == '__main__':
    virtualtryon()
```

{% endtab %}
{% endtabs %}
