> For the complete documentation index, see [llms.txt](https://dressx.gitbook.io/dressx-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dressx.gitbook.io/dressx-docs/virtual-try-on/full-body-try-on.md).

# Full-body TRY ON

The task runs asynchronously; you get a \`tryon\_id\` in the response and poll for status and the result image.

***

### API key.

To use the DRESSX paywall API, you need an API key. Please fallow this Authentication [link](/dressx-docs/getting-started/authentication.md) for more deteils

### Create a try-on task

**Endpoint:** `POST https://api.dressxagent.com/api/api_paywall/tryons_create_vb_ai/`

**Authentication:** Required. Send your API key in the header:

* `Api-Key: <your_api_key>`
* or `X-Api-Key: <your_api_key>`

**Content-Type:** `application/x-www-form-urlencoded` or `multipart/form-data`

**Note:** Either `avatar_url` OR `avatar_file` is required — provide one or the other.

#### Required

| Parameter                     | Type           | Description                                                           |
| ----------------------------- | -------------- | --------------------------------------------------------------------- |
| `avatar_url` or `avatar_file` | String or File | URL of the model photo, or file upload of the image. One is required. |
| `garment_link`                | String         | URL of the garment image to try on the model.                         |

#### Optional

#### File uploads (when using `avatar_file` instead of `avatar_url`)

* **Supported formats:** JPG, JPEG, PNG, HEIC
* **Max file size:** 10 MB
* **Field name:** `avatar_file`

#### Photo guidelines (model image)

* Full-length or at least knee-length photo.
* Simple pose; no crossed legs or arms; hands not hidden behind the back.
* No nude photos (minimum: underwear or swimsuit).
* Only one person in the photo.
* No objects in front of the person.
* For best results: avoid objects in hands (bag, bouquet, etc.) and hair covering the face.
* Avoid bulky clothing in the model photo (can affect generation quality).

***

### Request examples

#### Example 1: With avatar URL

```bash
curl -X POST 'https://api.dressxagent.com/api/api_paywall/tryons_create_vb_ai/' \
  -H 'Api-Key: your-secret-api-key-here' \
  -F 'avatar_url=https://example.com/model.jpg' \
  -F 'garment_link=https://example.com/dress.jpg'
```

#### Example 2: With image file upload

```bash
curl -X POST 'https://api.dressxagent.com/api/api_paywall/tryons_create_vb_ai/' \
  -H 'Api-Key: your-secret-api-key-here' \
  -F 'avatar_file=@/path/to/model.jpg' \
  -F 'garment_link=https://example.com/dress.jpg'
```

#### Example 3: JavaScript / Fetch

```javascript
const formData = new FormData();
formData.append('avatar_file', fileInput.files[0]);
formData.append('garment_link', 'https://example.com/dress.jpg');

const response = await fetch('https://api.dressxagent.com/api/api_paywall/tryons_create_vb_ai/', {
  method: 'POST',
  headers: { 'Api-Key': 'your-secret-api-key-here' },
  body: formData,
});
const result = await response.json();
```

***

### Response

#### Success (200 OK)

```json
{
  "status": "ok",
  "data": {
    "tryon_id": 12345,
    "status": "created"
  }
}
```

Use `tryon_id` to poll for completion and the result image (see below).

#### Error responses

**Missing API key (401 Unauthorized)**

```json
{
  "status": "error",
  "message": "API key required or invalid"
}
```

**Invalid API key (401 Unauthorized)**

```json
{
  "status": "error",
  "message": "API key required or invalid"
}
```

**Insufficient balance (402 Payment Required)**

```json
{
  "status": "error",
  "message": "Insufficient balance",
  "required_usd": "0.05",
  "balance_usd": "0.00"
}
```

***

### Get try-on status and result

**Endpoint:** `GET /api/tryon/predict_get/<tryon_id>/`

Returns the current status and, when ready, the dressed image URL. Same polling endpoint as Try-On Predict.

#### Response

**Success (200):**

```json
{
  "status": "ok",
  "data": {
    "tryon_id": 12345,
    "status": "completed",
    "dressed_image": "https://..."
  }
}
```

**Task status values:** `created`, `processing`, `completed`, `failed`, etc. When `status` is `completed`, `dressed_image` contains the result image URL.

**Not found / error (200):**

```json
{
  "status": "error"
}
```

***

### Usage notes

| Topic                | Notes                                                                                                                          |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| **Authentication**   | Always include the `Api-Key` (or `X-Api-Key`) header.                                                                          |
| **Form data**        | Use `multipart/form-data` when uploading an image file.                                                                        |
| **Avatar data**      | Provide either `avatar_url` (string) or `avatar_file` (file), not both.                                                        |
| **Try-on status**    | Initial response status is `created`; poll `GET /api/tryon/predict_get/<tryon_id>/` until `status` is `completed` or `failed`. |
| **Balance**          | The paywall endpoint charges per request; ensure sufficient balance.                                                           |
| **VB AI vs Predict** | This endpoint uses the AI-based try-on pipeline; for the classic mixmatch pipeline use Try-On Predict.                         |

***

### Rate limiting and errors

* Check with your API provider for rate limits (e.g. on the order of 100 requests/hour per API key).
* Always check the `status` field in responses and handle HTTP status codes (401, 402) appropriately.
* Retry failed requests with exponential backoff where applicable.

***

**Contact:** For API key requests or support, contact your API administrator.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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 following URL with the `ask` and `goal` query parameters:

```
GET https://dressx.gitbook.io/dressx-docs/virtual-try-on/full-body-try-on.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
