# Embeds

Publishable keys, embed tokens and the endpoints behind the widgets.

Related guide: [Set up](https://provenanceauth.com/docs/embeds.md)

## Endpoints

- `POST /v1/embed/publishable_keys`: [Create a publishable key](#post-v1-embed-publishable-keys)
- `POST /v1/embed/tokens`: [Create an embed token](#post-v1-embed-tokens)
- `POST /v1/embed/links`: [Create a hosted page link](#post-v1-embed-links)
- `PATCH /v1/embed/publishable_keys/{id}`: [Update a publishable key](#patch-v1-embed-publishable-keys-id)
- `GET /v1/embed/publishable_keys`: [List publishable keys](#get-v1-embed-publishable-keys)
- `DELETE /v1/embed/publishable_keys/{id}`: [Revoke a publishable key](#delete-v1-embed-publishable-keys-id)

## The publishable key object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Unique identifier for the object. |
| `object` | enum | yes | The type of object. One of `publishable_key`. |
| `publishable_key` | string | no | The publishable key, for your web pages. |
| `key_prefix` | string | no | The key's first characters, for recognizing it. |
| `name` | string | no | A name you choose. |
| `environment` | string | no | `sandbox` or `live`. |
| `allowed_origins` | array of strings \| null | no | The sites the key may run on; `null` means any site. |
| `created_at` | timestamp | no | When it was created. |
| `revoked_at` | timestamp \| null | no | When it was revoked, or null. |
| `deleted` | boolean | no | Always true for a deleted object. |

### Example

```json
{
  "id": "01M6VQBCVW0TERKDZEA5GBQ84E",
  "object": "publishable_key",
  "key_prefix": "prv_pub_3eNk21Ir",
  "name": "customer-portal",
  "environment": "sandbox",
  "allowed_origins": null,
  "created_at": "2026-11-07T19:21:46.620Z",
  "revoked_at": null,
  "publishable_key": "prv_pub_3eNk21IraxgfYA70pJsvx1Ua0fVyZoQS"
}
```

## Create a publishable key

`POST /v1/embed/publishable_keys`

Creates a publishable key for your web pages. It identifies your account to the embed endpoints and reads no data, so it's safe in a browser.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `name` | body | string | no | A name you choose. |
| `allowed_origins` | body | array of strings \| null | no | The sites the key may run on (see `updatePublishableKey`). Omit for any site. |

### Returns

The publishable key. It's shown only once. See [the publishable key object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/embed/publishable_keys" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "customer-portal" }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/publishable_keys`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "customer-portal" }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/embed/publishable_keys", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "name": "customer-portal"
}).json()
```

### Response 201

```json
{
  "id": "01M6VQBCVW0TERKDZEA5GBQ84E",
  "object": "publishable_key",
  "key_prefix": "prv_pub_3eNk21Ir",
  "name": "customer-portal",
  "environment": "sandbox",
  "allowed_origins": null,
  "created_at": "2026-11-07T19:21:46.620Z",
  "revoked_at": null,
  "publishable_key": "prv_pub_3eNk21IraxgfYA70pJsvx1Ua0fVyZoQS"
}
```

## Create an embed token

`POST /v1/embed/tokens`

Mints a short-lived token that lets one widget render one object, for up to 15 minutes. Call it from your backend with a secret key. A key mints only its own products' widgets (see `widget`); without the scope it gets `403 insufficient_scope`, which names it.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `widget` | body | enum | yes | The widget, such as `approve` or `receipt`. `capture`, `capture_result`, `capture_request`, `capture_list` and `appeal` need a key with the `attest` scope; `checkout_result`, `checkout_list` and `chargeback_protection` need `authorize`; `run_result`, `run_list` and the proposals widget (`'counter_offers'`) need `mandate`; `traffic_list` and `traffic_result` need `identify`; `rules` needs the scope of its kind's product (`authorize` for `checkout`, `mandate` for `intent` and `mandate_limits`, `attest` for `capture`); `embed` and `text_consent` take any account key; the rest need `authorize` or `mandate`. |
| `object_id` | body | string | no | The single object this token may touch: a draft (`mdr_…`) or, with mode `checkin`, a mandate for `mandate`; a claim for `appeal` (minted with a `verify` key); your account's `box_id` (`GET /v1/account/text_consent`) for `text_consent`, the consent box; a capture request (`capr_…`) of your account for `capture_result` (another kind of id is `400 embed_object_kind_mismatch`); a checkout assessment (`cas_…`) or a cart approval (`coap_…`) of your account for `checkout_result`; an agent run (`run_…`) of your account for `run_result` and for `'counter_offers'`; a traffic assessment (`tas_…`, a hosted check) of your account for `traffic_result`; your case reference (1 to 200 characters, the requests' `case_id`) for `capture_request`, the request composer; the kind of rules, `checkout`, `intent`, `capture` or `mandate_limits`, for `rules`. Required for every widget except `agent_access`, `approvals`, `capture_list`, `checkout_list`, `run_list` and `traffic_list` (a list takes none: it is scoped to your account and its `filters`) and `chargeback_protection` (scoped to your account). |
| `subject` | body | object | no | `agent_access` and `approvals` only: the one person the token shows. The response's `object_id` is then a pairwise value, never the device or approver. |
| `subject.device_id` | body | string | no | `agent_access`: the person's device. |
| `subject.approver_link_id` | body | string | no | `approvals`: one of your accepted approver links; the token lists that approver's requests from your company. |
| `ttl` | body | integer | no | Seconds (≤ 900). |
| `mode` | body | string | no | The widget's mode, such as `consent`, or `checkin` for a mandate check-in. A result widget's mode is `view`; the request composer's is `send`; `rules` takes `view` (the default), `edit` or `publish`; a console session minting `edit` or `publish` needs Manage policies and a recent step-up, as a direct policy write does (`403 manage_policies_required`, `recent_two_factor_required`). |
| `publishable_key_id` | body | string | no | Optional binding to one publishable key: the token then works only with that key (another key of the account gets `401 embed_token_invalid`). |
| `show` | body | array of enums | no | `capture_result` only: also show the request's `case_id` or `metadata` in the embed. `capture_list` takes `case_id` only, shown on each row. Nothing else is ever shown. |
| `author` | body | object | no | `capture_request` only, required: who is using the composer, as you report it. Recorded on each request the session sends (`author`); Provenance doesn't check it. |
| `author.id` | body | string | yes | Your reference for the staff member (1 to 200 characters). |
| `author.display_name` | body | string | yes | Their display name (1 to 120 characters). |
| `request` | body | object | no | `capture_request` only, required: the options every send of the session stays within. A send outside them is `400 embed_request_out_of_scope`. |
| `request.kinds` | body | array of enums | yes | What the session may send: an ID session, a claim session, or your own items. |
| `request.accepted_documents` | body | array of enums | no | `capture.id`: the document kinds accepted (one: the person isn't asked to choose). |
| `request.photos` | body | object | no | `capture.claim`: `{ min, max, until_done }` photos. |
| `request.videos` | body | object | no | `capture.claim`: `{ min, max, max_duration_s }` videos. |
| `request.items` | body | array of objects | no | `capture.items` (required with it): the items, as on a create. |
| `request.require_tier` | body | object | no | `{ default: any \| hardware, editable }`: the hardware requirement, and whether staff may change it (not by default). |
| `request.expires_in` | body | object | no | `{ default, max }` in seconds: the expiry and the longest staff may pick. |
| `request.reminders` | body | enum | no | `account` (default): the account's schedule, which staff may turn off. One of `account`, `off`. |
| `request.contact` | body | object | no | A phone or email to send to. It stays on the server; the element shows it masked. |
| `request.contact_editable` | body | boolean | no | Whether staff may replace a prefilled contact (not by default). |
| `request.entry` | body | enum | no | Who types the contact: `staff` (default) or `person` (a kiosk or counter, where the person ticks their own consent box). One of `staff`, `person`. |
| `request.qr` | body | boolean | no | Whether **Show a QR** is offered (default true). |
| `request.max_sends` | body | integer | no | Requests the session may send (default 3). |
| `request.reference_addresses` | body | array of objects | no | Up to five addresses every send carries, as `reference_addresses` on a capture request create (one of each kind, `other` up to two; an `address` or a `location`, never both), so capture rules can compare each shot's place with them: a bank's application address as a `person` reference, for example. The element shows each by its label (or kind), never the address. |
| `request.reference_addresses.kind` | body | enum | yes | What the address is. One of `loss`, `person`, `business`, `shipping`, `other`. |
| `request.reference_addresses.label` | body | string \| null | no | Your label for it; the element shows it. |
| `request.reference_addresses.address` | body | object | no | A postal address. |
| `request.reference_addresses.address.line1` | body | string | yes | The street line. |
| `request.reference_addresses.address.line2` | body | string \| null | no | A second line. |
| `request.reference_addresses.address.city` | body | string | yes | The city. |
| `request.reference_addresses.address.region` | body | string \| null | no | The ISO 3166-2 subdivision code (`OH` or `US-OH`). |
| `request.reference_addresses.address.postal_code` | body | string \| null | no | The postal code. |
| `request.reference_addresses.address.country` | body | string | yes | ISO 3166-1 alpha-2. |
| `request.reference_addresses.location` | body | object | no | Coordinates (no geocoder needed). |
| `request.reference_addresses.location.lat` | body | number | yes | Latitude. |
| `request.reference_addresses.location.lng` | body | number | yes | Longitude. |
| `rules` | body | object | no | `rules` only, required: everything a rules session may show and touch, passed on every mint (nothing is saved between sessions). Strict: an unknown key is `400 parameter_invalid`, so a typo never widens a session. At most 16 KB. The response echoes it as stored, every default written out. |
| `rules.show` | body | array of objects | yes | The rules the session sees, by id. They show in the policy's own order; rules not listed stay hidden. |
| `rules.show.rule_id` | body | string | yes | A rule of the kind's live policy (else `400 rules_embed_rule_missing`). For `mandate_limits`, a row: `cap`, `budget`, `allowed_mcc`, `named_merchants`, `blocked_mcc`, `blocked_merchants`, `refuse_over_cap`, `refuse_over_share` or `ask_over_cap`. |
| `rules.show.template` | body | string | no | A template id of the kind the row reads as. |
| `rules.show.fields` | body | array of objects | no | The values that are blanks, each a path into the rule (`when.0.value`) with its bounds. |
| `rules.show.fields.path` | body | string | yes | A condition's value: `when.N.value`, `when.items.N.value` or `when.items.N.conditions.M.value`. For `mandate_limits`: `amount` on `cap`, `allocation` (`shared`, `reserved`) and `at_limit` (`stop`, `ask`, `continue`) on `budget`, `value` on a margin row (with `advanced`, its unit, a percentage or a fixed amount, is offered beside it; the bounds bound a percentage). |
| `rules.show.fields.min` | body | number | no | A number blank's lowest value. |
| `rules.show.fields.max` | body | number | no | A number blank's highest value. |
| `rules.show.fields.values` | body | array of strings | no | The words a word blank may take (the field's own values). |
| `rules.show.can_turn_off` | body | boolean | no | Whether the session may turn the rule off (not by default). |
| `rules.show.locked` | body | boolean | no | Shown read-only: no blanks, no turning off. |
| `rules.add_from_templates` | body | array of strings | no | Template ids of the kind the session may add (none by default). |
| `rules.advanced` | body | boolean | no | Whether an `edit` or `publish` session may open the Advanced view (not by default): whole rules from the kind's catalog (`GET /v1/embed/rules/catalog`), a shown rule replaced or a new one added. On `mandate_limits`, a margin row's unit: a fixed amount instead of a percentage. On every plan. |
| `rules.visibility` | body | enum | no | Which rules the session shows besides those in `show`: every rule of the policy (`all`, the default with `manage`; with full control each can be changed like a listed rule, without it they're read-only) or only the rules the session itself added (`session`, the default without `manage`). Not on `mandate_limits`. One of `all`, `session`. |
| `rules.manage` | body | boolean | no | Full control (not by default): in an `edit` or `publish` session, every shown rule that isn't locked can be moved (`order`), turned off, deleted (`remove`), duplicated (`copy_of`) and have every value edited; with `advanced`, its conditions and outcome too, the default rows included. A listed rule missing from the policy is left out of the session rather than refused. Not on `mandate_limits`. |
| `rules.advanced_fields` | body | array of strings | no | With `advanced`: the catalog fields the Advanced view's field picker offers, by key (`order.amount`, `agent.bot_likelihood_score`; the keys of `GET /v1/embed/rules/catalog`), each listed once. A new condition in the session reads one of them; a rule it edits keeps the fields it already reads (anything else is `400 rules_embed_out_of_scope`). Absent: every field of the kind's catalog. Not on `mandate_limits`. |
| `rules.saves` | body | enum | no | `draft` (the default): a save waits to be published. `publish` needs mode `publish`. One of `draft`, `publish`. |
| `rules.draft_group` | body | string \| null | no | Sandbox only (`400` in live): an opaque label up to 64 characters that keeps one group's drafts from another's. |
| `filters` | body | object | no | The list widgets only: filters pinned for the session, which the browser can't change (another value is `400 embed_filter_pinned`). `capture_list`: any of `status`, `item_type`, `source`, `destination`, `case_id`, `created_gte` and `created_lte`, with the values the capture request list takes. `checkout_list`: any of `outcome` (which also takes `in_review`), `approval_status`, `order_id`, `created_gte` and `created_lte`, with the values the checkout assessment list takes. `run_list`: any of `status` (one value, or several separated by commas), `q`, `created_gte` and `created_lte`, with the values the run list takes. `traffic_list`: any of `outcome`, `class` and `bot_likelihood` (each one value, or several separated by commas), `signed`, `created_gte` and `created_lte`, with the values the traffic assessment list takes. |
| `filters.status` | body | string | no | `capture_list`: the request's status (`pending`, `in_progress`, `completed`, `expired`, `cancelled`). `run_list`: the run's status (`active`, `halted`, `ended`), one or several separated by commas. |
| `filters.item_type` | body | enum | no | An item type the request asks for. One of `photo`, `selfie`, `id_document`, `video`. |
| `filters.source` | body | enum | no | How an item was taken. One of `browser`, `native_sdk`. |
| `filters.destination` | body | enum | no | Where the link opened. One of `company_app`, `provenance_app`, `app_clip`, `web`. |
| `filters.case_id` | body | string | no | Your case reference, for example one case's requests. |
| `filters.created_gte` | body | timestamp | no | Created at or after this time. |
| `filters.created_lte` | body | timestamp | no | Created at or before this time. |
| `filters.outcome` | body | string | no | `checkout_list`: the outcome (`allow`, `challenge`, `reject`; `frictionless` is still accepted), or `in_review` (an approval waiting for your review). `traffic_list`: the decision (`allow`, `block`, `log_only`, `rate_limit`, `challenge`, `require_intent`), one or several separated by commas. |
| `filters.approval_status` | body | enum | no | `checkout_list`: the cart approval's status. One of `pending`, `in_review`, `approved`, `denied`, `expired`. |
| `filters.order_id` | body | string | no | `checkout_list`: orders whose reference contains this text. |
| `filters.q` | body | string | no | `run_list`: runs whose name or ID contains this text. |
| `filters.class` | body | string | no | `traffic_list`: Identify's class (`signed_agent`, `declared_bot`, `suspected_bot`, `likely_human`, `unknown`), one or several separated by commas. |
| `filters.signed` | body | enum | no | `traffic_list`: the agent signature verified, or didn't. One of `true`, `false`. |
| `filters.bot_likelihood` | body | string | no | `traffic_list`: the bot likelihood band (`low`, `medium`, `high`, `unclassified`), one or several separated by commas. |

### Returns

The embed token, what it allows and when it expires.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`embed_object_kind_mismatch`](https://provenanceauth.com/docs/platform/errors.md#embed_object_kind_mismatch)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rules_embed_rule_missing`](https://provenanceauth.com/docs/platform/errors.md#rules_embed_rule_missing)
- [`usage_limit_reached`](https://provenanceauth.com/docs/platform/errors.md#usage_limit_reached)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/embed/tokens" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "widget": "embed", "object_id": "portal-check", "ttl": 600 }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/tokens`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "widget": "embed", "object_id": "portal-check", "ttl": 600 }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/embed/tokens", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "widget": "embed",
    "object_id": "portal-check",
    "ttl": 600
}).json()
```

### Response 201

```json
{
  "id": "01M7PR98M85EQ5R7KN5G0NMQQA",
  "object": "embed_token",
  "embed_token": "emb_t8_BVFyYgWWvSKe643GUUTBtBPeuOJH7JTCez2_QsCk",
  "widget": "embed",
  "object_id": "portal-check",
  "mode": null,
  "expires_at": "2026-11-18T07:27:34.984Z"
}
```

## Create a hosted page link

`POST /v1/embed/links`

Mints a link to a Provenance-hosted page, laid out for phones, that shows one result view, the request composer or your rules (`rules`, the hosted rules page). Same body and checks as `POST /v1/embed/tokens`; call it from your backend. The link opens once within `ttl`, and the page then works for `session_ttl`. Pro and up; the rules page is open on any plan in sandbox.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `widget` | body | enum | yes | The page's element. `capture_result` and `capture_request` need a key with the `attest` scope; `checkout_result` needs `authorize`; `run_result` needs `mandate`; `traffic_result` needs `identify`; `rules` needs the scope of its kind's product (`authorize` for `checkout`, `mandate` for `intent`, `attest` for `capture`). Another widget is `400 parameter_invalid`. One of `capture_result`, `capture_request`, `checkout_result`, `run_result`, `rules`, `traffic_result`. |
| `object_id` | body | string | yes | As for the token: a capture request (`capr_…`) for `capture_result`, a checkout assessment (`cas_…`) or cart approval (`coap_…`) for `checkout_result`, an agent run (`run_…`) for `run_result`, a traffic assessment (`tas_…`) for `traffic_result`, your case reference for `capture_request`, the kind of rules (`checkout`, `intent`, `capture` or `mandate_limits`) for `rules`. |
| `mode` | body | string | no | `view` for a result view, `send` for the composer (the defaults); `rules` takes `view` (the default), `edit` or `publish` (with `rules.saves: publish`). |
| `rules` | body | object | no | `rules` only, required: everything a rules session may show and touch, passed on every mint (nothing is saved between sessions). Strict: an unknown key is `400 parameter_invalid`, so a typo never widens a session. At most 16 KB. The response echoes it as stored, every default written out. |
| `rules.show` | body | array of objects | yes | The rules the session sees, by id. They show in the policy's own order; rules not listed stay hidden. |
| `rules.show.rule_id` | body | string | yes | A rule of the kind's live policy (else `400 rules_embed_rule_missing`). For `mandate_limits`, a row: `cap`, `budget`, `allowed_mcc`, `named_merchants`, `blocked_mcc`, `blocked_merchants`, `refuse_over_cap`, `refuse_over_share` or `ask_over_cap`. |
| `rules.show.template` | body | string | no | A template id of the kind the row reads as. |
| `rules.show.fields` | body | array of objects | no | The values that are blanks, each a path into the rule (`when.0.value`) with its bounds. |
| `rules.show.fields.path` | body | string | yes | A condition's value: `when.N.value`, `when.items.N.value` or `when.items.N.conditions.M.value`. For `mandate_limits`: `amount` on `cap`, `allocation` (`shared`, `reserved`) and `at_limit` (`stop`, `ask`, `continue`) on `budget`, `value` on a margin row (with `advanced`, its unit, a percentage or a fixed amount, is offered beside it; the bounds bound a percentage). |
| `rules.show.fields.min` | body | number | no | A number blank's lowest value. |
| `rules.show.fields.max` | body | number | no | A number blank's highest value. |
| `rules.show.fields.values` | body | array of strings | no | The words a word blank may take (the field's own values). |
| `rules.show.can_turn_off` | body | boolean | no | Whether the session may turn the rule off (not by default). |
| `rules.show.locked` | body | boolean | no | Shown read-only: no blanks, no turning off. |
| `rules.add_from_templates` | body | array of strings | no | Template ids of the kind the session may add (none by default). |
| `rules.advanced` | body | boolean | no | Whether an `edit` or `publish` session may open the Advanced view (not by default): whole rules from the kind's catalog (`GET /v1/embed/rules/catalog`), a shown rule replaced or a new one added. On `mandate_limits`, a margin row's unit: a fixed amount instead of a percentage. On every plan. |
| `rules.visibility` | body | enum | no | Which rules the session shows besides those in `show`: every rule of the policy (`all`, the default with `manage`; with full control each can be changed like a listed rule, without it they're read-only) or only the rules the session itself added (`session`, the default without `manage`). Not on `mandate_limits`. One of `all`, `session`. |
| `rules.manage` | body | boolean | no | Full control (not by default): in an `edit` or `publish` session, every shown rule that isn't locked can be moved (`order`), turned off, deleted (`remove`), duplicated (`copy_of`) and have every value edited; with `advanced`, its conditions and outcome too, the default rows included. A listed rule missing from the policy is left out of the session rather than refused. Not on `mandate_limits`. |
| `rules.advanced_fields` | body | array of strings | no | With `advanced`: the catalog fields the Advanced view's field picker offers, by key (`order.amount`, `agent.bot_likelihood_score`; the keys of `GET /v1/embed/rules/catalog`), each listed once. A new condition in the session reads one of them; a rule it edits keeps the fields it already reads (anything else is `400 rules_embed_out_of_scope`). Absent: every field of the kind's catalog. Not on `mandate_limits`. |
| `rules.saves` | body | enum | no | `draft` (the default): a save waits to be published. `publish` needs mode `publish`. One of `draft`, `publish`. |
| `rules.draft_group` | body | string \| null | no | Sandbox only (`400` in live): an opaque label up to 64 characters that keeps one group's drafts from another's. |
| `show` | body | array of enums | no | `capture_result` only: also show the request's `case_id` or `metadata`. |
| `author` | body | object | no | `capture_request` only, required: who will use the page, as you report it. |
| `author.id` | body | string | yes | Your reference for the staff member. |
| `author.display_name` | body | string | yes | Their display name. |
| `request` | body | object | no | `capture_request` only, required: the send options, as on `POST /v1/embed/tokens`. `max_sends` counts every send of the page session. |
| `ttl` | body | integer | no | Seconds the link may be opened in (≤ 900, default 900). |
| `session_ttl` | body | integer | no | Seconds the opened page works for (60 to 3600, default 3600). |

### Returns

The link: open it on a phone, send it by email or text, or open it in an in-app browser.

### Errors

- [`embed_object_kind_mismatch`](https://provenanceauth.com/docs/platform/errors.md#embed_object_kind_mismatch)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rules_embed_rule_missing`](https://provenanceauth.com/docs/platform/errors.md#rules_embed_rule_missing)
- [`trial_ended`](https://provenanceauth.com/docs/platform/errors.md#trial_ended)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x
curl -s -X POST "$PROVENANCE_API/v1/attest/capture_requests" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "case_id": "LMB-20418", "delivery": "self", "session_type": "id" }' > step.json
export CAPTURE_REQUEST_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/embed/links" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d "{
    \"widget\": \"capture_result\",
    \"object_id\": \"$CAPTURE_REQUEST_ID\",
    \"show\": [
      \"case_id\"
    ]
  }"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/capture_requests`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x", "Content-Type": "application/json" },
  body: JSON.stringify({ "case_id": "LMB-20418", "delivery": "self", "session_type": "id" }),
})).json();
const captureRequestId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/links`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "widget": "capture_result",
    "object_id": captureRequestId,
    "show": [
      "case_id"
    ]
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/attest/capture_requests", headers={"Authorization": "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x"}, json={
    "case_id": "LMB-20418",
    "delivery": "self",
    "session_type": "id"
}).json()
capture_request_id = step1["id"]
data = httpx.post(f"{api}/v1/embed/links", headers={"Authorization": "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x"}, json={
    "widget": "capture_result",
    "object_id": capture_request_id,
    "show": [
        "case_id"
    ]
}).json()
```

