# Hairstyle Tryon

Our **Virtual Hairstyle Try-On** endpoint provides realistic hair transformations using just one photo of a person. Explore a wide range of hairstyles and hair colors with exceptional accuracy. It’s our most advanced AI model for hair try-on experiences, designed to deliver high-quality and lifelike results.

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

* **Processing Resolution**: 864×1296 pixels
* **Processing Time**: 6 seconds
* **Tryon Cost**: 1 per image
  {% endhint %}

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

Generate a virtual try-on by sending a face image to the following endpoint:

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

**Request Examples**

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

```python
curl -X POST "https://tryiton.now/api/v1/tryon/hairstyle" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "face_image": "https://example.com/path/to/face.png",
    "haircut": "TwinBraids"
  }'
```

{% endtab %}

{% tab title="JavaScript" %}

```javascript
fetch('https://tryiton.now/api/v1/tryon/hairstyle', {
  method: 'POST',
  body: JSON.stringify({
    face_image: "https://example.com/path/to/face.png",
    haircut: "TwinBraids"
  }),
  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/hairstyle",
  headers={
    "Authorization": "Bearer YOUR_API_KEY", 
    "Content-Type": "application/json"
  },
  json={
    "face_image": "https://example.com/path/to/face.png",
    "haircut": "TwinBraids"
  }
)
```

