# Embedded Forms

> Let anyone render without a key.

Embedded forms render snaps from a signed URL — no API token. The URL must be a Laravel signed URL; an invalid signature returns 404. The form owner is charged for the render.

## Submit an embedded form

```http
POST /v1/embedded-forms/{formUuid}
```

Renders a snap from a configured form. Template forms return one snap; collection forms return an array of snaps.

Layer keys: template forms use the plain layer key (`headline`); collection forms use `{templateUuid}__{layerKey}`. Only layers the form was configured with are accepted; the rest are dropped silently.

- **Auth:** Signed URL
- **Gates:** embeddedFormMiddleware, valid signature required
- **Credits:** The form owner is charged: 1 credit for a template form, or 1 per template for a collection form.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `formUuid` | path | string | Yes | UUID of the form. |
| `signature` | query | string | Yes | Laravel URL signature. The whole URL must be signed. |

### Request body

Content-Type: `multipart/form-data`

| Field | Type | Required | Validation | Description |
| --- | --- | --- | --- | --- |
| `layers` | object | No | keys matched against the form configuration | Layer overrides. Value keys by layer type: image -> image_url (file), text -> text, empty -> background_color, qr_code -> qr_content. |

### Responses

**201** — Snap rendered (template form).

```json
{
    "data": {
        "id": "9f1c2d3e",
        "media_url": "https://snapsbrew.com/storage/snaps/9f1c2d3e.png",
        "type": "image",
        "status": "completed",
        "is_async": false,
        "webhook_url": null,
        "completed_at": "2026-05-01T12:00:03Z",
        "last_error": null,
        "variants": [],
        "template_id": "141e8454",
        "template_title": "Launch card",
        "created_at": "2026-05-01T12:00:00Z"
    }
}
```

**404** — Form not found or invalid signature.

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

**422** — Collection form has no templates configured.

```json
{
    "message": "The form does not include any templates."
}
```

> Collection forms return a bare array of snap objects, not a `data`-wrapped object.

> This route has no rate limiting.

### Examples

*Curl*

```bash
curl -X POST 'https://snapsbrew.com/api/v1/embedded-forms/<formUuid>?signature=<sig>' \
  -F 'layers[headline]=Summer sale' \
  -F 'layers[logo]=@logo.png'
```
