# Model Swap

For AI agents: this is the Markdown version of https://docs.fashiolabs.com/tools/model_swap.html. The index of all Fashio API docs is at https://docs.fashiolabs.com/llms.txt, and the complete reference in one file is at https://docs.fashiolabs.com/llms-full.txt.

Swap the person's identity in an existing on-model photo while keeping the outfit, pose and scene unchanged — show the same product on a different model without a new photoshoot.

`toolId: "model_swap"` · 4 credits · model\_garment · ratio: ignored

![Model Swap result — the same outfit and pose on a different model identity](https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/admin%2Ftool_samples%2F60eb5c3d-9e18-48fd-83fd-4fd0b219e1f9.jpeg?alt=media&token=fe135a66-4f98-4322-b794-c8352f960115)

## What it does

Point this at an existing on-model photo and a new identity, and Fashio replaces just the person — the outfit, pose, framing and background all carry over unchanged. It's the tool to reach for when you need to show one product on several different models without re-shooting or re-generating the scene from scratch.

Like [Pose Variation](https://docs.fashiolabs.com/tools/pose_angle_switch.md), this is an in-place edit: the original frame and outfit are preserved, only who's wearing it changes. `ratio` is ignored if sent.

## Request body

| Field | Type |  | Description |
| --- | --- | --- | --- |
| `toolId` | string | required | Always `"model_swap"`. |
| `images.user_photo` | string | required | URL of the existing on-model photo whose person will be replaced. |
| `images.fashion_model` | string | required | A catalog ID from [GET /v1/fashion-models](https://docs.fashiolabs.com/core-endpoints.md), or a direct image URL, of the new identity to swap in. |

## Example request

**cURL**

```bash
curl -X POST https://api.fashiolabs.com/v1/generations \
  -H "Authorization: Bearer fio_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "toolId": "model_swap",
    "images": {
      "user_photo": "https://your-cdn.com/on-model-shot.jpg",
      "fashion_model": "fm_south_asian_01"
    }
  }'
```

**Node.js**

```javascript
const res = await fetch("https://api.fashiolabs.com/v1/generations", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.FASHIO_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    toolId: "model_swap",
    images: {
      user_photo: "https://your-cdn.com/on-model-shot.jpg",
      fashion_model: "fm_south_asian_01",
    },
  }),
});
const { id } = await res.json();
```

**Python**

```python
import os, requests

res = requests.post(
    "https://api.fashiolabs.com/v1/generations",
    headers={"Authorization": f"Bearer {os.environ['FASHIO_API_KEY']}"},
    json={
        "toolId": "model_swap",
        "images": {
            "user_photo": "https://your-cdn.com/on-model-shot.jpg",
            "fashion_model": "fm_south_asian_01",
        },
    },
)
job_id = res.json()["id"]
```

## Response

**202 Accepted**

```json
{ "success": true, "id": "8b1e...", "status": "processing" }
```

Poll `GET /v1/generations/:id` (see [Quickstart](https://docs.fashiolabs.com/quickstart.md)) until it completes:

**200 · completed**

```json
{
  "success": true,
  "id": "8b1e...",
  "status": "completed",
  "resultUrls": ["https://.../result.jpg"],
  "errorMessage": null
}
```

## Common errors

| Status | Meaning |
| --- | --- |
| 400 | `model_swap: missing required image "user_photo"` — required image field wasn't resolvable. |
| 402 | `Insufficient diamonds. Required 4, have <n>.` |
| 429 | Daily request cap reached for this key — see [Rate Limits](https://docs.fashiolabs.com/rate-limits.md). |

## Related tools

- [Pose Variation](https://docs.fashiolabs.com/tools/pose_angle_switch.md) — change how the person is posed instead of who they are.
- [Virtual Try-On (Single)](https://docs.fashiolabs.com/tools/virtual_model.md) — generate a fresh on-model photo from a garment instead of editing an existing one.

---

Source: https://docs.fashiolabs.com/tools/model_swap.html · OpenAPI spec: https://docs.fashiolabs.com/openapi.yaml · Docs index: https://docs.fashiolabs.com/llms.txt
