Embeds · Guide
Show results, send requests
Your staff can see what a capture request or an agent checkout came back with, and send a new capture request, without leaving the tools they work in. Each view comes four ways: an element in your web admin, a page Provenance hosts, the console, or your own screens on the API. This guide puts them side by side and shows the server call behind each one, with the SDKs.
Before you begin: a secret key with the view's scope: attest for a capture result or the request composer, authorize for a checkout result. The embed and the hosted page need Pro or the Free trial; the console has the same views on every plan.
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x
1. Pick a way for each screen
| Embed | Hosted page | The console | Your own UI on the API | |
|---|---|---|---|---|
| Where | Your web admin | A phone, an email to a manager, a reviewer without an admin seat | Every account's own pages | Anywhere |
| Plan | Pro, or the Free trial | Pro, or the Free trial | Every plan | Each API's own plan |
| Your server calls | embed. | embed. | Nothing | The reads in step 5 |
| Your page does | Drops a tag and gives it getToken() | Opens a URL | Nothing | Draws the rows, checks the signed result, fetches file links |
The views are the same on every surface: one line per row, a dot and a word for status, and the same outcome words.
| View | Element | Object | Scope |
|---|---|---|---|
| Capture result | <provenance-capture-result> | A capture request (capr_) | attest |
| Request composer | <provenance-capture-request> | Your case reference | attest |
| Checkout result | <provenance-checkout-result> | A checkout assessment (cas_) or cart approval (coap_) | authorize |
| Run result | <provenance-run-result> | An agent run (run_) | mandate |
| Proposals | <provenance-counter-offers> | An agent run's proposals from outside agents (run_), read only | mandate |
| Capture list | <provenance-capture-list> | Your capture requests, filtered | attest |
| Checkout list | <provenance-checkout-list> | Your store's checkouts, filtered | authorize |
| Chargeback protection | <provenance-chargeback-protection> | Your store's Chargeback protection view, read only | authorize |
| Run list | <provenance-run-list> | Your agent runs, filtered | mandate |
| Traffic list | <provenance-traffic-list> | The visits Identify assessed, filtered | identify |
| Traffic result | <provenance-traffic-result> | A traffic assessment (tas_) | identify |
2. Install the SDK on your server
The mint calls run on your server, with your secret key. It never reaches the browser.
This package isn't on npm yet. This package isn't on PyPI yet. Until then, every request in these docs runs over HTTP against the sandbox.
With access to the private Provenance repository, which your Provenance contact grants, install from it:
git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-sdk-1.0.0.tgzgit clone https://github.com/michaelnbane-jpg/provenance.git provenance
pip install ./provenance/python/sdkFor Go, the embed calls are in go.provenanceauth.com/verify (Embed.CreateToken and Embed.CreateLink), with only the standard library.
3. Mint a session for an embed
POST / mints a session of up to 15 minutes for one element and one object. This capture request is the one the next steps show:
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" }' > request.json
export CAPTURE_REQUEST_ID=$(jq -r '.id' request.json)
curl -s -X POST $PROVENANCE_API/v1/embed/tokens \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{ \"widget\": \"capture_result\", \"object_id\": \"$CAPTURE_REQUEST_ID\", \"show\": [\"case_id\"] }"
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
// GET /admin/provenance/session?request=capr_… (your route, behind your staff sign-in)
const session = await prov.embed.createToken({ widget: "capture_result", objectId: requestId, show: ["case_id"] });
res.json({ token: session.embedToken });
from provenanceauth import Provenance
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
session = prov.embed.create_token(widget="capture_result", object_id=request_id, show=["case_id"])
token = session["embed_token"]
import pv "go.provenanceauth.com/verify"
embed := &pv.Embed{APIBase: os.Getenv("PROVENANCE_API"), SecretKey: os.Getenv("PROVENANCE_KEY")}
session, err := embed.CreateToken(ctx, pv.EmbedTokenParams{Widget: pv.WidgetCaptureResult, ObjectID: requestID, Show: []string{"case_id"}})
{
"object": "embed_token",
"embed_token": "emb_…",
"widget": "capture_result",
"mode": "view",
"show": ["case_id"],
"expires_at": "2026-11-16T20:15:00.000Z"
}
Each widget's body is typed in the SDKs, so a composer session without its author or options doesn't compile in TypeScript:
| Widget | objectId | Also takes |
|---|---|---|
capture_ | A capture request (capr_) | show: case_, metadata |
checkout_ | A checkout assessment (cas_) or cart approval (coap_) | Nothing else |
run_ | An agent run (run_) | Nothing else |
traffic_ | A traffic assessment (tas_) | Nothing else |
capture_ | Your case reference (1 to 200 characters) | author and request, both required (the composer) |
In the Node SDK a composer session's options are camelCase, as everywhere else in it (maxSends for max_sends), and reach the API in its own shape.
4. Give the element its session
Drop the element in your admin page and give it a getToken() that calls your route. It calls it on load, and again a minute before each session ends, so a page left open keeps working:
npm install @provenance/embed
<provenance-capture-result base-url="https://sandbox-api.provenanceauth.com" publishable-key="prv_pub_…">
<div slot="actions"><!-- your own next step --></div>
</provenance-capture-result>
<script type="module">
import "@provenance/embed";
const el = document.querySelector("provenance-capture-result");
el.getToken = async () => (await (await fetch(`/admin/provenance/session?request=${requestId}`)).json()).token;
</script>
The actions slot holds your own next step: your card, your labels, your handlers. Decide what it suggests from the element's pv:result event, and confirm on your server from the webhook. Each element's page has the full recipe: capture result, request composer, checkout result, run result, traffic result. A list opens a selected row in its own panel, or, with detail="none", drives a result element whose for is the list's id (capture list, checkout list, run list, traffic list).
5. Mint a link for the hosted page
When there's no web admin to drop a tag into, mint a link instead. POST / takes the same body, plus session_ttl, and returns a URL that opens once:
curl -s -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\", \"session_ttl\": 600 }"
const link = await prov.embed.createLink({ widget: "capture_result", objectId: requestId, sessionTtl: 600 });
// link.url opens once within 15 minutes; the page then works for link.sessionTtl seconds.
link = prov.embed.create_link(widget="capture_result", object_id=request_id, session_ttl=600)
link, err := embed.CreateLink(ctx, pv.EmbedLinkParams{Widget: pv.WidgetCaptureResult, ObjectID: requestID, SessionTTL: 600})
{
"object": "embed_link",
"url": "…/r?t=embl_…",
"widget": "capture_result",
"mode": "view",
"session_ttl": 600
}
Send the url by email or text, open it on a phone, or open it in your app's in-app browser with openHostedPage from @provenanceauth/react-native. See the hosted page.
6. Build your own on the API
Your own screens read the same facts from your server. Each element's page names the field behind every row it draws:
With your own UI you map the fields, check the signed result, fetch file links and track deliveries yourself. The elements do that for you.
Errors you might see
| Error | Why | What to do |
|---|---|---|
403 insufficient_ | The key lacks the view's scope | Use a key with attest (capture), authorize (checkout) or mandate (run). The SDKs raise it as a permission error. |
400 embed_ | The ID is another kind of object | Pass a capr_ ID for a capture result, a cas_ or coap_ ID for a checkout result, a run_ ID for a run result. |
402 plan_ | Embeds and hosted pages are Pro and up | Upgrade, or use the console's views on any plan. |
401 embed_ | The session ended | Give the element getToken(), or mint a new link. |
See also
- Embeds
- Capture result in your admin
- Capture request composer
- Checkout result in your admin
- Run result in your admin
- Proposals in your pages
- Capture list in your admin
- Checkout list in your admin
- Chargeback protection in your admin
- Run list in your admin
- Traffic list in your admin
- Traffic result in your admin
- Hosted page for results
- SDKs