# Preview

> See it before you spend a credit.

Preview renders a template (optionally with variants) into a WATERMARKED, self-contained HTML document without creating a snap and without charging a credit. The response is the rendered HTML — nothing is rasterized and nothing is persisted. Use it to iterate, then call POST /v1/snaps to produce the final, un-watermarked, billed snap image with the same variants. Available to trial users (no active subscription required). Rate-limited separately from the rest of the API.

## Preview a template

```http
GET /v1/templates/{templateUuid}/preview
```

Renders a free, watermarked preview of a template using its default layer content, or with `variants` applied. Returns a self-contained HTML document (text/html).

- **Auth:** Bearer token
- **Token abilities:** `api_requests`
- **Gates:** throttle:preview
- **Credits:** Free — no credits consumed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `templateUuid` | path | string | Yes | UUID of the template to preview. |
| `variants` | query | array | No | Per-layer overrides, e.g. variants[0][layer]=headline&variants[0][text]=Hello. Each item targets a layer key with one of text, image_url (public URL), background_color, qr_content, or hidden. |

### Responses

**200** — Watermarked HTML preview (text/html).

```json
"<!DOCTYPE html>\u2026watermarked preview\u2026</html>"
```

**404** — Template not found in your account.

```json
{
    "message": "Not found."
}
```

**422** — Validation failed (e.g. a non-public image_url).

```json
{
    "message": "The variants.0.image_url must be a public http or https URL."
}
```

**429** — Preview rate limit exceeded.

```json
{
    "message": "Too Many Attempts."
}
```

> The preview is watermarked HTML, not a usable final asset.

> No credit is charged and no snap is stored.

### Examples

*Curl*

```bash
curl 'https://snapsbrew.com/api/v1/templates/<uuid>/preview' \
  -H 'Authorization: Bearer <your-token>' \
  --output preview.html
```

## Preview a snap

```http
GET /v1/snaps/preview
```

Renders a free, watermarked preview of the snap you intend to create — a template (`template_id`) plus `variants`. Returns a self-contained HTML document (text/html). Pass the same template_id and variants to POST /v1/snaps to create the final billed snap.

- **Auth:** Bearer token
- **Token abilities:** `api_requests`
- **Gates:** throttle:preview
- **Credits:** Free — no credits consumed.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `template_id` | query | string | Yes | UUID of the template to render. |
| `variants` | query | array | No | Per-layer overrides, e.g. variants[0][layer]=headline&variants[0][text]=Hello. Each item targets a layer key with one of text, image_url (public URL), background_color, qr_content, or hidden. |

### Responses

**200** — Watermarked HTML preview (text/html).

```json
"<!DOCTYPE html>\u2026watermarked preview\u2026</html>"
```

**404** — Template not found in your account.

```json
{
    "message": "Not found."
}
```

**422** — Validation failed.

```json
{
    "message": "The template id field is required."
}
```

**429** — Preview rate limit exceeded.

```json
{
    "message": "Too Many Attempts."
}
```

> The preview is watermarked HTML, not a usable final asset.

> No credit is charged and no snap is stored.

### Examples

*Curl*

```bash
curl 'https://snapsbrew.com/api/v1/snaps/preview?template_id=<uuid>&variants[0][layer]=headline&variants[0][text]=Hello' \
  -H 'Authorization: Bearer <your-token>' \
  --output preview.html
```
