# Outfit Generation

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

Use these APIs to design outfits for any occasion based on specific prompts. Perfect for fashion tech developers and e-commerce companies!

## Create an experiment

<mark style="color:green;">`POST`</mark> `https://prod.server.tryonlabs.ai/api/v1/experiment/`

Create an experiment to trigger the generation of a new outfit based on a text prompt.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name     | Type                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Description                                                                         |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
| `action` | generate\_outfit                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Please provide the experiment action. e.g. generate\_outfit, virtual\_try\_on, etc. |
| `params` | {"prompt": "A flat lay image of a dress with Color: Pink, Department: Dresses, Detail: Split Thigh, Fabric-Elasticity: No Sretch, Fit: Fitted, Hemline: Slit, Material: Woven, Neckline: Spaghetti Straps, Pattern: Floral, Sleeve-Length: Sleeveless, Style: Boho, Type: Cami Top, Waistline: High. Do not generate a human model.", "height":1024, "width": 1024, "seed": -1, "guidance\_scale": 4.5, "num\_inference\_steps": 20, "num\_images\_per\_prompt": 1, "strength": 0.8} | Pass the parameters to use for generation.                                          |

**Response**

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

```json

{
    "status": "running",
    "experiment": {
        "id": "xxxxxxxxxx",
        "created_on": "xxxx-xx-xxxxx:xx:xx.xxxxxxx",
        "output": null,
        "params": "{\"prompt\": \"A flat lay image of a dress with Color: Pink, Department: Dresses, Detail: Split Thigh, Fabric-Elasticity: No Sretch, Fit: Fitted, Hemline: Slit, Material: Woven, Neckline: Spaghetti Straps, Pattern: Floral, Sleeve-Length: Sleeveless, Style: Boho, Type: Cami Top, Waistline: High. Do not generate a human model.\", \"height\":1024, \"width\": 1024, \"seed\": -1, \"guidance_scale\": 4.5, \"num_inference_steps\": 20, \"num_images_per_prompt\": 1, \"strength\": 0.8}",
        "aimodel": "outfit_ai",
        "action": "generate_outfit",
        "status": "pending",
        "store": null,
        "access": "private",
        "user_feedback": null,
        "redirect_count": 0,
        "model": null,
        "garment": null,
        "result": null,
        "user": "xxxxxxxxxx",
        "results": []
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "status": "failure",
    "message": "xx xxxx xxxx xxxx"
}
```

{% endtab %}
{% endtabs %}

## Check experiment status

<mark style="color:green;">`GET`</mark> `https://prod.server.tryonlabs.ai/api/v1/experiment/{id}/`

Call this endpoint to fetch an experiment containing the status and other details.

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Response**

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

<pre class="language-json"><code class="lang-json"><strong>{
</strong>    "status": "success",
    "experiment": {
        "id": "xxxxxxxxxx",
        "created_on": "xxxx-xx-xxxxx:xx:xx.xxxxxxx",
        "output": null,
        "params": "{\"prompt\": \"A flat lay image of a dress with Color: Pink, Department: Dresses, Detail: Split Thigh, Fabric-Elasticity: No Sretch, Fit: Fitted, Hemline: Slit, Material: Woven, Neckline: Spaghetti Straps, Pattern: Floral, Sleeve-Length: Sleeveless, Style: Boho, Type: Cami Top, Waistline: High. Do not generate a human model.\", \"height\":1024, \"width\": 1024, \"seed\": -1, \"guidance_scale\": 4.5, \"num_inference_steps\": 20, \"num_images_per_prompt\": 1, \"strength\": 0.8}",
        "aimodel": "outfit_ai",
        "action": "generate_outfit",
        "status": "completed",
        "store": null,
        "access": "private",
        "user_feedback": null,
        "redirect_count": 0,
        "model": null,
        "garment": null,
        "result": {
            "id": "xxxxxxxxxx",
            "image_url": "api/v1/ei/xxxxxxxxxx/d?token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            "created_on": "xxxx-xx-xxxxx:xx:xx.xxxxxxx",
            "type": "result",
            "gender": null,
            "model_type": null,
            "garment_type": null,
            "garment_brand": "Unknown",
            "access": "private",
            "shopify_product_id": null,
            "shopify_product_handle": null,
            "preprocessing": "pending",
            "user": "xxxxxxxxxx"
        },
        "user": "xxxxxxxxxx",
        "results": []
    }
}
</code></pre>

{% endtab %}

{% tab title="400" %}

```json
{
    "detail": "No Experiment matches the given query."
}
```

{% endtab %}
{% endtabs %}

`If you've generated multiple images, the remaining images will be listed in the "results" parameter of the output JSON object.`

## Download generated image(s)

<mark style="color:green;">`POST`</mark> `https://prod.server.tryonlabs.ai/api/v1/ei/d?token={image_token}/`

Use this endpoint to download the generated image(s).

**Response**

**`Status Code: 200`**

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

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

```json
  // empty response
```

{% endtab %}
{% endtabs %}


---

# 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.tryonlabs.ai/outfit-generation.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.
