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

# Service Implementation (API)

### 1. What it is and when to use it

The **Eligibility API** checks, in a single call, whether a product supports Virtual Try-On and returns the iframe URL ready to open in a WebView — no need to run JavaScript on the client side.

Use this endpoint in native apps that don't have access to the store's DOM, for example when rendering a product page on iOS or Android.

### 2. Endpoint

<mark style="color:green;">`POST`</mark>  `https://tryon.internalsizebay.com/api/tryon/eligibility`

#### Required header

| Header         | Value              |
| -------------- | ------------------ |
| `Content-Type` | `application/json` |

### 3. Request body

#### Full example

```json
{
  "tenant_id": 6273,
  "sid": "user-session-abc123",
  "product_data": {
    "product_id": "sku-42",
    "permalink": "https://yourstore.com/produtos/polo",
    "lang": "en",
    "title": "Men's Polo Shirt",
    "category": "tops",
    "description": "Slim fit polo in pima cotton.",
    "price": "USD 149.90",
    "image_url": "https://cdn.yourstore.com/polo.jpg"
  }
}
```

#### Root fields

| Field          | Type   | Required | Description                                                                   |
| -------------- | ------ | -------- | ----------------------------------------------------------------------------- |
| `tenant_id`    | number | **✓**    | Numeric ID of your Sizebay tenant                                             |
| `sid`          | string | **✓**    | User session identifier (max. 512 chars). Used for analytics inside the modal |
| `product_data` | object | **✓**    | Product data — see table below                                                |

#### `product_data` fields

| Field         | Type          | Required | Limit      | Description                                                                      |
| ------------- | ------------- | -------- | ---------- | -------------------------------------------------------------------------------- |
| `product_id`  | string        | **✓**    | 256 chars  | Unique product identifier in the catalog                                         |
| `permalink`   | string (URL)  | **✓**    | 2048 chars | Canonical URL of the product page                                                |
| `lang`        | string (enum) | **✓**    | —          | Modal language. Example: `pt`, `en`, `es`, `it`                                  |
| `title`       | string        | **✓ \*** | 512 chars  | Product name. Used to infer the category when `category` isn't sent              |
| `category`    | string        | **✓ \*** | 256 chars  | Product category. Accepts free text (`"tops"`) or a direct enum (`"UPPER_BODY"`) |
| `description` | string        | —        | 2000 chars | Product description                                                              |
| `price`       | string        | —        | 64 chars   | Display price, e.g.: `"R$ 149,90"`                                               |
| `image_url`   | string (URL)  | —        | 2048 chars | URL of the main product image                                                    |

### 4. Responses

**200 — Eligible product:** open the `iframe_url` in a WebView

```json
{
  "ok": true,
  "eligible": true,
  "category": "UPPER_BODY",
  "iframe_url": "https://tryon.internalsizebay.com/tryon/index.html?productData=...&tenantId=6273&..."
}
```

**200 — Ineligible product:** don't display the Try-On button

```json
{
  "ok": true,
  "eligible": false,
  "reason": "UNSUPPORTED_CATEGORY",
  "message": "Product category could not be mapped to a supported try-on category..."
}
```

**400 — Validation error:** missing or invalid field

```json
{
  "ok": false,
  "error_code": "MISSING_FIELDS",
  "message": "\"tenant_id\" is required"
}
```

#### `reason` codes (ineligible)

| `reason`               | Meaning                                                                  |
| ---------------------- | ------------------------------------------------------------------------ |
| `UNSUPPORTED_CATEGORY` | The product category couldn't be mapped to any supported Try-On category |
| `UNKNOWN_TENANT`       | The provided `tenant_id` wasn't found or is inactive                     |

### 5. Supported categories

If your app already has a structured taxonomy, pass the enum directly in `category` to skip text-based inference.

| Returned enum | Recognized product types                                         |
| ------------- | ---------------------------------------------------------------- |
| `UPPER_BODY`  | Tops, t-shirts, blouses, jackets, hoodies, blazers, coats, polos |
| `LOWER_BODY`  | Pants, jeans, skirts, shorts, leggings, bermudas                 |
| `FULL_BODY`   | Dresses, jumpsuits, gowns                                        |
| `FOOTWEAR`    | Shoes, sneakers, boots, sandals, flip-flops                      |
| `BAGS`        | Bags, backpacks, wallets                                         |
| `HEAD`        | Caps, hats, sunglasses, helmets, earrings, necklaces             |

### 6. Integrate into the app (iOS / Android)

When you receive `"eligible": true`, open the `iframe_url` in a WebView with camera permission enabled.
