SDK reference · Node SDK
prov.mandate.approvers.route
prov.mandate.approvers.route in Node SDK.
Signature
prov.mandate.approvers.route(linkIdOrParams: string | (RouteApprovalParams & GroupRouteParams), params?: RouteApprovalParams): Promise<RoutedApproval | GroupRoutedApproval>Parameters
linkIdOrParamsstring | (RouteApprovalParams & GroupRouteParams)RequiredparamsRouteApprovalParams
Request fields
contactstring- An email or E.164 phone number you already hold. Required unless you send
approver_link_ids. approver_link_idsarray of strings- Group sign-off: the accepted approver links to route to (with
intent_token). approvals_neededinteger- With
approver_link_ids: how many must approve (default: all). deny_ruleenum- With
approver_link_ids:any(default) ends it at the first deny;unreachableonce approval can't happen. One ofany,unreachable. grantobject- The scope, as on an invite (
action_types,max_amount,products). intent_tokenstring- The agent's intent token (preferred; the approval binds to it).
jtistring- A bare jti (unbound; never satisfies verify).
action_descriptionstringRequired- Must be the action the intent token was authorized for.
amountnumber- The amount.
approval_expires_ininteger- The approval's expiry in seconds.
link_expires_ininteger- How long each single-use link works.
remindersobject- For a routed approval: its automatic reminders (the
approvalschedule's shape). Left out, your account's schedule.Show child attributes
enabledbooleantruetracks this request on the schedule (Pro and above on a live deployment:402 plan_requiredonreminders.enabledbelow Pro, nothing created; every plan in the sandbox);falsesends it no automatic reminder (one by hand or by API is still allowed).afterarray of strings- Up to three offsets from the request's creation (
10m,24h,3d), increasing, each at least the minimum gap after the one before, at most 7 days. Errors use the Settings messages onreminders.after.
channelsobject- Which messages may go (
app_notification,email,text); one message goes. Left out, your account's default. deliveryenumsend, orself: send nothing; the response carriesapprove_url. Left out, your account's default. One ofsend,self.contextobject- Details shown to the approver.
Returns
Promise<RoutedApproval | GroupRoutedApproval> The approval, routed to the new contact. link_status is invited until they set up a passkey.
HTTP operation
POST /v1/mandate/approver_links/route: Route an approval to someone new
Errors
- approval_already_open
- approver_network_disabled
- authentication_required
- intent_token_foreign
- invalid_json
- invite_declined
- link_revoked
- parameter_invalid
- plan_required
- rate_limit_exceeded
- resource_missing
- usage_limit_reached
Example
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approver_links/route`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"contact": "ana@northside.example",
"jti": "jti_route_ana_1",
"action_description": "Pay invoice INV-2041: $850.00 to Brindlecote Supplies",
"amount": 850
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/approver_links/route", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"contact": "ana@northside.example",
"jti": "jti_route_ana_1",
"action_description": "Pay invoice INV-2041: $850.00 to Brindlecote Supplies",
"amount": 850
}).json()