# Show results, send requests

Put capture results, checkout results and the capture request composer in front of your staff, as an embed, a hosted page, the console or your own UI, minted from your server with the SDKs.

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.

```bash
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.createToken` | `embed.createLink` | 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](https://provenanceauth.com/docs/get-started/sandbox.md).

With access to the private Provenance repository, which your Provenance contact grants, install from it:

```bash
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.tgz
```

```bash
git clone https://github.com/michaelnbane-jpg/provenance.git provenance
pip install ./provenance/python/sdk
```

For 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 /v1/embed/tokens`](https://provenanceauth.com/docs/api/embeds.md#post-v1-embed-tokens) 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**

```bash
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\"] }"
```

**Node**

```ts
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 });
```

**Python**

```python
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"]
```

**Go**

```go
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"}})
```

```json
{
  "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_result` | A capture request (`capr_…`) | `show`: `case_id`, `metadata` |
| `checkout_result` | A checkout assessment (`cas_…`) or cart approval (`coap_…`) | Nothing else |
| `run_result` | An agent run (`run_…`) | Nothing else |
| `traffic_result` | A traffic assessment (`tas_…`) | Nothing else |
| `capture_request` | Your case reference (1 to 200 characters) | `author` and `request`, both required ([the composer](https://provenanceauth.com/docs/embeds/capture-request.md)) |

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:

```bash
npm install @provenance/embed
```

```html
<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](https://provenanceauth.com/docs/embeds/capture-result.md), [request composer](https://provenanceauth.com/docs/embeds/capture-request.md), [checkout result](https://provenanceauth.com/docs/embeds/checkout-result.md), [run result](https://provenanceauth.com/docs/embeds/run-result.md), [traffic result](https://provenanceauth.com/docs/embeds/traffic-result.md). 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](https://provenanceauth.com/docs/embeds/capture-list.md), [checkout list](https://provenanceauth.com/docs/embeds/checkout-list.md), [run list](https://provenanceauth.com/docs/embeds/run-list.md), [traffic list](https://provenanceauth.com/docs/embeds/traffic-list.md)).

## 5. Mint a link for the hosted page

When there's no web admin to drop a tag into, mint a link instead. [`POST /v1/embed/links`](https://provenanceauth.com/docs/api/embeds.md#post-v1-embed-links) takes the same body, plus `session_ttl`, and returns a URL that opens once:

**curl**

```bash
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 }"
```

**Node**

```ts
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.
```

**Python**

```python
link = prov.embed.create_link(widget="capture_result", object_id=request_id, session_ttl=600)
```

**Go**

```go
link, err := embed.CreateLink(ctx, pv.EmbedLinkParams{Widget: pv.WidgetCaptureResult, ObjectID: requestID, SessionTTL: 600})
```

```json
{
  "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](https://provenanceauth.com/docs/embeds/hosted-page.md).

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

| View | Read | Rows |
| --- | --- | --- |
| Capture result | [`GET /v1/attest/capture_requests/{id}`](https://provenanceauth.com/docs/api/capture-requests.md#get-v1-attest-capture-requests-id) | [The capture result's rows](https://provenanceauth.com/docs/embeds/capture-result.md#what-it-shows) |
| Capture result, the signed proof | [`GET /v1/attest/capture_requests/{id}/result`](https://provenanceauth.com/docs/api/capture-requests.md#get-v1-attest-capture-requests-id-result) | Verify `token` against `jwks_url` on your server |
| Capture result, the photos | [`GET /v1/attest/capture_requests/{id}/files`](https://provenanceauth.com/docs/api/capture-requests.md#get-v1-attest-capture-requests-id-files) | Short-lived file links |
| Capture result, the context | [`GET /v1/attest/capture_requests/{id}/context`](https://provenanceauth.com/docs/api/capture-requests.md#get-v1-attest-capture-requests-id-context) | [The Context rows](https://provenanceauth.com/docs/embeds/capture-result.md#context) |
| Checkout result | [`GET /v1/authorize/checkout_assessments/{id}`](https://provenanceauth.com/docs/api/assessments.md#get-v1-authorize-checkout-assessments-id) and [`GET /v1/authorize/checkout_approvals/{id}`](https://provenanceauth.com/docs/api/checkout-approvals.md#get-v1-authorize-checkout-approvals-id) | [The checkout result's rows](https://provenanceauth.com/docs/embeds/checkout-result.md) |
| Run result | [`GET /v1/mandate/runs/{id}`](https://provenanceauth.com/docs/api/runs.md#get-v1-mandate-runs-id) and [`GET /v1/mandate/assessments`](https://provenanceauth.com/docs/api/decisions.md#get-v1-mandate-assessments) with `run_id` | [The run result's rows](https://provenanceauth.com/docs/embeds/run-result.md#what-it-shows) |
| Capture list | [`GET /v1/attest/capture_requests`](https://provenanceauth.com/docs/api/capture-requests.md#get-v1-attest-capture-requests) with its filters and `created_gte` / `created_lte` | [The capture list's rows](https://provenanceauth.com/docs/embeds/capture-list.md#what-it-shows) |
| Checkout list | [`GET /v1/authorize/checkout_assessments`](https://provenanceauth.com/docs/api/assessments.md#get-v1-authorize-checkout-assessments) with `outcome`, `approval_status`, `order_id` and the created range | [The checkout list's rows](https://provenanceauth.com/docs/embeds/checkout-list.md#what-it-shows) |
| Run list | [`GET /v1/mandate/runs`](https://provenanceauth.com/docs/api/runs.md#get-v1-mandate-runs) with `status`, `q` and the created range | [The run list's rows](https://provenanceauth.com/docs/embeds/run-list.md#what-it-shows) |
| Traffic list | [`GET /v1/identify/assessments`](https://provenanceauth.com/docs/api/traffic-checks.md#get-v1-identify-assessments) with `outcome`, `class`, `signed`, `bot_likelihood` and the created range | [The traffic list's rows](https://provenanceauth.com/docs/embeds/traffic-list.md#what-it-shows) |
| Traffic result | [`GET /v1/identify/assessments/{id}`](https://provenanceauth.com/docs/api/traffic-checks.md#get-v1-identify-assessments-id) | [The traffic result's rows](https://provenanceauth.com/docs/embeds/traffic-result.md#what-it-shows) |
| Request composer | [`POST /v1/attest/capture_requests`](https://provenanceauth.com/docs/api/capture-requests.md#post-v1-attest-capture-requests) | Your own form, with the consent wording your account's mode needs |

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_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope) | 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_object_kind_mismatch`](https://provenanceauth.com/docs/platform/errors.md#embed_object_kind_mismatch) | 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_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required) | Embeds and hosted pages are Pro and up | Upgrade, or use the console's views on any plan. |
| `401` [`embed_token_invalid`](https://provenanceauth.com/docs/platform/errors.md#embed_token_invalid) | The session ended | Give the element `getToken()`, or mint a new link. |

## See also

- [Embeds](https://provenanceauth.com/docs/embeds.md)
- [Capture result in your admin](https://provenanceauth.com/docs/embeds/capture-result.md)
- [Capture request composer](https://provenanceauth.com/docs/embeds/capture-request.md)
- [Checkout result in your admin](https://provenanceauth.com/docs/embeds/checkout-result.md)
- [Run result in your admin](https://provenanceauth.com/docs/embeds/run-result.md)
- [Proposals in your pages](https://provenanceauth.com/docs/embeds/counter-offers.md)
- [Capture list in your admin](https://provenanceauth.com/docs/embeds/capture-list.md)
- [Checkout list in your admin](https://provenanceauth.com/docs/embeds/checkout-list.md)
- [Chargeback protection in your admin](https://provenanceauth.com/docs/embeds/chargeback-protection.md)
- [Run list in your admin](https://provenanceauth.com/docs/embeds/run-list.md)
- [Traffic list in your admin](https://provenanceauth.com/docs/embeds/traffic-list.md)
- [Traffic result in your admin](https://provenanceauth.com/docs/embeds/traffic-result.md)
- [Hosted page for results](https://provenanceauth.com/docs/embeds/hosted-page.md)
- [SDKs](https://provenanceauth.com/docs/get-started/sdks.md)
