SDK reference · Python SDK
prov.embed.create_link
prov.embed.create_link in Python SDK. Mint a hosted page link (201): the same body and checks as create_token, Pro and up.
Signature
prov.embed.create_link(widget: HostedWidget, object_id: str, mode: Optional[str] = …, ttl: Optional[int] = …, session_ttl: Optional[int] = …, show: Optional[List[EmbedShowField]] = …, author: Optional[EmbedAuthor] = …, request: Optional[CaptureRequestSessionOptions] = …, rules: Optional[RulesEmbedScope] = …, idempotency_key: Optional[str] = …) -> EmbedLinkParameters
widgetHostedWidgetRequiredobject_idstrRequiredmodeOptional[str]ttlOptional[int]session_ttlOptional[int]showOptional[List[EmbedShowField]]authorOptional[EmbedAuthor]requestOptional[CaptureRequestSessionOptions]rulesOptional[RulesEmbedScope]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 page's element.
capture_resultandcapture_requestneed a key with theattestscope;checkout_resultneedsauthorize;run_resultneedsmandate;traffic_resultneedsidentify;rulesneeds the scope of its kind's product (authorizeforcheckout,mandateforintent,attestforcapture). Another widget is400 parameter_invalid. One ofcapture_result,capture_request,checkout_result,run_result,rules,traffic_result. object_idstringRequired- As for the token: a capture request (
capr_…) forcapture_result, a checkout assessment (cas_…) or cart approval (coap_…) forcheckout_result, an agent run (run_…) forrun_result, a traffic assessment (tas_…) fortraffic_result, your case reference forcapture_request, the kind of rules (checkout,intent,captureormandate_limits) forrules. modestringviewfor a result view,sendfor the composer (the defaults);rulestakesview(the default),editorpublish(withrules.saves: publish).rulesobjectrulesonly, required: everything a rules session may show and touch, passed on every mint (nothing is saved between sessions). Strict: an unknown key is400 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). Formandate_limits, a row:cap,budget,allowed_mcc,named_merchants,blocked_mcc,blocked_merchants,refuse_over_cap,refuse_over_shareorask_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.valueorwhen.items.N.conditions.M.value. Formandate_limits:amountoncap,allocation(shared,reserved) andat_limit(stop,ask,continue) onbudget,valueon a margin row (withadvanced, 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
editorpublishsession 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. Onmandate_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 withmanage; 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 withoutmanage). Not onmandate_limits. One ofall,session. manageboolean- Full control (not by default): in an
editorpublishsession, every shown rule that isn't locked can be moved (order), turned off, deleted (remove), duplicated (copy_of) and have every value edited; withadvanced, 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 onmandate_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 ofGET /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 is400 rules_embed_out_of_scope). Absent: every field of the kind's catalog. Not onmandate_limits. savesenumdraft(the default): a save waits to be published.publishneeds modepublish. One ofdraft,publish.draft_groupstring | null- Sandbox only (
400in live): an opaque label up to 64 characters that keeps one group's drafts from another's.
showarray of enumscapture_resultonly: also show the request'scase_idormetadata.authorobjectcapture_requestonly, required: who will use the page, as you report it.Show child attributes
idstringRequired- Your reference for the staff member.
display_namestringRequired- Their display name.
requestobjectcapture_requestonly, required: the send options, as onPOST /v1/embed/tokens.max_sendscounts every send of the page session.ttlinteger- Seconds the link may be opened in (≤ 900, default 900).
session_ttlinteger- Seconds the opened page works for (60 to 3600, default 3600).
Returns
EmbedLink The link: open it on a phone, send it by email or text, or open it in an in-app browser.
HTTP operation
POST /v1/embed/links: Create a hosted page link
Errors
- embed_object_kind_mismatch
- insufficient_scope
- parameter_invalid
- parameter_missing
- plan_required
- rules_embed_rule_missing
- trial_ended
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/capture_requests`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x", "Content-Type": "application/json" },
body: JSON.stringify({ "case_id": "LMB-20418", "delivery": "self", "session_type": "id" }),
})).json();
const captureRequestId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/embed/links`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"widget": "capture_result",
"object_id": captureRequestId,
"show": [
"case_id"
]
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/attest/capture_requests", headers={"Authorization": "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x"}, json={
"case_id": "LMB-20418",
"delivery": "self",
"session_type": "id"
}).json()
capture_request_id = step1["id"]
data = httpx.post(f"{api}/v1/embed/links", headers={"Authorization": "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x"}, json={
"widget": "capture_result",
"object_id": capture_request_id,
"show": [
"case_id"
]
}).json()