# Embed Provenance

Put Provenance's approval, approvals inbox, verification, capture, signing, enrollment, order-review, grant, agent-access, appeal and trace views inside your own product as web components.

Use `@provenance/embed` to put Provenance's ceremonies inside your own pages as `<provenance-*>` web components: approvals, verification badges and receipts, attested capture, signing, approver enrollment, grants, claim appeals and trace views.

They run in your page and follow its theme, within contrast limits that keep every verdict readable. Passkey steps run in a small frame on Provenance's domain, so a passkey works on any site and on every Provenance page.

**Before you begin:** export the sandbox account key. Your backend uses it to mint short-lived embed tokens; it never goes to a browser.

```bash
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
```

Three credentials are involved:

| Credential | Where it lives | What it can do |
| --- | --- | --- |
| Secret API key, `prv_test_…` or `prv_live_…` | Your backend only | Everything your account can do, including minting embed tokens |
| Publishable key, `prv_pub_…` | Your web pages | Identifies your account to the embed endpoints, and reads no data |
| Embed token, `emb_…` | One page view | Lets one widget render one object, for up to 15 minutes |

## 1. Create a publishable key

Create one per site with [`POST /v1/embed/publishable_keys`](https://provenanceauth.com/docs/api/embeds.md#post-v1-embed-publishable-keys). It's safe to ship in your page's HTML:

**curl**

```bash
curl -s $PROVENANCE_API/v1/embed/publishable_keys \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "customer-portal" }' | tee publishable-key.json
export PUBLISHABLE_KEY=$(jq -r .publishable_key publishable-key.json)
```

**Node**

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

**Python**

```python
import os
import httpx

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

```json
{
  "id": "01M5Q9JQPY95XBQTTP3TBQE4TM",
  "object": "publishable_key",
  "publishable_key": "prv_pub_1D10TzJo8F73Z7ZHhWGKPpn0K7suJ0se",
  "key_prefix": "prv_pub_1D10TzJo",
  "name": "customer-portal",
  "environment": "sandbox"
}
```

## 2. Mint an embed token on your backend

For each page view, your backend mints a token for one widget and one object with [`POST /v1/embed/tokens`](https://provenanceauth.com/docs/api/embeds.md#post-v1-embed-tokens). Only a secret key can do this, so which object a page shows is always your backend's decision. A key mints only its own products' widgets:

| Widgets | The key needs | Create it as |
| --- | --- | --- |
| `capture`, `capture_result`, `capture_request`, `appeal` | `attest` | an Attest key |
| `approve`, `approvals`, `heartbeat`, `grant`, `agent_access`, `enroll`, `sign`, `receipt`, `verify`, `badge` | `authorize` or `mandate` | an Authorize or Mandate key |
| `checkout_result` | `authorize` | an Authorize key |
| `run_result` | `mandate` | a Mandate key |
| `traffic_list`, `traffic_result` | `identify` | an Identify key |
| `embed`, `text_consent` | any account key | any secret key |

A key without the scope gets `403` [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope), which names the scope. A console session mints by its role. Create a key for the products you embed under **Developers → API keys** ([create a key for your products](https://provenanceauth.com/docs/get-started/authentication.md#create-a-key-for-your-products)).

This mints a token for the diagnostic widget, which renders what the token is scoped to:

**curl**

```bash
curl -s $PROVENANCE_API/v1/embed/tokens \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "widget": "embed", "object_id": "portal-check", "ttl": 600 }' | tee embed-token.json
export EMBED_TOKEN=$(jq -r .embed_token embed-token.json)
```

**Node**

```ts
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const { embedToken } = await prov.embed.createToken({ widget: "embed", objectId: "portal-check", ttl: 600 });
```

**Python**

```python
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
embed_token = prov.embed.create_token(widget="embed", object_id="portal-check", ttl=600)["embed_token"]
```

**Go**

```go
embed := &pv.Embed{APIBase: os.Getenv("PROVENANCE_API"), SecretKey: os.Getenv("PROVENANCE_KEY")}
minted, err := embed.CreateToken(ctx, pv.EmbedTokenParams{Widget: "embed", ObjectID: "portal-check", TTL: 600})
```

```json
{
  "id": "01M5Q9K926ZPQRVV02J0ZA267H",
  "object": "embed_token",
  "embed_token": "emb_qZEiUQvIiNdSO2MoRzQBSHr4tJXmvQJPzbjMOkLNO24",
  "widget": "embed",
  "object_id": "portal-check",
  "mode": null,
  "expires_at": "2026-10-24T15:58:45.254Z"
}
```

The widget calls the embed endpoints with the token and the publishable key. You can make the same call to see what it gets back, which is only what the widget renders:

**curl**

```bash
curl $PROVENANCE_API/v1/embed/session \
  -H "Authorization: Bearer $EMBED_TOKEN" \
  -H "X-Provenance-Publishable-Key: $PUBLISHABLE_KEY"
