View as Markdown

Embeds · Guide

Embed Provenance

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.

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

Three credentials are involved:

CredentialWhere it livesWhat it can do
Secret API key, prv_test_… or prv_live_…Your backend onlyEverything your account can do, including minting embed tokens
Publishable key, prv_pub_…Your web pagesIdentifies your account to the embed endpoints, and reads no data
Embed token, emb_…One page viewLets 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. It's safe to ship in your page's HTML:

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)
{
  "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. 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:

WidgetsThe key needsCreate it as
capture, capture_result, capture_request, appealattestan Attest key
approve, approvals, heartbeat, grant, agent_access, enroll, sign, receipt, verify, badgeauthorize or mandatean Authorize or Mandate key
checkout_resultauthorizean Authorize key
run_resultmandatea Mandate key
traffic_list, traffic_resultidentifyan Identify key
embed, text_consentany account keyany secret key

A key without the scope gets 403 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).

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

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)
{
  "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 $PROVENANCE_API/v1/embed/session \
  -H "Authorization: Bearer $EMBED_TOKEN" \
  -H "X-Provenance-Publishable-Key: $PUBLISHABLE_KEY"
{
  "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.

<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:

Elementwidgetobject_idWhat it does
<provenance-approve>approveAn approval IDShows a step-up approval 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 is decided with the approver's own passkey.
<provenance-badge>, <provenance-receipt>None for public proofs; receipt for an account-held receiptA decision IDVerify an intent token or receipt in the browser and show the result; see verify tokens offline
<provenance-capture>captureA case ID, or a capture request ID (capr_…)Takes and attests a photo for the case, or runs a capture request's steps with the capture-request attribute (with the capture release on, its sheet opens inside the component before the camera; under Provenance asks, the opt-in step to texts is its first screen). Browser capture is the software hardware tier; hardware-backed capture needs the native SDK. 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, with a "verify your copy" hash check in the browser
<provenance-enroll>enrollAn approver link IDEnrolls your user in the approver network with their own passkey, with a one-tap block
<provenance-grant>mandateA grant draft (gdr_…), or a grant with mode: "checkin"Lets a person allow an agent's grant with their passkey, or check in on one; see section 8
<provenance-agent-access>agent_accessNone: 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>approvalsNone: pass subject: { approver_link_id }One outside approver's waiting requests from your company, with Approve selected; see section 9
<provenance-appeal>appealA claim ID (minted with a verify key)The claim decision's plain-language explanation and the appeal form
<provenance-trace>None: pass share-id and share-tokenA trace shareShows a shared trace and verifies its manifest in the browser
<provenance-capture-result>capture_resultA 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
<provenance-capture-request>capture_requestYour case reference, with author and the session's request optionsYour 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
<provenance-checkout-result>checkout_resultA 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
<provenance-run-result>run_resultA 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
<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
<provenance-capture-list>capture_listNone: optional filters pinned for the sessionYour 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
<provenance-checkout-list>checkout_listNone: optional filters pinned for the sessionYour 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
<provenance-chargeback-protection>chargeback_protectionNone: scoped to your accountYour 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
<provenance-run-list>run_listNone: optional filters pinned for the sessionYour 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
<provenance-traffic-list>traffic_listNone: optional filters pinned for the sessionThe 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
<provenance-traffic-result>traffic_resultA 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
<provenance-rules>rulesThe kind of rules: checkout, intent or captureYour 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
<provenance-text-consent>text_consentYour box_id (tcf_…) from GET /v1/account/text_consentThe 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

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, the hosted rules page, and admin results and requests 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}: 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 -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:*"] }'
{
  "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, 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:

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.
provenance-approve {
  --pv-accent: #1d4ed8;
  --pv-radius: 10px;
}
document.querySelector("provenance-approve").appearance = {
  theme: "inherit",
  variables: { accent: "#1d4ed8", card: "#fafaf9" },
  density: 0.9,
  radius: "8px",
};
Propertyappearance.variablesSets
--pv-accentaccentButtons and links
--pv-accent-fgaccentFgText on buttons (picked for you when you only set the accent)
--pv-bgbgInner panels and inputs
--pv-cardcardThe component's surface
--pv-borderborderBorders and dividers
--pv-fg, --pv-mutedfg, mutedText colors
--pv-dangerdangerThe Deny and Decline buttons
--pv-font, --pv-font-monofont, fontMonoFont families
--pv-radiusradiusCorner radius
--pv-spacedensitySpacing, from 0.85 to 1.25

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

PairFloor
Button text on the accent4.5:1
Text on the card7:1
Muted text on the card4.5:1
Accent on the card3:1
Deny and Decline text on the card4.5:1
Verdict colors on the card4.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():

PartElement
cardThe component's outer box
headerYour brand name and logo, when branding is set
titleThe heading
bodyThe content area
button-primary, button-secondaryButtons
inputText inputs
statusThe 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 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 -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" } }'

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 would, with biometric_verified: true. On pv:granted, read the draft from your backend with 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:

<!-- 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 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.

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, 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 -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" } }'
<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 "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. 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:

EventWhenDetail
pv:approved, pv:denied, pv:changes_requestedThe approver decided one requestapproval_id
pv:batch_approvedApprove selected finishedbatch_id, count, approval_ids

Confirm each decision on your server from the webhook, 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 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).

  • 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.
<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

SymptomCauseFix
401 embed_token_invalid, "Missing or malformed publishable key"The page didn't send the publishable keySet the publishable-key attribute.
401 embed_token_invalid on renderThe token expired, or was minted for another widget or objectMint a fresh token for this widget and object.
400 parameter_invalid on ttlLonger than 15 minutesUse 900 seconds or less.
403 embed_origin_not_allowedThe key lists its allowed origins and this site isn't oneAdd the site with PATCH /v1/embed/publishable_keys/{id}.
"Allow pop-ups for this site" on a passkey stepThe frame couldn't load and the browser blocked the passkey windowAllow the frame in your Content Security Policy (frame-src), or let the site open pop-ups.
402 trial_ended minting capture, capture_result, capture_request, sign, order, mandate, agent_access or approvalsThe Free trial endedChoose a plan in Settings → Plan & usage; see plans and usage.
400 embed_object_kind_mismatchA result widget was given another kind of ID, such as an assessment for capture_resultMint the widget that matches the object.
400 parameter_invalid on subject.approver_link_idThe approver hasn't accepted the link yet, or it was revokedMint once the link's status is active.
409 batch_not_allowed on Approve selectedA 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 on AllowThe draft was already allowed or declined, or its 15 minutes ran outCreate a new draft and mint a new token.

See also

Shared across products:

Each product's widgets for your own admin tool:

Elsewhere in the docs: