SDK reference · Python SDK

prov.embed.create_token

prov.embed.create_token in Python SDK. Mint an embed session for one widget and one object (201).

Signature

prov.embed.create_token(widget: EmbedWidget, object_id: Optional[str] = …, mode: Optional[str] = …, ttl: Optional[int] = …, show: Optional[List[EmbedShowField]] = …, author: Optional[EmbedAuthor] = …, request: Optional[CaptureRequestSessionOptions] = …, subject: Optional[EmbedSubject] = …, rules: Optional[RulesEmbedScope] = …, filters: Optional[Union[CaptureListFilters, CheckoutListFilters, RunListFilters, TrafficListFilters]] = …, publishable_key_id: Optional[str] = …, idempotency_key: Optional[str] = …) -> EmbedToken

Parameters

widgetEmbedWidgetRequired
object_idOptional[str]
modeOptional[str]
ttlOptional[int]
showOptional[List[EmbedShowField]]
authorOptional[EmbedAuthor]
requestOptional[CaptureRequestSessionOptions]
subjectOptional[EmbedSubject]
rulesOptional[RulesEmbedScope]
filtersOptional[Union[CaptureListFilters, CheckoutListFilters, RunListFilters, TrafficListFilters]]
publishable_key_idOptional[str]
idempotency_keyOptional[str]

Request fields

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
widgetenumRequired
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_idstring
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).
subjectobject
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.
Show child attributes
device_idstring
agent_access: the person's device.
approver_link_idstring
approvals: one of your accepted approver links; the token lists that approver's requests from your company.
ttlinteger
Seconds (≤ 900).
modestring
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_idstring
Optional binding to one publishable key: the token then works only with that key (another key of the account gets 401 embed_token_invalid).
showarray of enums
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.
authorobject
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.
Show child attributes
idstringRequired
Your reference for the staff member (1 to 200 characters).
display_namestringRequired
Their display name (1 to 120 characters).
requestobject
capture_request only, required: the options every send of the session stays within. A send outside them is 400 embed_request_out_of_scope.
Show child attributes
kindsarray of enumsRequired
What the session may send: an ID session, a claim session, or your own items.
accepted_documentsarray of enums
capture.id: the document kinds accepted (one: the person isn't asked to choose).
photosobject
capture.claim: { min, max, until_done } photos.
videosobject
capture.claim: { min, max, max_duration_s } videos.
itemsarray of objects
capture.items (required with it): the items, as on a create.
require_tierobject
{ default: any | hardware, editable }: the hardware requirement, and whether staff may change it (not by default).
expires_inobject
{ default, max } in seconds: the expiry and the longest staff may pick.
remindersenum
account (default): the account's schedule, which staff may turn off. One of account, off.
contactobject
A phone or email to send to. It stays on the server; the element shows it masked.
contact_editableboolean
Whether staff may replace a prefilled contact (not by default).
entryenum
Who types the contact: staff (default) or person (a kiosk or counter, where the person ticks their own consent box). One of staff, person.
qrboolean
Whether **Show a QR** is offered (default true).
max_sendsinteger
Requests the session may send (default 3).
reference_addressesarray of objects
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.
Show child attributes
kindenumRequired
What the address is. One of loss, person, business, shipping, other.
labelstring | null
Your label for it; the element shows it.
addressobject
A postal address.
Show child attributes
line1stringRequired
The street line.
line2string | null
A second line.
citystringRequired
The city.
regionstring | null
The ISO 3166-2 subdivision code (OH or US-OH).
postal_codestring | null
The postal code.
countrystringRequired
ISO 3166-1 alpha-2.
locationobject
Coordinates (no geocoder needed).
Show child attributes
latnumberRequired
Latitude.
lngnumberRequired
Longitude.
rulesobject
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.
Show child attributes
showarray of objectsRequired
The rules the session sees, by id. They show in the policy's own order; rules not listed stay hidden.
Show child attributes
rule_idstringRequired
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.
templatestring
A template id of the kind the row reads as.
fieldsarray of objects
The values that are blanks, each a path into the rule (when.0.value) with its bounds.
Show child attributes
pathstringRequired
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).
minnumber
A number blank's lowest value.
maxnumber
A number blank's highest value.
valuesarray of strings
The words a word blank may take (the field's own values).
can_turn_offboolean
Whether the session may turn the rule off (not by default).
lockedboolean
Shown read-only: no blanks, no turning off.
add_from_templatesarray of strings
Template ids of the kind the session may add (none by default).
advancedboolean
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.
visibilityenum
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.
manageboolean
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.
advanced_fieldsarray of strings
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.
savesenum
draft (the default): a save waits to be published. publish needs mode publish. One of draft, publish.
draft_groupstring | null
Sandbox only (400 in live): an opaque label up to 64 characters that keeps one group's drafts from another's.
filtersobject
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.
Show child attributes
statusstring
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.
item_typeenum
An item type the request asks for. One of photo, selfie, id_document, video.
sourceenum
How an item was taken. One of browser, native_sdk.
destinationenum
Where the link opened. One of company_app, provenance_app, app_clip, web.
case_idstring
Your case reference, for example one case's requests.
created_gtetimestamp
Created at or after this time.
created_ltetimestamp
Created at or before this time.
outcomestring
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.
approval_statusenum
checkout_list: the cart approval's status. One of pending, in_review, approved, denied, expired.
order_idstring
checkout_list: orders whose reference contains this text.
qstring
run_list: runs whose name or ID contains this text.
classstring
traffic_list: Identify's class (signed_agent, declared_bot, suspected_bot, likely_human, unknown), one or several separated by commas.
signedenum
traffic_list: the agent signature verified, or didn't. One of true, false.
bot_likelihoodstring
traffic_list: the bot likelihood band (low, medium, high, unclassified), one or several separated by commas.

Returns

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

HTTP operation

POST /v1/embed/tokens: Create an embed token

Errors

Example

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();

Was this page helpful? Send us feedback

LLM? Read llms.txt.