### Response 201

```json
{
  "id": "01M7KCG7JZ4PJHKB38QFV7FR74",
  "object": "embed_link",
  "url": "http://localhost:5173/r?t=embl_BteyFysm89vLOrxixijtnuDO9ZMKLtfBKxSFSE5rqMM",
  "widget": "capture_result",
  "object_id": "capr_01M7KCG7JX0KTQ9NR3NXB5AZDM",
  "mode": "view",
  "show": [
    "case_id"
  ],
  "expires_at": "2026-11-17T00:08:57.087Z",
  "session_ttl": 3600
}
```

## Update a publishable key

`PATCH /v1/embed/publishable_keys/{id}`

Renames a publishable key or sets the sites it may run on. With `allowed_origins`, embed requests from any other site get 403 `embed_origin_not_allowed`, and only those sites can frame the passkey page. `null` allows any site again.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |
| `name` | body | string | no | A name you choose. |
| `allowed_origins` | body | array of strings \| null | no | Up to 10 origins (`https://host[:port]`, no path). Sandbox keys may also list `http://localhost:<port>` or `http://localhost:*`. `null` allows any site. |

### Returns

The updated publishable key. See [the publishable key object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/embed/publishable_keys" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "customer-portal" }' > step.json
export PUBLISHABLE_KEY_ID=$(jq -r '.id' step.json)
curl -X PATCH "$PROVENANCE_API/v1/embed/publishable_keys/$PUBLISHABLE_KEY_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "allowed_origins": ["https://portal.example.com"] }'
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/publishable_keys`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "customer-portal" }),
})).json();
const publishableKeyId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/publishable_keys/${publishableKeyId}`, {
  method: "PATCH",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "allowed_origins": ["https://portal.example.com"] }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/embed/publishable_keys", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "name": "customer-portal"
}).json()
publishable_key_id = step1["id"]
data = httpx.patch(f"{api}/v1/embed/publishable_keys/{publishable_key_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "allowed_origins": [
        "https://portal.example.com"
    ]
}).json()
```

### Response 200

```json
{
  "id": "01M6VQBCW1C07AFKTHV5NKQT10",
  "object": "publishable_key",
  "key_prefix": "prv_pub_LdlTvft9",
  "name": "customer-portal",
  "environment": "sandbox",
  "allowed_origins": [
    "https://portal.example.com"
  ],
  "created_at": "2026-11-07T19:21:46.625Z",
  "revoked_at": null
}
```

## List publishable keys

`GET /v1/embed/publishable_keys`

Lists your account's publishable keys.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

No parameters.

### Returns

The publishable keys.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/embed/publishable_keys" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/publishable_keys`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/embed/publishable_keys", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}
```

## Revoke a publishable key

`DELETE /v1/embed/publishable_keys/{id}`

Revokes a publishable key. Widgets using it stop rendering.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

The object, now revoked. See [the publishable key object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/embed/publishable_keys" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "customer-portal" }' > step.json
export PUBLISHABLE_KEY_ID=$(jq -r '.id' step.json)
curl -X DELETE "$PROVENANCE_API/v1/embed/publishable_keys/$PUBLISHABLE_KEY_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/publishable_keys`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "name": "customer-portal" }),
})).json();
const publishableKeyId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/publishable_keys/${publishableKeyId}`, {
  method: "DELETE",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/embed/publishable_keys", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "name": "customer-portal"
}).json()
publishable_key_id = step1["id"]
data = httpx.delete(f"{api}/v1/embed/publishable_keys/{publishable_key_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "01M6VQBCVXG52HSP65RKNY0M02",
  "object": "publishable_key",
  "deleted": true
}
```