```

**Node**

```ts
const session = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/session`, {
  headers: { Authorization: `Bearer ${embedToken}`, "X-Provenance-Publishable-Key": publishableKey },
})).json();
```

**Python**

```python
session = httpx.get(
    f"{api}/v1/embed/session",
    headers={"Authorization": f"Bearer {embed_token}", "X-Provenance-Publishable-Key": publishable_key},
).json()
```

```json
{
  "object": "embed_session",
  "widget": "embed",
  "object_id": "portal-check",
  "mode": null,
  "environment": "sandbox",
  "trust": { "mark": "Provenance", "consent_is_draft": true }
}
```

The session also carries `branding` (your account's name, logo and colours, or null) and `passkey`, the page on Provenance's domain that runs passkey steps.

## 3. Render the widget

Load the script once and pass the publishable key and the token to the element. In React, `@provenance/embed/react` has a typed component for each widget.

**HTML**

```html
<script type="module" src="https://unpkg.com/@provenance/embed"></script>

<provenance-approve
  base-url="https://sandbox-api.provenanceauth.com"
  publishable-key="prv_pub_1D10TzJo8F73Z7ZHhWGKPpn0K7suJ0se"
  embed-token="emb_qZEiUQvIiNdSO2MoRzQBSHr4tJXmvQJPzbjMOkLNO24"
  theme="inherit">
</provenance-approve>

<script>
  document.querySelector("provenance-approve").addEventListener("pv:approved", (e) => console.log(e.detail));
</script>
```

Each widget mints with its own `widget` value and object:

| Element | `widget` | `object_id` | What it does |
| --- | --- | --- | --- |
| `<provenance-approve>` | `approve` | An approval ID | Shows a [step-up approval](https://provenanceauth.com/docs/mandate/guides/step-up-approval.md) with the full action description and takes the decision, with a passkey when required. `mode: "consent"` relabels it Consent and Decline. A request routed to an [approver](https://provenanceauth.com/docs/mandate/guides/approver-network.md#show-the-approval-in-your-product) is decided with the approver's own passkey. |
| `<provenance-badge>`, `<provenance-receipt>` | None for public proofs; `receipt` for an account-held receipt | A decision ID | Verify an intent token or receipt in the browser and show the result; see [verify tokens offline](https://provenanceauth.com/docs/authorize/guides/verify-tokens.md) |
| `<provenance-capture>` | `capture` | A case ID, or a capture request ID (`capr_…`) | Takes and attests a photo for the case, or runs a [capture request](https://provenanceauth.com/docs/attest/guides/capture-requests.md)'s steps with the `capture-request` attribute (with the [capture release](https://provenanceauth.com/docs/attest/guides/capture-release.md) on, its sheet opens inside the component before the camera; under **Provenance asks**, the [opt-in step to texts](https://provenanceauth.com/docs/messaging/text-consent.md#2-under-provenance-asks-the-step-before-the-request) is its first screen). Browser capture is the `software` hardware tier; hardware-backed capture needs the [native SDK](https://provenanceauth.com/docs/attest/guides/native-sdk.md). The photo lands with the carrier your server minted under (a capture request's own carrier, else the one your key's requests land with), so it shows in that carrier's claims. |
| `<provenance-sign>` | `sign` | `<agreement_id>:<party_id>` | One party's signature on a [two-sided agreement](https://provenanceauth.com/docs/mandate/guides/agreements.md), with a "verify your copy" hash check in the browser |
| `<provenance-enroll>` | `enroll` | An approver link ID | Enrolls your user in the [approver network](https://provenanceauth.com/docs/mandate/guides/approver-network.md) with their own passkey, with a one-tap block |
| `<provenance-grant>` | `mandate` | A grant draft (`gdr_…`), or a grant with `mode: "checkin"` | Lets a person allow an agent's [grant](https://provenanceauth.com/docs/mandate/concepts/grants.md#allow-it-in-your-product) with their passkey, or check in on one; see [section 8](#8-agents-and-appeals-in-your-product) |
| `<provenance-agent-access>` | `agent_access` | None: pass `subject: { device_id }` | The agents a person has allowed on your account, with a Turn off button for each, Turn off all, and an Activity tab |
| `<provenance-approvals>` | `approvals` | None: pass `subject: { approver_link_id }` | One outside approver's waiting requests from your company, with Approve selected; see [section 9](#9-an-approvers-inbox-in-your-product) |
| `<provenance-appeal>` | `appeal` | A claim ID (minted with a `verify` key) | The claim decision's plain-language explanation and the [appeal](https://provenanceauth.com/docs/attest/guides/cases-and-appeals.md#appeals-in-your-portal) form |
| `<provenance-trace>` | None: pass `share-id` and `share-token` | A trace share | Shows a [shared trace](https://provenanceauth.com/docs/trace/concepts/attribution-traces.md) and verifies its manifest in the browser |
| `<provenance-capture-result>` | `capture_result` | A capture request ID (`capr_…`) | One request's result for your staff, in your own admin tool: the session's hardware grade, the photos, screening and checks, with a slot for your own next step and `getToken()` to keep the session alive. See [capture result in your admin](https://provenanceauth.com/docs/embeds/capture-result.md) |
| `<provenance-capture-request>` | `capture_request` | Your case reference, with `author` and the session's `request` options | Your staff send a capture request by email, text or QR within the options your server fixed, and see whether it went out. See [capture request composer](https://provenanceauth.com/docs/embeds/capture-request.md) |
| `<provenance-checkout-result>` | `checkout_result` | A checkout assessment ID (`cas_…`) or cart approval ID (`coap_…`) | One agent checkout for your staff, in your own admin tool: what Identify saw, the assessment, the cart approval and how the shopper answered, with a slot for your own next step. Never a token or the approver's IP. See [checkout result in your admin](https://provenanceauth.com/docs/embeds/checkout-result.md) |
| `<provenance-run-result>` | `run_result` | A run ID (`run_…`) | One agent run for your staff, in your own admin tool: its state, the team's spend against the budget, each agent's chain and the agents' newest actions, with a slot for your own next step. See [run result in your admin](https://provenanceauth.com/docs/embeds/run-result.md) |
| `<provenance-counter-offers>` | `"counter_offers"` | A run ID (`run_…`) | One run's proposals from outside agents and how each was answered, read only, on your own pages: the agent, the offer and its price, whether it was signed, and the answer. See [proposals in your pages](https://provenanceauth.com/docs/embeds/counter-offers.md) |
| `<provenance-capture-list>` | `capture_list` | None: optional `filters` pinned for the session | Your capture requests for your staff, in your own admin tool: one line each, with tabs, filters, a sort and paging; a selected row opens in the list's own panel. See [capture list in your admin](https://provenanceauth.com/docs/embeds/capture-list.md) |
| `<provenance-checkout-list>` | `checkout_list` | None: optional `filters` pinned for the session | Your store's agent checkouts for your staff, in your own admin tool: one line each, with tabs, filters, an order search, a sort and paging; a selected row opens in the list's own panel. See [checkout list in your admin](https://provenanceauth.com/docs/embeds/checkout-list.md) |
| `<provenance-chargeback-protection>` | `chargeback_protection` | None: scoped to your account | Your store's Chargeback protection view for your staff, read only: protection used, the three facts and the Protected, Disputed and Not protected tabs. See [Chargeback protection in your admin](https://provenanceauth.com/docs/embeds/chargeback-protection.md) |
| `<provenance-run-list>` | `run_list` | None: optional `filters` pinned for the session | Your agent runs for your staff, in your own admin tool: one line each, with tabs, filters, a name or ID search, a sort and paging; a selected row opens in the list's own panel. See [run list in your admin](https://provenanceauth.com/docs/embeds/run-list.md) |
| `<provenance-traffic-list>` | `traffic_list` | None: optional `filters` pinned for the session | The visits Identify's hosted check assessed, for your staff, in your own admin tool: one line each (the outcome, agent or person, signed or not, the bot likelihood), with tabs, filters, a sort and paging; a selected row opens in the list's own panel. See [traffic list in your admin](https://provenanceauth.com/docs/embeds/traffic-list.md) |
| `<provenance-traffic-result>` | `traffic_result` | A traffic assessment ID (`tas_…`) | One assessed visit for your staff, in your own admin tool: the outcome, who visited, the bot likelihood with its named signals and the rule that decided, with a slot for your own next step. See [traffic result in your admin](https://provenanceauth.com/docs/embeds/traffic-result.md) |
| `<provenance-rules>` | `rules` | The kind of rules: `checkout`, `intent` or `capture` | Your rules for your staff, in your own admin tool: the rules your server lists, one line each, with blanks and bounds, locks and the outcome in the console's words. An edit session saves changes within the scope as a draft, and an Advanced session edits whole rules. Scoped on every mint. See [rules in your admin](https://provenanceauth.com/docs/embeds/rules.md) |
| `<provenance-text-consent>` | `text_consent` | Your `box_id` (`tcf_…`) from `GET /v1/account/text_consent` | The consent box for your own form: one unticked checkbox, Provenance's wording and the mark; ticking it records consent to your texts. See [put the consent box on your own form](https://provenanceauth.com/docs/messaging/text-consent.md#8-put-the-consent-box-on-your-own-form) |

The capture result, checkout result, run result, request composer and rules also open on a page Provenance hosts, by a link your server mints, for a phone or an email. See [hosted page for results](https://provenanceauth.com/docs/embeds/hosted-page.md), [the hosted rules page](https://provenanceauth.com/docs/embeds/rules.md#on-a-phone-the-hosted-rules-page), and [admin results and requests](https://provenanceauth.com/docs/embeds/admin-tools.md) for the four ways side by side.

The badge, receipt and trace views verify against the published keys from any site, with no key. They're green only when every check passed: a badge whose revocation check couldn't run says "revocation unchecked", and a trace whose keys couldn't load shows amber.

## 4. Allow your sites

List the sites a publishable key may run on with [`PATCH /v1/embed/publishable_keys/{id}`](https://provenanceauth.com/docs/api/embeds.md#patch-v1-embed-publishable-keys-id): up to 10 origins, each `https://host[:port]` with no path. Sandbox keys may also list `http://localhost:3000`, or `http://localhost:*` for any local port.

**curl**

```bash
curl -s -X PATCH $PROVENANCE_API/v1/embed/publishable_keys/$(jq -r .id publishable-key.json) \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "allowed_origins": ["https://portal.example.com", "http://localhost:*"] }'
```

**Node**

```ts
await fetch(`${process.env.PROVENANCE_API}/v1/embed/publishable_keys/${keyId}`, {
  method: "PATCH",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ allowed_origins: ["https://portal.example.com", "http://localhost:*"] }),
});
```

**Python**

```python
httpx.patch(
    f"{api}/v1/embed/publishable_keys/{key_id}",
    json={"allowed_origins": ["https://portal.example.com", "http://localhost:*"]},
    headers=headers,
)
```

```json
{
  "id": "01M5Q9JQPY95XBQTTP3TBQE4TM",
  "object": "publishable_key",
  "key_prefix": "prv_pub_1D10TzJo",
  "name": "customer-portal",
  "environment": "sandbox",
  "allowed_origins": ["https://portal.example.com", "http://localhost:*"],
  "created_at": "2026-10-24T15:48:45.254Z",
  "revoked_at": null
}
```

Once a key has a list:

- every embed request from another site gets `403` [`embed_origin_not_allowed`](https://provenanceauth.com/docs/platform/errors.md#embed_origin_not_allowed), and the component says the site isn't allowed;
- only those sites can frame the passkey page for the key.

A key without a list works on any site, and the console shows it as "Any site". Pass `"allowed_origins": null` to remove a list. You can also manage the list in the console under **Developers → API keys → Publishable**.

## 5. Passkeys on your site

Four components confirm with a passkey: approve, order review, sign and enroll. A passkey belongs to the domain it was made on, so these steps run in a small frame served from Provenance's own domain: the same passkey then works in every component, on every site, and on Provenance's hosted pages.

- **Confirming** (approve, order review, sign) runs in the frame when the person taps your component's button.
- **Creating a passkey** (enroll) needs a tap inside the frame, so the component's main button is the frame.
- **When the frame can't load**, for example because your page's Content Security Policy blocks it, the component opens the same page in a small window on the person's tap and finishes there.
- **On a device with no passkey support**, the component says so and, where a hosted link exists, offers it. It never shows a success it didn't get.

If your site sends a Content Security Policy, allow the frame and the API:

```text
frame-src https://app.provenanceauth.com;
connect-src https://sandbox-api.provenanceauth.com;
```

## 6. Theme and appearance

Components follow your page's theme by default (`theme="inherit"`). They use the first of these that's set:

1. A `data-theme` of light or dark on the page's root element.
2. The page's `color-scheme`.
3. The operating system.

They switch in place when your page switches. To fix the theme, set `theme` to light or dark, or to auto to follow the operating system.

Your look stacks in this order, each layer over the one before:

1. Provenance's defaults for the theme.
2. Your account's branding (Settings → Branding): the primary colour styles the buttons, and the name and logo head the component. Set `branding="off"` to leave it out.
3. CSS custom properties on the element.
4. The `appearance` property, from JavaScript or React.

```css
provenance-approve {
  --pv-accent: #1d4ed8;
  --pv-radius: 10px;
}
```

```js
document.querySelector("provenance-approve").appearance = {
  theme: "inherit",
  variables: { accent: "#1d4ed8", card: "#fafaf9" },
  density: 0.9,
  radius: "8px",
};
```

| Property | `appearance.variables` | Sets |
| --- | --- | --- |
| `--pv-accent` | `accent` | Buttons and links |
| `--pv-accent-fg` | `accentFg` | Text on buttons (picked for you when you only set the accent) |
| `--pv-bg` | `bg` | Inner panels and inputs |
| `--pv-card` | `card` | The component's surface |
| `--pv-border` | `border` | Borders and dividers |
| `--pv-fg`, `--pv-muted` | `fg`, `muted` | Text colors |
| `--pv-danger` | `danger` | The Deny and Decline buttons |
| `--pv-font`, `--pv-font-mono` | `font`, `fontMono` | Font families |
| `--pv-radius` | `radius` | Corner radius |
| `--pv-space` | `density` | Spacing, from 0.85 to 1.25 |

Every color pair is checked against a contrast floor before it renders:

| Pair | Floor |
| --- | --- |
| Button text on the accent | 4.5:1 |
| Text on the card | 7:1 |
| Muted text on the card | 4.5:1 |
| Accent on the card | 3:1 |
| Deny and Decline text on the card | 4.5:1 |
| Verdict colors on the card | 4.5:1 |

A value under its floor is replaced by the theme's default, and the component logs one console warning with the variable and the measured ratio, so a component never renders unreadable. After changing a property from script, call `el.refreshAppearance()`.

Style the component's parts with `::part()`:

| Part | Element |
| --- | --- |
| `card` | The component's outer box |
| `header` | Your brand name and logo, when branding is set |
| `title` | The heading |
| `body` | The content area |
| `button-primary`, `button-secondary` | Buttons |
| `input` | Text inputs |
| `status` | The progress and error line |

The Provenance mark, verdict and risk colors, DRAFT consent markers, the action and amount block, and the wording of decision buttons have no part and ignore every override, so a verdict always looks like one and the person always sees what they're approving.

Consent wording that's still under legal review comes from the API with `consent.draft: true` and a DRAFT marker. The components show the person the plain consent summary only and still send the consent version with their answer. To see the marker on a review page, add the `show-draft-legal` attribute to the element (`showDraftLegal` in React).

In React, `@provenance/embed/react` has a typed component for each element, such as `ProvenanceApprove`. Each takes an appearance, a class name, a style and an event map typed to that component's events.

## 7. Confirm outcomes on your server

Widgets fire `pv:*` events, such as `pv:ready` when they load and `pv:approved` when a person approves, so your page can react. Each widget's events are in the package README. They come from the browser, so don't act on them alone: confirm with a [webhook](https://provenanceauth.com/docs/integrate/webhooks.md) or by reading the object from your backend.

## 8. Agents and appeals in your product

Four components let a person act on standing authority and decisions without leaving your product. Each takes the branding of the company that shows it: your logo, name, primary button colour and corners. The limits, the spend meter, verdict colours, explanation text, the Turn off button and the Provenance footer never change.

**Allow a grant.** Create a draft for the person's device with the limits you want. It lasts up to 15 minutes and creates nothing until the person allows it:

**curl**

```bash
curl -s -X POST $PROVENANCE_API/v1/mandate/grant_drafts \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "device_id": "dev_00000000000000000000000000000001", "agent": { "name": "Cartwise", "description": "Cartwise Labs · your shopping assistant" }, "constraints": { "max_amount": 50, "budget_amount": 200, "budget_window": "month", "allowed_counterparties": ["quillstack.example"], "heartbeat": { "interval": "monthly" }, "expires_at": "2027-12-31T23:59:59Z" } }'
```

**Node**

```ts
const draft = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grant_drafts`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    device_id: "dev_00000000000000000000000000000001",
    agent: { name: "Cartwise", description: "Cartwise Labs · your shopping assistant" },
    constraints: { max_amount: 50, budget_amount: 200, budget_window: "month", allowed_counterparties: ["quillstack.example"], heartbeat: { interval: "monthly" }, expires_at: "2027-12-31T23:59:59Z" },
  }),
})).json();
```

**Python**

```python
draft = httpx.post(
    f"{api}/v1/mandate/grant_drafts",
    headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"},
    json={
        "device_id": "dev_00000000000000000000000000000001",
        "agent": {"name": "Cartwise", "description": "Cartwise Labs · your shopping assistant"},
        "constraints": {"max_amount": 50, "budget_amount": 200, "budget_window": "month", "allowed_counterparties": ["quillstack.example"], "heartbeat": {"interval": "monthly"}, "expires_at": "2027-12-31T23:59:59Z"},
    },
).json()
```

Mint a `mandate` token for the draft's `id` and render `<provenance-grant>`. The person sees each limit in plain words ("Only at quillstack.example", "Check in every month") and taps **Allow**, which their passkey signs, or **Not now**. Allow creates exactly the grant [`POST /v1/mandate/grants`](https://provenanceauth.com/docs/api/grants.md#post-v1-mandate-grants) would, with `biometric_verified: true`. On `pv:granted`, read the draft from your backend with [`GET /v1/mandate/grant_drafts/{id}`](https://provenanceauth.com/docs/api/grants.md#get-v1-mandate-grant-drafts-id): once allowed it carries `grant_id` and the `mandate_token` for your agent.

**Check in.** For a grant with a check-in (`constraints.heartbeat`), mint a `mandate` token with the grant's ID and `mode: "checkin"`, and render `<provenance-grant mode="checkin">`. It shows what the agent spent this window and its limits. **Keep it on** is the person's passkey over this period's check-in; **Turn it off** revokes the grant after a "Turn off Cartwise?" confirm, with no passkey, since it only reduces what the agent can do. Events: `pv:checked_in`, `pv:revoked`.

**Show a person's agents.** On a settings page, mint an `agent_access` token for the signed-in person's device:

```html
<!-- your backend: POST /v1/embed/tokens { "widget": "agent_access", "subject": { "device_id": "…" } } -->
<provenance-agent-access base-url="…" publishable-key="prv_pub_…" embed-token="emb_…"></provenance-agent-access>
<provenance-agent-access mode="summary" base-url="…" publishable-key="prv_pub_…" embed-token="emb_…"></provenance-agent-access>
```

The list shows that person's agents on your account only: their limits, spend this window, last use and next check-in, and a Turn off button for each (`pv:revoked { grant_id }`). Agents turned off or expired in the last 30 days are kept under a collapsed "Turned off and expired".

With two or more agents on, **Turn off all agents** asks once ("Turn off 3 agents? They'll need your approval for everything until you turn them on again.") and then revokes every one of them, with no passkey since it only reduces what agents can do. It fires `pv:revoked_all { count }`. Each grant turned off in the component, one at a time or all at once, sends you a `mandate.grant.revoked` [webhook](https://provenanceauth.com/docs/integrate/webhooks.md) with `revoked_by: "person"`, so your backend stops relying on it.

The **Activity** tab lists the last 90 days, 20 at a time: each action your agents took under this person's grants (allowed or blocked) and each approval the person decided, with the agent, the action, the amount, the outcome and the time. **Receipt** opens the row's signed receipt in `<provenance-receipt>`, which checks the signature in the browser. Only this person's rows are listed.

`mode="summary"` renders just the count and the next check-in, for a settings row. The token's `object_id` is a pairwise value; the device ID never reaches the browser. An agent another company made shows its avatar; your own agent doesn't need one.

**Take an appeal.** Mint an `appeal` token for one of your carrier's claims with your `verify` key and render `<provenance-appeal>`. It shows the decision's plain-language explanation from the fixed templates, then a reason (up to 2,000 characters) and up to 3 photos or PDFs. The appeal lands in the same queue as the hosted link (`pv:appealed { appeal_id }`). Appeals are free on every plan; see [cases and appeals](https://provenanceauth.com/docs/attest/guides/cases-and-appeals.md#appeals-in-your-portal).

When a device has no passkey support, the components say "This device can't confirm with a passkey" instead of offering a button that can't work.

## 9. An approver's inbox in your product

People outside your company who approve for you, such as a client's finance lead on an [approver link](https://provenanceauth.com/docs/mandate/guides/approver-network.md), can decide your requests inside your own app instead of opening each link. Mint an `approvals` token with one of your accepted approver links:

**curl**

```bash
curl -s -X POST $PROVENANCE_API/v1/embed/tokens \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "widget": "approvals", "subject": { "approver_link_id": "lnk_01M6W1R5Q7B9C3D5E7F9G1H3J5" } }'
```

**Node**

```ts
const { embed_token } = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/tokens`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ widget: "approvals", subject: { approver_link_id: "lnk_01M6W1R5Q7B9C3D5E7F9G1H3J5" } }),
})).json();
```

**Python**

```python
token = httpx.post(
    f"{api}/v1/embed/tokens",
    headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"},
    json={"widget": "approvals", "subject": {"approver_link_id": "lnk_01M6W1R5Q7B9C3D5E7F9G1H3J5"}},
).json()
```

```html
<provenance-approvals base-url="…" publishable-key="prv_pub_…" embed-token="emb_…"></provenance-approvals>
```

Mint it only for the approver who's signed in to your app. The link must be accepted (an invited link has no approver yet), and the token lasts up to 15 minutes. Its `object_id` is a pairwise value; the approver's ID never reaches the browser.

- **The list.** The requests you routed to this approver that wait for them, newest first, with the same facts as the approval page: the exact action, the amount, the agent, a store's order, what a revised request changed, and on a [group request](https://provenanceauth.com/docs/mandate/guides/approver-network.md) "1 of 2 approved" with the names of those who decided. Requests from other companies and other approvers never show.
- **Review.** One request: **Approve** with the approver's own passkey, **Reject** with a reason, or **Ask for a change** (a single request only; on a group request each approver approves or rejects).
- **Approve selected.** Tick up to 25 and approve them with one passkey prompt; see [batch approvals](https://provenanceauth.com/docs/mandate/guides/batch-approvals.md). A request that can't go in a batch has no box and says "Review on its own" with the reason.

Only the approver's passkey can approve, never your devices or your API key, and the decision is recorded as theirs. The component needs Pro or the Free trial. It fires:

| Event | When | Detail |
| --- | --- | --- |
| `pv:approved`, `pv:denied`, `pv:changes_requested` | The approver decided one request | `approval_id` |
| `pv:batch_approved` | Approve selected finished | `batch_id`, `count`, `approval_ids` |

Confirm each decision on your server from the [webhook](https://provenanceauth.com/docs/integrate/webhooks.md), never from the event alone.

### Checkout approval

`<provenance-checkout-approval>` is the approval screen a browser agent can read, for your checkout page while an order waits for the shopper. It needs no key: pass the request token from the approve link. Under **Provenance asks**, the [opt-in step to texts](https://provenanceauth.com/docs/messaging/text-consent.md#2-under-provenance-asks-the-step-before-the-request) comes first when the approval carries a phone with no consent. The Identify middleware's HTML answer is this component on a minimal page ([five-minute checkout](https://provenanceauth.com/docs/authorize/guides/five-minute-checkout.md)).

- As plain text, it shows your store's name, the cart and its total, and the status.
- It shows the approve link with a QR code on a desktop and the link alone on a phone, or "We've sent the approval to the phone ending 42" when you sent it to your customer. `qr="on"` or `qr="off"` forces the QR code either way.
- It waits on the approval and fires the outcome, so your page moves on without a reload.

```html
<provenance-checkout-approval approval="Hq2vN8xK4tB7mW3sYd9cFj" base-url="https://api.provenanceauth.com"></provenance-checkout-approval>
```

In React: `<ProvenanceCheckoutApproval baseUrl="…" approval="…" onEvent={{ "pv:approved": () => router.refresh() }} />` from `@provenance/embed/react`. Confirm the order on your server from the webhook, never from the event alone.

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| `401` [`embed_token_invalid`](https://provenanceauth.com/docs/platform/errors.md#embed_token_invalid), "Missing or malformed publishable key" | The page didn't send the publishable key | Set the `publishable-key` attribute. |
| `401` [`embed_token_invalid`](https://provenanceauth.com/docs/platform/errors.md#embed_token_invalid) on render | The token expired, or was minted for another widget or object | Mint a fresh token for this widget and object. |
| `400` [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid) on `ttl` | Longer than 15 minutes | Use 900 seconds or less. |
| `403` [`embed_origin_not_allowed`](https://provenanceauth.com/docs/platform/errors.md#embed_origin_not_allowed) | The key lists its allowed origins and this site isn't one | Add the site with `PATCH /v1/embed/publishable_keys/{id}`. |
| "Allow pop-ups for this site" on a passkey step | The frame couldn't load and the browser blocked the passkey window | Allow the frame in your Content Security Policy (`frame-src`), or let the site open pop-ups. |
| `402` [`trial_ended`](https://provenanceauth.com/docs/platform/errors.md#trial_ended) minting `capture`, `capture_result`, `capture_request`, `sign`, `order`, `mandate`, `agent_access` or `approvals` | The Free trial ended | Choose a plan in **Settings → Plan & usage**; see [plans and usage](https://provenanceauth.com/docs/account/plans-and-usage.md#free-trial). |
| `400` [`embed_object_kind_mismatch`](https://provenanceauth.com/docs/platform/errors.md#embed_object_kind_mismatch) | A result widget was given another kind of ID, such as an assessment for `capture_result` | Mint the widget that matches the object. |
| `400` [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid) on `subject.approver_link_id` | The approver hasn't accepted the link yet, or it was revoked | Mint once the link's `status` is `active`. |
| `409` [`batch_not_allowed`](https://provenanceauth.com/docs/platform/errors.md#batch_not_allowed) on Approve selected | A ticked request can't be batched (over `batch_max_amount`, options, a first-time payee, a rule's `individual`) | Approve it on its own. |
| `409` [`grant_draft_closed`](https://provenanceauth.com/docs/platform/errors.md#grant_draft_closed) on Allow | The draft was already allowed or declined, or its 15 minutes ran out | Create a new draft and mint a new token. |

## See also

Shared across products:

- [Admin results and requests](https://provenanceauth.com/docs/embeds/admin-tools.md)
- [Hosted page for results](https://provenanceauth.com/docs/embeds/hosted-page.md)
- [Rules in your admin](https://provenanceauth.com/docs/embeds/rules.md)

Each product's widgets for your own admin tool:

| Product | Widgets |
| --- | --- |
| Identify | [Traffic list](https://provenanceauth.com/docs/embeds/traffic-list.md), [traffic result](https://provenanceauth.com/docs/embeds/traffic-result.md) |
| Authorize | [Checkout list](https://provenanceauth.com/docs/embeds/checkout-list.md), [checkout result](https://provenanceauth.com/docs/embeds/checkout-result.md), [Chargeback protection](https://provenanceauth.com/docs/embeds/chargeback-protection.md) |
| Attest | [Capture list](https://provenanceauth.com/docs/embeds/capture-list.md), [capture result](https://provenanceauth.com/docs/embeds/capture-result.md), [capture request composer](https://provenanceauth.com/docs/embeds/capture-request.md) |
| Mandate | [Run list](https://provenanceauth.com/docs/embeds/run-list.md), [run result](https://provenanceauth.com/docs/embeds/run-result.md), [proposals](https://provenanceauth.com/docs/embeds/counter-offers.md) |

Elsewhere in the docs:

- [Verify a proof](https://provenanceauth.com/docs/integrate/verify-a-proof.md)
- [Webhooks](https://provenanceauth.com/docs/integrate/webhooks.md)
- [Step-up approval](https://provenanceauth.com/docs/mandate/guides/step-up-approval.md)