{% 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" %}

#### `face_image`                                                                                                                                            image URL | base64

Primary image of the person's face on whom the virtual try-on will be performed.
{% 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/gCr7VuAGEAEXlhnOPH1h" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}

#### `haircut`                                                                                                                             'BuzzCut' | 'SlickBack' | ...

The desired hairstyle to be tried on the `face_image`. You can select from a wide range of styles below.
{% endhint %}

{% tabs %}
{% tab title="Men's Hairstyles" %}

<div align="center"><figure><img src="/files/p9G9n5qNO2arDbfphiNX" alt="" width="256"><figcaption><p><strong>Original Image</strong></p></figcaption></figure></div>

<div><figure><img src="/files/PSz7q1QRAgWLNo2hAk2u" alt=""><figcaption><p><strong>BuzzCut</strong></p></figcaption></figure> <figure><img src="/files/9kV7Hm6MQqtr5afHr3oh" alt=""><figcaption><p><strong>UnderCut</strong></p></figcaption></figure> <figure><img src="/files/9zmcAZCb8HtHtkKF1bmz" alt=""><figcaption><p><strong>Pompadour</strong></p></figcaption></figure> <figure><img src="/files/wq2Y0BnloHLQmpUihUw1" alt=""><figcaption><p><strong>SlickBack</strong></p></figcaption></figure></div>

<div><figure><img src="/files/BSsaQjvB8ZQPx3Sj8khQ" alt=""><figcaption><p><strong>CurlyShag</strong></p></figcaption></figure> <figure><img src="/files/1lILUuImn6NVMUDPaCqC" alt=""><figcaption><p><strong>WavyShag</strong></p></figcaption></figure> <figure><img src="/files/kiWkYc1cQieoY7VdwEkA" alt=""><figcaption><p><strong>FauxHawk</strong></p></figcaption></figure> <figure><img src="/files/ADcRokelmVwd3FEU7shY" alt=""><figcaption><p><strong>Spiky</strong></p></figcaption></figure></div>

<div><figure><img src="/files/YLqdJ2w2bNXG0HKlAQTP" alt=""><figcaption><p><strong>CombOver</strong></p></figcaption></figure> <figure><img src="/files/MbPSRInwatQVYX5we1B7" alt=""><figcaption><p><strong>HighTightFade</strong></p></figcaption></figure> <figure><img src="/files/F1tb8kjLM5dRcMUFcdxw" alt=""><figcaption><p><strong>ManBun</strong></p></figcaption></figure> <figure><img src="/files/z5zx3BE0lSfhOMckN4AW" alt=""><figcaption><p><strong>Afro</strong></p></figcaption></figure></div>

<div><figure><img src="/files/IeMcQsaUrjCYwDufon2O" alt=""><figcaption><p><strong>LowFade</strong></p></figcaption></figure> <figure><img src="/files/anqTjp3UyDc7QkXJ4uiP" alt=""><figcaption><p><strong>UndercutLongHair</strong></p></figcaption></figure> <figure><img src="/files/Ul2yt6jzC8GOaCNn69As" alt=""><figcaption><p><strong>TwoBlockHaircut</strong></p></figcaption></figure> <figure><img src="/files/6ERYcZJsFc8o9S3OotP6" alt=""><figcaption><p><strong>TexturedFringe</strong></p></figcaption></figure></div>

<div><figure><img src="/files/E9cVMesvf9l5RtjN0Sao" alt=""><figcaption><p><strong>BluntBowlCut</strong></p></figcaption></figure> <figure><img src="/files/2aQgJKuiJ6FQpXg6mE5Y" alt=""><figcaption><p><strong>LongWavyCurtainBangs</strong></p></figcaption></figure> <figure><img src="/files/rUakZIIKX3L96LzWvMMU" alt=""><figcaption><p><strong>MessyTousled</strong></p></figcaption></figure> <figure><img src="/files/OzDILjICSyPr2qt4V4m7" alt=""><figcaption><p><strong>CornrowBraids</strong></p></figcaption></figure></div>

<div align="center" data-full-width="false"><figure><img src="/files/sLWdVwiXW32RS4trhMVm" alt="" width="128"><figcaption><p><strong>LongHairTiedUp</strong></p></figcaption></figure> <figure><img src="/files/b7e4F5A6IXqQq3HXkJTp" alt="" width="128"><figcaption><p><strong>Middle-parted</strong></p></figcaption></figure></div>
{% endtab %}

{% tab title="Women's Hairstyles" %}

<figure><img src="/files/XYVqjuSpIUeeH7LNTKvN" alt="" width="256"><figcaption><p><strong>Original Image</strong></p></figcaption></figure>

<div><figure><img src="/files/pZagEy3PxaiMZcdmqBzt" alt=""><figcaption><p><strong>ShortPixieWithShavedSides</strong></p></figcaption></figure> <figure><img src="/files/PL9SbIfaxzxfK7JSXLJh" alt=""><figcaption><p><strong>ShortNeatBob</strong></p></figcaption></figure> <figure><img src="/files/27xYlUR3Ca13hidUkkFE" alt=""><figcaption><p><strong>DoubleBun</strong></p></figcaption></figure> <figure><img src="/files/96FR8bY5QbgBByr0fWBi" alt=""><figcaption><p><strong>Updo</strong></p></figcaption></figure></div>

<div><figure><img src="/files/GVyqVODtqkaKQ5RofUUP" alt=""><figcaption><p><strong>Spiked</strong></p></figcaption></figure> <figure><img src="/files/Te7MFP9cT8twarQe3H9F" alt=""><figcaption><p><strong>bowlCut</strong></p></figcaption></figure> <figure><img src="/files/lNV9IXRUNKMuZYyNMA33" alt=""><figcaption><p><strong>Chignon</strong></p></figcaption></figure> <figure><img src="/files/8iCOvxlKB4iuasmQ16mS" alt=""><figcaption><p><strong>PixieCut</strong></p></figcaption></figure></div>

<div><figure><img src="/files/cMpm63GaylGsFo2mjHbZ" alt=""><figcaption><p>S<strong>lickedBack</strong></p></figcaption></figure> <figure><img src="/files/jSwuDCseFb5Sb0Lp9um7" alt=""><figcaption><p><strong>LongCurly</strong></p></figcaption></figure> <figure><img src="/files/tUZN6KQwZyi4Chg6bJwd" alt=""><figcaption><p><strong>CurlyBob</strong></p></figcaption></figure> <figure><img src="/files/B7PrUDSw6fqt8GNrsvO4" alt=""><figcaption><p><strong>StackedCurlsInShortBob</strong></p></figcaption></figure></div>

<div><figure><img src="/files/eP0l48ECnWktRRNebS9C" alt=""><figcaption><p><strong>WavyFrenchBobVibesfrom1920</strong></p></figcaption></figure> <figure><img src="/files/IJEst4dpQ5h06Yqk7p33" alt=""><figcaption><p><strong>BobCut</strong></p></figcaption></figure> <figure><img src="/files/u3sq35r1bWG2peLh62dY" alt=""><figcaption><p><strong>ShortTwintails</strong></p></figcaption></figure> <figure><img src="/files/pybwDHkrrMCHJHcDDLOD" alt=""><figcaption><p><strong>BoxBraids</strong></p></figcaption></figure></div>

<div><figure><img src="/files/HA9l7pRZSa3mrQWYVTpP" alt=""><figcaption><p><strong>ShortCurlyPixie</strong></p></figcaption></figure> <figure><img src="/files/E2E4PBfON1n4jAdRzhpn" alt=""><figcaption><p><strong>LongStraight</strong></p></figcaption></figure> <figure><img src="/files/N2S72t2bLzj4S5f8yKj2" alt=""><figcaption><p><strong>LongWavy</strong></p></figcaption></figure> <figure><img src="/files/T7JUo4fQ9ZZkNyVyaeOk" alt=""><figcaption><p><strong>FishtailBraid</strong></p></figcaption></figure></div>

<div><figure><img src="/files/MEYNzve2qdQxH0x6H9zv" alt=""><figcaption><p><strong>TwinBraids</strong></p></figcaption></figure> <figure><img src="/files/SR2bVy7TanXZWLAtA9Ts" alt=""><figcaption><p><strong>Ponytail</strong></p></figcaption></figure> <figure><img src="/files/BEhmyivVGC9zK3TZ6gHS" alt=""><figcaption><p>D<strong>readlocks</strong></p></figcaption></figure> <figure><img src="/files/pQKrU9Yog8l1qkFFcv8Y" alt=""><figcaption><p><strong>Cornrows</strong></p></figcaption></figure></div>

<div><figure><img src="/files/vOj4QLzW930mPpbWULLB" alt=""><figcaption><p><strong>ShoulderLengthHair</strong></p></figcaption></figure> <figure><img src="/files/AWeuPQ7feWwyjkiOG3Aj" alt=""><figcaption><p><strong>LooseCurlyAfro</strong></p></figcaption></figure> <figure><img src="/files/URhOvvqO4cLrWpUsKSyj" alt=""><figcaption><p><strong>LongTwintails</strong></p></figcaption></figure> <figure><img src="/files/rwPXsvAvicL5OiZlU4N3" alt=""><figcaption><p><strong>LongHimeCut</strong></p></figcaption></figure></div>
{% endtab %}
{% endtabs %}

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

{% hint style="info" %}

#### `hair_color`                                                                                                                  'blonde' | 'platinumBlonde' | ...

The desired hair color to be tried on the `haircut`. You can select from a wide range of colors below.
{% endhint %}

{% tabs %}
{% tab title="Hairstyle Colors" %}

<figure><img src="/files/Xx3YVHPDfQX4MSQ2mfmH" alt="" width="375"><figcaption><p><strong>Original Image</strong></p></figcaption></figure>

<div><figure><img src="/files/2HgDVt8rGAJlMC8W83eZ" alt=""><figcaption><p><strong>blonde</strong></p></figcaption></figure> <figure><img src="/files/n0QkOIlpbcC1Doo6KNml" alt=""><figcaption><p><strong>platinumBlonde</strong></p></figcaption></figure> <figure><img src="/files/JlnDVf2zv9r0I6MIpGvZ" alt=""><figcaption><p><strong>brown</strong></p></figcaption></figure> <figure><img src="/files/k7mWlXmp3QH1wJljYyBg" alt=""><figcaption><p><strong>lightBrown</strong></p></figcaption></figure></div>

<div><figure><img src="/files/4eQoqEzRU2l1RpYf59IK" alt=""><figcaption><p><strong>blue</strong></p></figcaption></figure> <figure><img src="/files/NOJxLJV5aceL9a6CFp2s" alt=""><figcaption><p><strong>darkBlue</strong></p></figcaption></figure> <figure><img src="/files/Vptme8RFYjXsnIb0RHKB" alt=""><figcaption><p><strong>lightBlue</strong></p></figcaption></figure> <figure><img src="/files/0K5iZRWeLsjAXBXGfLqU" alt=""><figcaption><p><strong>purple</strong></p></figcaption></figure></div>

<div><figure><img src="/files/GJZPdHyo1oFYDnvD9gwu" alt=""><figcaption><p><strong>lightPurple</strong></p></figcaption></figure> <figure><img src="/files/w0TfrGnLzKYfUBgqV4BP" alt=""><figcaption><p><strong>pink</strong></p></figcaption></figure> <figure><img src="/files/DqRR3vo9nNRBGXwLTtvR" alt=""><figcaption><p><strong>black</strong></p></figcaption></figure> <figure><img src="/files/vLUooEb1TdRzd8kDwWbF" alt=""><figcaption><p><strong>white</strong></p></figcaption></figure></div>

<div><figure><img src="/files/6cdOolzZYzZHowtwOkzv" alt=""><figcaption><p><strong>grey</strong></p></figcaption></figure> <figure><img src="/files/FytdSH9evGs9thrPKtvX" alt=""><figcaption><p><strong>silver</strong></p></figcaption></figure> <figure><img src="/files/GUlqvotxXFQeZPmC27UT" alt=""><figcaption><p><strong>red</strong></p></figcaption></figure> <figure><img src="/files/tYwfkPcRCY1llx3pu8LX" alt=""><figcaption><p><strong>burgundy</strong></p></figcaption></figure></div>

<div><figure><img src="/files/nSQ3318DsAgaOxCthGTQ" alt=""><figcaption><p><strong>orange</strong></p></figcaption></figure> <figure><img src="/files/9EDBBPtCefb6HHsT5c13" alt=""><figcaption><p><strong>green</strong></p></figcaption></figure> <figure><img src="/files/ZYZK0tqx3m0GLSLUxvVd" alt=""><figcaption><p><strong>darkGreen</strong></p></figcaption></figure></div>
{% endtab %}
{% endtabs %}

### 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](https://docs.tryiton.now/api-overview/api-fundamentals) 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/hairstyle/XXX.png"
  ],
  "error": null
}
```

The `output` array contains URLs to your generated try-on images showing the model wearing the specified garment.&#x20;

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

#### 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>


---

# 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/hairstyle-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.
