# Embed

Mint a short-lived session for the embedded builder, mastering bench or stem splitter.

Paths start at `$ACTIVQC_BASE_URL`, and every call sends `Authorization: Bearer $ACTIVQC_KEY`. Errors use the [error envelope](https://activqc.wavbee.com/docs/errors.md). [All endpoints](https://activqc.wavbee.com/docs/api-reference.md).

## POST /v1/embed/sessions

Mint a short-lived embed session.

**Auth:** a secret key, `Authorization: Bearer $ACTIVQC_KEY`.

#### Request body

`application/json`.

Mint a short-lived, single-use embed session for `<wavbee-release-builder>`, `<wavbee-mastering>`, or `<wavbee-stems>`. Send `end_user_ref` plus optional `product` (`builder`, `mastering`, or `stems`), `require_payment`, `draft_id` or `external_ref` (for `builder`), `locale`, `theme`, and `allowed_origin`.

| Field | Type | Description |
|---|---|---|
| `product` | string | Embed product: `builder` (default), `mastering`, or `stems`. Default `builder`. Example `builder`. |
| `require_payment` | boolean | When true on mastering or stems embeds, full-quality downloads post `download.requested` until released via `/v1/mastering/renders/:id/release`. Default `false`. |
| `draft_id` | string | Example `rd_7fK2aBcDeFgHiJkLmNoPqRsT`. |
| `external_ref` | string | Example `rel-2026-042`. |
| `end_user_ref` | string | Example `artist-8842`. |
| `locale` | string | Example `en`. |
| `theme` | object |  |
| `allowed_origin` | string | Example `https://partner.example`. |
| `payload` | object |  |

#### Example request

```bash
curl -s -X POST "$ACTIVQC_BASE_URL/v1/embed/sessions" \
  -H "Authorization: Bearer $ACTIVQC_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "product": "builder",
  "require_payment": false,
  "draft_id": "rd_7fK2aBcDeFgHiJkLmNoPqRsT",
  "external_ref": "rel-2026-042",
  "end_user_ref": "artist-8842",
  "locale": "en",
  "allowed_origin": "https://partner.example"
}'
```

#### Responses

| Status | Meaning |
|---|---|
| `201` | Embed session minted. |
| `401` | Missing or unknown API key. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `403` | Console session key or builder.embed not enabled. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `404` | Draft_id not found or owned by another tenant. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |
| `422` | Embed not configured or invalid input. [Error envelope](https://activqc.wavbee.com/docs/errors.md). |

#### Response `201`

| Field | Type | Description |
|---|---|---|
| `object` | string | **Required.** Always `embed.session`. |
| `id` | string | **Required.** Example `es_7fK2aBcDeFgHiJkLmNoP`. |
| `product` | string | **Required.** One of `builder`, `mastering`, `stems`. |
| `require_payment` | boolean | **Required.** Example `false`. |
| `client_token` | string | **Required.** Single-use token valid for 30 minutes. Pass to the embed element's `client-token`. Example `wqc_es_9f3c...`. |
| `expires_at` | string (date-time) | **Required.** |
| `draft_id` | string or null | **Required.** Example `rd_7fK2aBcDeFgHiJkLmNoPqRsT`. |
| `url` | string | **Required.** Example `https://YOUR-ACTIVQC-HOST/embed/builder?token=wqc_es_9f3c...`. |

```json
{
  "object": "embed.session",
  "id": "es_7fK2aBcDeFgHiJkLmNoP",
  "product": "builder",
  "require_payment": false,
  "client_token": "wqc_es_9f3c...",
  "expires_at": "2026-11-24T10:00:00Z",
  "draft_id": "rd_7fK2aBcDeFgHiJkLmNoPqRsT",
  "url": "https://YOUR-ACTIVQC-HOST/embed/builder?token=wqc_es_9f3c..."
}
```

