# Template Sets

For AI agents: this is the Markdown version of https://docs.fashiolabs.com/template-sets.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.

Generate one look you like, save it, then put every other product through the exact same model, venue, pose and framing — a shoot you generated once becomes a catalog you can reuse forever.

> This is a saved _preset_, not a new AI capability — it stores which `fashion_model`/`venue`/`pose`/`shotType`/`stylePreset`/`ratio` a past generation used, then replays that same combination the next time you generate, with a different garment. Nothing about how the image itself is generated changes.

## Which tools support it

Only tools with a model/venue/pose concept can be saved as a template — an in-place edit ([Pose Variation](https://docs.fashiolabs.com/tools/pose_angle_switch.md), [Model Swap](https://docs.fashiolabs.com/tools/model_swap.md), [Photo Edit](https://docs.fashiolabs.com/tools/photo_edit.md)) or a deterministic single-image tool ([Enhance](https://docs.fashiolabs.com/tools/photo_enhance.md), [Remove Background](https://docs.fashiolabs.com/tools/remove_background.md), [Reframe](https://docs.fashiolabs.com/tools/photo_reframe.md)) has no "styling" to save.

virtual\_model · outfit\_photo · pro\_studio · jewelry\_on\_model · clothing\_ecom\_pack · jewelry\_ecom\_pack

## 1\. Save a template from a generation you like

The common path: you already ran a [virtual\_model](https://docs.fashiolabs.com/tools/virtual_model.md) or [pro\_studio](https://docs.fashiolabs.com/tools/pro_studio.md) job whose model/venue/pose you want to keep reusing. Pass that job's `id` as `sourceMediaId` — Fashio reads back exactly what it used.

**cURL**

```bash
curl -X POST https://api.fashiolabs.com/v1/template-sets \
  -H "Authorization: Bearer fio_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Studio white, model A, 3/4 pose",
    "sourceMediaId": "8b1e..."
  }'
```

**Node.js**

```javascript
const res = await fetch("https://api.fashiolabs.com/v1/template-sets", {
  method: "POST",
  headers: {
    Authorization: "Bearer " + process.env.FASHIO_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    label: "Studio white, model A, 3/4 pose",
    sourceMediaId: previousJobId,
  }),
});
const { id: templateSetId } = await res.json();
```

**201**

```json
{ "success": true, "id": "tset_9f2a..." }
```

`sourceMediaId` must be a completed job you own. You can instead define a template directly, without a past job — pass `toolId` and `images.fashion_model` (a catalog id or URL) yourself:

```json
{
  "label": "Editorial, model B",
  "toolId": "virtual_model",
  "images": { "fashion_model": "fm_south_asian_01", "venue": "venue_studio_white" },
  "pose": "pose_standing_relaxed"
}
```

## 2\. Reuse it on a new product

Pass `templateSetId` instead of picking `fashion_model`/`venue`/ `pose` by hand — only the new garment is required.

**cURL**

```bash
curl -X POST https://api.fashiolabs.com/v1/generations \
  -H "Authorization: Bearer fio_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "templateSetId": "tset_9f2a...",
    "images": {
      "garment_photo": "https://your-cdn.com/new-dress.jpg"
    }
  }'
```

**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({
    templateSetId,
    images: { garment_photo: newGarmentUrl },
  }),
});
const { id } = await res.json();
```

Any field you DO pass (e.g. a different `venue`) overrides the template's saved value — only what you omit gets filled in. `toolId` is optional here; when omitted it's taken from the template, and if given it must match the template's own `toolId`.

## 3\. Build a whole catalog from it

The same `templateSetId` works with the pack tools — [Clothing E-com Pack](https://docs.fashiolabs.com/tools/clothing_ecom_pack.md) and [Jewelry E-com Pack](https://docs.fashiolabs.com/tools/jewelry_ecom_pack.md) — so one saved look can fan out into campaign/catalogue/lookbook/e-commerce formats for every new product you run through it, not just a single photo.

```json
{
  "templateSetId": "tset_9f2a...",
  "images": { "user_photo": "https://your-cdn.com/new-product.jpg" }
}
// toolId is "clothing_ecom_pack" on this template — resultUrls comes back with several images
```

## Managing saved templates

### List

**cURL**

```bash
curl https://api.fashiolabs.com/v1/template-sets \
  -H "Authorization: Bearer fio_live_YOUR_KEY"
```

**200**

```json
{
  "success": true,
  "templateSets": [
    {
      "id": "tset_9f2a...",
      "label": "Studio white, model A, 3/4 pose",
      "toolId": "virtual_model",
      "images": { "fashion_model": "https://...", "venue": "https://..." },
      "pose": "pose_standing_relaxed",
      "coverUrl": "https://.../result.jpg"
    }
  ]
}
```

### Delete

**cURL**

```bash
curl -X DELETE https://api.fashiolabs.com/v1/template-sets/tset_9f2a... \
  -H "Authorization: Bearer fio_live_YOUR_KEY"
```

## Common errors

| Status | Meaning |
| --- | --- |
| 400 | `label is required.` |
| 400 | `sourceMediaId has not completed generating yet.` |
| 400 | `toolId must be one of: virtual_model, outfit_photo, ...` |
| 400 | `templateSetId was saved for toolId "X", not "Y".` — on `POST /v1/generations`, when the request's `toolId` doesn't match the saved template. |
| 404 | `sourceMediaId not found.` / `templateSetId not found.` — wrong id, or owned by a different key. |

---

Source: https://docs.fashiolabs.com/template-sets.html · OpenAPI spec: https://docs.fashiolabs.com/openapi.yaml · Docs index: https://docs.fashiolabs.com/llms.txt
