Mandate · API reference
Policies
Your account's versioned rules for what's allowed, denied or sent for approval.
Related guide: Policies
The policy version object
Attributes
objectenumRequired- The type of object. One of
policy_version. policy_idstring- The policy's ID (
pol_…), the same on every version of it. domainstringRequired- The policy domain.
versionintegerRequired- The version number.
activebooleanRequired- Whether this version is the active policy.
notestring | null- A note for the record.
created_atstring- When it was created.
created_bystring | null- Who saved the version.
documentobject- The policy document as saved, with Provenance's rule IDs.
shadowboolean- The shadow settings.
draftboolean- Present and true on a draft saved with POST .../versions that has not gone live.
trial_ends_attimestamp- Present while the version is on a trial run, with when the trial run ends.
restored_frominteger- On a restore, the version it copies.
promoted_from_trialboolean- Present and true when the version went live from its trial run.
sourceenum- Where the version was written: the console, the API, or a rules embed session (
<provenance-rules>). Present on versions written since 2026-11-17. One ofconsole,api,embed. embed_sessionstring- On a version saved by a rules embed session, that session's id (the embed token's
id, never the token).created_bynames the API key or console member that minted the session. draft_groupstring- Sandbox. The draft group a rules embed session saved this draft in (
rules.draft_group). It stays once the draft is published. Listed only with?draft_group=naming the group while the draft waits. key_last4string- In the version list, on a version written through the API or a rules embed session, the last four characters of the account's API key that wrote it (or minted the session). Absent when
created_byis a console member. warningsarray of objects- Checkout rules only, present when a rule never runs (
shadowed_by). The version is saved either way.Show child attributes
typeenumRequired- Always
shadowed_by. One ofshadowed_by. rule_idstringRequired- The rule that never runs.
shadowed_bystringRequired- The rule above it that always decides first.
messagestringRequired- The warning in words ("This rule never runs: 'No mandate or approval' decides first").
The policy version object
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"domain": "intent",
"version": 4,
"active": true,
"note": "cap wires at 10k",
"created_at": "2026-11-17T14:20:00.092Z",
"document": {
"rules": [
{
"id": "rul_01M7MY20PWTEKQRPRKPG8ZHQRE",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
},
"label": "Wires over 10k denied"
}
]
}
}Events
Sent to your webhook endpoints when they subscribe:
mandate.policy.notifiedmandate.policy.decision_requestedmandate.policy.published
Create a policy draft
POST/v1/mandate/policies/versions
Validates a document and saves it as the next version without making it live: a draft (v13 while v12 is live). Review it with diff, check it with backtest, then publish it.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentobjectRequired- A policy document: ordered rules, in one format for an agent policy, a store's checkout rules and a person's own rules.
Show child attributes
rulesarray of objectsRequired- The rules, in order (at most 50; up to 200 on Enterprise).
Show child attributes
idstring- The rule's ID, set by Provenance:
rul_and a ULID, given when the rule is first saved and kept in every later version while the rule exists; a default row has a fixedrul_default_…ID, the same in every account. Leave it out of a new rule, and send a saved rule back with its ID to keep it. Arul_ID the policy never had is replaced with a new one. Any other value is kept aslegacy_idand names the same rule when sent again. Therul_default_prefix is reserved for the default rows (400 policy_invalid). A person's own rules and the risk policies keep their IDs as written. Always present on a read. refstring- Set by Provenance: the rule's short display ID (
R-103, orR-04outside checkout), shown beside the rule in the console and on every decision aspolicy.rule.ref. Kept across versions and never reused in the policy. What you send here is ignored. legacy_idstring- Set by Provenance: the ID the rule had before rule IDs were set by Provenance (November 2026), or the value it was first written with. A decision recorded with that ID still finds the rule. What you send here is ignored.
groupstring- The rule group (
groups[].key) this rule belongs to. It still runs in order as an ordinary rule. labelstring- The rule's name, such as
Orders over $500. Evaluation never reads it. whenarray of objects | objectRequired- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
Show child attributes
factstring- The fact the condition reads (
transaction_amount,order.amount,agent.verified), orfieldto readpathfrom the request. openum- The comparison operator. A field condition takes the comparisons,
in,matches,contains,contains_any,is_emptyandis_not_empty. Every operator except the two null operators fails to match a missing or null fact,neincluded.is_emptymatches a fact that is missing, null, an empty string or an empty list;is_not_emptymatches any other value. valueany- The value to compare with (a string, number, boolean or a list of them).
is_emptyandis_not_emptytaketrue. pathstring- With
fact: field: up to 6 dotted names, each optionally followed by[]for every element of a list (at most one[]), such asmetadata.cost_centerororder.items[].sku. itemsenum- With a path through a list: whether any element (the default) or every element must match. One of
any,all. metricenum- With
fact: velocity: what is counted. One ofverify_count,amount_sum. windowenum- With
fact: velocity: the window.1hand24hare rolling;monthis the calendar month in UTC, counted peraccountoragent. One of1h,24h,month. perenum- With
fact: velocity: what it is counted per.agentis the registered agent the token names (none: 0). One ofdevice,session,account,agent. setstring- With
fact: canaryorprediction: the canary family or probe. best_effortboolean- With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum- With
z_gtorpct_gt: the baseline the score is compared against. One ofagent,account. if_unavailableenum- What an unavailable reading means for this condition:
skip(no match),match, orask(match and ask a person).ignoreis an external risk fact's older word forskip; a capture fact or Trace finding takesskipormatch. One ofskip,match,ask,ignore. matchenum- Whether all, any, none or at least
nof the group's items must match (noneholds when no item does; a condition on a missing fact doesn't hold). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). N-of-M. conditionsarray of objects- The group's conditions and groups (1 to 10).
requireobjectRequired- A rule's THEN part:
denyblocks,approvalasks a person,biometric,hardwareormin_tierask for stronger proof,webhookasks your webhook, andnotify(alone) allows and notifies. On your checkout and card issuer rules,no_challenge(alone) approves (Capture and Trace rules sayfrictionless), and on an after-approval rulereview(alone) holds the order for your review.Show child attributes
reviewenum- Checkout rules with
phase: after_approvalonly, set alone: Review. The customer approved, and the order waits for your decision (status: in_review, no token yet) until you approve or reject it, or it times out. One oftrue. no_challengeenum- Checkout rules (
/v1/authorize/policies) and card issuer rules, set alone: Approve. When the rule matches, the cart is approved (allow, reasonpolicy_rule_approved) and no later rule runs, whether or not a token, mandate or earlier approval covers it. A cart nothing covers gets no token. A write may also sendfrictionless. One oftrue. frictionlessenum- Capture and Trace rules, set alone: Approve (Allow). On checkout and card issuer rules, an older word for
no_challenge, still accepted on a write. When a checkout rule matches, the cart is approved (allow, reasonpolicy_rule_approved) and no later rule runs, whether or not a token, mandate or earlier approval covers it. A cart nothing covers gets no token. One oftrue. ucp_fallbackenum- Checkout rules only, with
approval: truebefore approval: what a Universal Commerce Protocol checkout does when the platform didn't negotiate the approval Action.escalate(the default) hands the checkout to your checkout page;hold_after_orderopens the approval and you hold the order until it is approved. One ofescalate,hold_after_order. denyboolean- Block the request; the rule's
reasonis what the agent sees. lockenum | object- Trace rules only, with
denyorapproval: lock the agent session (trueorscope: session), the registered agent (agent) or the run (run) until a person clears it;revoke_sessionalso revokes the session's intent tokens.Show child attributes
scopeenum- What the lock names. One of
session,agent,run. revoke_sessionenum- Also revoke the session's intent tokens. One of
true.
suspend_agentenum- Trace rules only, with
deny: suspend the registered agent. One oftrue. sample_rateinteger- Spot checks, on a Reject rule (
deny) of checkout, agent, capture or Trace rules (Trace at phaseactiononly): 1 in N of the records it would reject is asked about instead (Challenge; a capture shot goes to In review, a Trace action to Review), chosen from the record id. Card issuer rules and Trace rules at phasecompletionrefuse it: nobody can answer in time. Off unless set. flowstring- Checkout and agent rules: the rule takes this sub-flow's outcome as its own (a key in the document's
flows). The flow'snonepasses to the next rule. Takes no other requirement. approvalboolean- Ask a person to approve.
approversinteger- How many distinct approvers are needed, for a route without
steps. routeobject- Who approves a rule's request and how long it waits: either a chain of
steps, or a first target withescalateandwait.Show child attributes
tostring- The first target. With
stepsit is the first step's first target and may be left out. stepsarray of objects- An approval chain of 1 to 5 steps, in order. The chain waits the sum of its steps'
after(1 minute to 7 days); then the rule'sif_unansweredapplies, else the account's approval expiry default. A chain leaves outescalate,waitandapprovers. approvers_fromenum- How approvals count toward the number needed. One of
any,distinct_people. escalatearray of objects- Escalation steps, for a route without
steps. waitstring- How long the request waits in all, for a route without
steps. if_unansweredenum- What happens when nobody answers. Left out, the account's approval expiry default applies. One of
expire,decline,approve_below. approve_below_amountnumber- With
approve_below: the amount it approves at or under. hoursstring- The approver group (
agr_…) whose business hours apply. outside_hoursenum- What happens to a request outside business hours. One of
hold,escalate. assignenum- Who gets it first. A chain uses
all. One ofall,round_robin,least_pending.
biometricboolean- Require face, fingerprint or passkey from the person.
hardwareboolean- Require a hardware-backed phone.
min_tierenum- The weakest device tier allowed. One of
simulated,software,tee,strongbox,sep. webhookstring- The name of the policy webhook to ask.
notifyobject- "Approve and notify": the rule allows the request and tells the people named, the account's webhook endpoints, or both. It never decides, so evaluation goes on to the next rule. A notify rule's
requireholdsnotifyalone.Show child attributes
toarray of strings- People, groups or roles to tell (1 to 10 route targets, such as
role:adminsoruser:owner). webhookboolean- Also send the
mandate.policy.notifiedevent to the account's webhook endpoints.
approval_min_credential_age_sinteger- With
approval: how old the approving passkey must be, in seconds. approval_methodenum- With
approval: only the approver's phone in the Provenance app approves. One ofdevice_key. individualboolean- With
approval: the request is never approved in a batch. auto_approvearray of objects- Clauses under which the approval counts as given without a person.
reasonstring- The reason code a matching rule reports. On a person's rules:
store_not_allowedon a block, orask_aboveoroutside_hourson an ask (the codes the rules moved from Your rules keep), else none (person_rule). on_requestenum- A person's rules only: what the rule does to a company's approval request sent to the person, when it matches.
holdkeeps the request in the person's home and sends nothing;deferdelivers it like quiet hours. Absent: the rule leaves companies' requests alone. Such a rule reads only the store and the time. One ofhold,defer. phaseenum- Trace rules:
action(absent; before a tool runs) orcompletion(on model output). Your checkout rules: when the rule runs.assess(absent) runs atPOST /v1/authorize/checkout_assessments;after_approvalruns once the customer has decided a cart approval and before the token is minted, over the assessment's facts and theapproval.*facts (approval.decision,approval.location, …). After-approval rules approve (frictionless; checkout rules sayno_challenge), review (review) or reject (deny); they never challenge. Every plan. One ofassess,after_approval,action,completion. enabledboolean- Whether the rule is on; absent means on.
falsekeeps the rule in the document (and its versions) but skips it: it never matches, decides, notifies or counts in a backtest. Turning a rule off or on is a change like any other (a new draft or version); on a person's tighten-only rules, turning one off loosens them. if_unavailableenum- What an unavailable fact means for this rule, over the document's
settings.if_unavailable(a condition's own setting wins).fail_closedandfail_openstay Trace and agent rules' words. One ofskip,match,ask,fail_closed,fail_open.
timezonestring- An IANA time zone, such as
America/Chicago, for a person'stime.local_hourandtime.local_weekdayfacts. tighten_onlyboolean- A person's rules only. A change that only makes the rules stricter saves without a passkey; one that loosens them needs the passkey and is refused for 7 days after a recovery. Turning it off is a loosening.
versioninteger- Informational; the stored version number is assigned on save.
external_confirmationsobject- Which confirmations given outside Provenance count, and whose keys. Empty by default; it also governs your store's cart approvals. Every plan. The issuers listed here are also the ones whose mandates cover a checkout assessment's cart (
checkout.covered: third_party_mandate).Show child attributes
acceptarray of enums- The kinds you accept.
ap2_issuersarray of objects- Required with
ap2_user_mandate: the AP2 issuers whose signatures count. Their mandates also cover a checkout assessment's cart, with or withoutaccept.Show child attributes
namestringRequired- The name shown as "Confirmed in <name>".
jwks_urlstringRequired- The issuer's JWKS (https).
acp_issuersarray of objects- The ACP issuers you trust: a checkout completion whose signed intent (
provenance_intent.token) one of them signed covers a checkout assessment's cart.Show child attributes
namestringRequired- The issuer's name, as
authority.issuershows it. jwks_urlstringRequired- The issuer's JWKS (https).
platformsarray of objects- Required with
platform: the agent platforms whose signed confirmations count.Show child attributes
namestringRequired- The platform's name.
jwks_urlstringRequired- The platform's JWKS (https).
voiceobject- When a confirmation call may approve on the keypad, and when it needs the passkey. Set on your approval policy (
/mandate/policies) or your checkout rules (/authorize/policies). Absent fields take the defaults: approve on the call up to 25.00 USD to a counterparty this person has paid before, and a passkey otherwise. Grants, delegations, new payees and contact or recovery changes always need the passkey, and so does any rule that requires a biometric.Show child attributes
enabledbooleanfalse: a call never approves; it reads the request and sends the passkey link. Defaulttrue.voice_maxinteger- Approve on the call up to this amount, in minor units of
currency. Default 2500 (25.00 USD).0means never. currencystring- The ISO 4217 currency of
voice_max. DefaultUSD. A request in another currency needs the passkey. voice_requires_known_counterpartyboolean- A counterparty this person hasn't paid before needs the passkey. Default
true. never_voice_action_typesarray of strings- Action types (
context.action_type) that always need the passkey.
passkeysobject- On a checkout policy, what a new passkey needs on a cart approval.
signalsarray of objects- Named checks with no outcome (
signal.<key>), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
sig_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed: a later write can't change it.
labelstringRequired- The account's name for the signal; change it at any time.
whenarray of objects | objectRequired- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
Show child attributes
factstring- The fact the condition reads (
transaction_amount,order.amount,agent.verified), orfieldto readpathfrom the request. openum- The comparison operator. A field condition takes the comparisons,
in,matches,contains,contains_any,is_emptyandis_not_empty. Every operator except the two null operators fails to match a missing or null fact,neincluded.is_emptymatches a fact that is missing, null, an empty string or an empty list;is_not_emptymatches any other value. valueany- The value to compare with (a string, number, boolean or a list of them).
is_emptyandis_not_emptytaketrue. pathstring- With
fact: field: up to 6 dotted names, each optionally followed by[]for every element of a list (at most one[]), such asmetadata.cost_centerororder.items[].sku. itemsenum- With a path through a list: whether any element (the default) or every element must match. One of
any,all. metricenum- With
fact: velocity: what is counted. One ofverify_count,amount_sum. windowenum- With
fact: velocity: the window.1hand24hare rolling;monthis the calendar month in UTC, counted peraccountoragent. One of1h,24h,month. perenum- With
fact: velocity: what it is counted per.agentis the registered agent the token names (none: 0). One ofdevice,session,account,agent. setstring- With
fact: canaryorprediction: the canary family or probe. best_effortboolean- With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum- With
z_gtorpct_gt: the baseline the score is compared against. One ofagent,account. if_unavailableenum- What an unavailable reading means for this condition:
skip(no match),match, orask(match and ask a person).ignoreis an external risk fact's older word forskip; a capture fact or Trace finding takesskipormatch. One ofskip,match,ask,ignore. matchenum- Whether all, any, none or at least
nof the group's items must match (noneholds when no item does; a condition on a missing fact doesn't hold). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). N-of-M. conditionsarray of objects- The group's conditions and groups (1 to 10).
scorecardsarray of objects- Scorecards (
scorecard.<key>.score,scorecard.<key>.matched), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
scd_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed.
labelstringRequired- The account's name for the scorecard; change it at any time.
rowsarray of objectsRequired- The rows. Each reads a signal or its own
when.Show child attributes
signalstring- A signal's key in this document (one of
signalandwhen). whenarray of objects | object- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
pointsintegerRequired- Points the row adds when it matches.
labelstring- The row's name.
min_availableinteger- How many rows must be readable for the total to be available (default: all rows but one).
groupsarray of objects- Rule groups (
group.<key>.outcome), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
grp_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed.
labelstringRequired- The account's name for the group; change it at any time.
flowsarray of objects- The sub-flows this rule set calls (checkout and agent rules). Rules read
flow.<key>.outcome,flow.<key>.versionand each declared outputflow.<key>.<output>, or take the flow's outcome withrequire.flow.Show child attributes
keystringRequired- The sub-flow's key.
followenumlatest(the default) follows the published version;pinnedkeepsversion. One oflatest,pinned.versioninteger- The pinned version (only with
followset topinned).
settingsobject- How unavailable facts and fact resolution work for every rule of the document.
Show child attributes
if_unavailableenum- What an unavailable fact means for every rule:
skip(the condition doesn't match),match(it matches) orask(it matches and a person is asked instead of the rule's outcome; refused on issuer rules). The olderfail_closedandfail_openstay Trace and agent rules' words for an unavailable Trace finding. One ofskip,match,ask,fail_closed,fail_open. preflightboolean- Trace rules only: run the rules on model output on the prompt first, before generation.
resolveenumneeded(default) reads only the facts the deciding rule still needs;aheadalso reads the same cost tier of later rules, one round sooner. One ofneeded,ahead.
fallbackobject- The built-in fallback rows' outcomes, by row: what happens when no rule decides. A store's checkout rules have
covered(a cart a token or mandate covers; Approve by default),uncovered(Challenge) andafter_approval(an approved cart; Approve), eachapprove,challengeorreject(approve,revieworrejectafter approval). Capture rules havepasses(Approve) andflagged(Review), eachapprove,revieworreject. Agent policies haveassess(an action no rule decides; Approve by default),approve,review(ask a person) orreject. The rows always run last and are never deleted; a row left out keeps its built-in outcome.
notestring- A note for the record.
Returns
The draft, with draft true and its document. See the policy version object.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": True,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}).json()Response 201
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"version": 18,
"active": false,
"note": "big orders go to admins, then the owner",
"created_by": "key_196PC31R0085T91904QYG9JS3J",
"created_at": "2026-11-17T14:21:13.402Z",
"draft": true,
"source": "api",
"domain": "intent",
"document": {
"rules": [
{
"id": "rul_01M7MY489TVEAA07C4CD178CFF",
"legacy_id": "notify-finance",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
},
"label": "Orders over $10,000"
},
{
"id": "rul_01M7MY489TXDQ5368HNJ0X2N2J",
"legacy_id": "big-orders",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"op": "eq",
"value": "research",
"path": "metadata.cost_center"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"to": "role:admins",
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
},
"label": "Orders over $5,000"
}
]
}
}Retrieve the active policy
GET/v1/mandate/policies
Returns the active policy, or the built-in default with is_default true. Each domain has its own path: the risk policy is /v1/attest/risk_policies and the traffic policy /v1/identify/policies.
Parameters
No parameters.
Returns
The active policy for the domain.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy",
"id": null,
"domain": "intent",
"document": {
"version": 0,
"rules": [
{
"id": "default-require-biometric",
"when": [
{
"fact": "require_biometric",
"op": "eq",
"value": true
}
],
"require": {
"biometric": true
},
"reason": "biometric_required"
},
{
"id": "default-hardware-over-500",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 500
}
],
"require": {
"hardware": true
},
"reason": "hardware_required_above_500"
}
]
},
"version": null,
"is_default": true
}Retrieve approval load
GET/v1/mandate/approvals/insights
Per approval rule and per approver: approvals a week, the median wait, the share approved as asked, and decisions made in under 3 seconds (the sign people approve without reading). Free on every plan.
Parameters
windowenumquery- The period. One of
7d,30d,90d.
Returns
The approval load.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/approvals/insights?window=30d" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approvals/insights?window=30d`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/approvals/insights?window=30d", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "approval_insights",
"window_days": 30,
"totals": {
"approvals": 6,
"per_week": 1.4,
"median_wait_s": 0,
"approved_unchanged_share": 1,
"quick_decisions": 6,
"quick_share": 1,
"automatic": 0
},
"rules": [
{
"rule_id": "rul_01M7ZZP6KNGX0XNYEYTP4DCXFG",
"approvals": 3,
"per_week": 0.7,
"median_wait_s": 0.002,
"approved_unchanged_share": 1,
"quick_decisions": 3,
"quick_share": 1
},
{
"rule_id": "delegation_external",
"approvals": 2,
"per_week": 0.5,
"median_wait_s": 0,
"approved_unchanged_share": 1,
"quick_decisions": 2,
"quick_share": 1
},
{
"rule_id": "rul_01M7ZZP6FZDJ9GQV0XKK2J4SQC",
"approvals": 1,
"per_week": 0.2,
"median_wait_s": 0.003,
"approved_unchanged_share": 1,
"quick_decisions": 1,
"quick_share": 1
}
],
"approvers": [
{
"approver": "machine:acct_000000000000000000000000000000a2",
"approvals": 6,
"per_week": 1.4,
"median_wait_s": 0,
"approved_unchanged_share": 1,
"quick_decisions": 6,
"quick_share": 1
}
]
}Retrieve a policy version
GET/v1/mandate/policies/versions/{version}
Returns one saved policy version's document.
Parameters
versionintegerpathRequired- The version number.
Returns
The policy version. See the policy version object.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": True
}
}
]
}
}).json()
policy_version = step1["version"]
data = httpx.get(f"{api}/v1/mandate/policies/versions/{policy_version}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_version",
"domain": "intent",
"version": 13,
"active": true,
"document": {
"rules": [
{
"id": "rul_01M7MY218BDSB6Q0X3YRRX1MM4",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
},
"label": "Wires over 10k denied"
}
]
},
"note": "cap wires at 10k",
"created_at": "2026-11-17T14:20:00.651Z"
}Get an agent policy version's plan
GET/v1/mandate/policies/versions/{version}/plan
The version compiled into its plan: each rule's facts with what reading them costs (the request and token, your own records, a network call or a model call), cheapest first, and warnings for a fact this rule set can't read, an operator that never matches its fact, or a rule that's never reached.
Parameters
versionintegerpathRequired- The version number.
Returns
The plan.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/plan" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/plan`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": True,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}).json()
policy_version = step1["version"]
data = httpx.get(f"{api}/v1/mandate/policies/versions/{policy_version}/plan", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_plan",
"domain": "intent",
"version": 19,
"plan_hash": "e05c328ece84b51d84443ca25cbae5e546fc0b98de18736a7991fdda1a820e2f",
"node_count": 12,
"reads": [
{
"fact": "action_type",
"tier": 0,
"provider": "request"
},
{
"fact": "transaction_amount",
"tier": 0,
"provider": "request"
}
],
"rules": [
{
"id": "rul_01M8V3E8AJFDMSNQD3B623DPP0",
"tier": 0,
"reads": [
{
"fact": "transaction_amount",
"tier": 0,
"provider": "request"
}
]
},
{
"id": "rul_01M8V3E8AJ3BEADA0PY8CZF6V8",
"tier": 0,
"reads": [
{
"fact": "transaction_amount",
"tier": 0,
"provider": "request"
},
{
"fact": "action_type",
"tier": 0,
"provider": "request"
}
]
}
],
"nodes": [
{
"id": "fact:transaction_amount",
"kind": "fact",
"tier": 0,
"reads": [],
"fact": "transaction_amount"
},
{
"id": "cond:rul_01M8V3E8AJFDMSNQD3B623DPP0:0",
"kind": "condition",
"tier": 0,
"reads": [
"fact:transaction_amount"
]
},
{
"id": "group:rul_01M8V3E8AJFDMSNQD3B623DPP0:when",
"kind": "group",
"tier": 0,
"reads": [
"cond:rul_01M8V3E8AJFDMSNQD3B623DPP0:0"
],
"match": "all"
},
"… 9 more"
],
"warnings": [],
"approve_on_tier3_only": []
}Get the trial run
GET/v1/mandate/policies/trial
Returns the trial run going on now: its draft, when it ends, how many requests it saw and where it would have decided differently from the live version. Without one, active is false.
Parameters
No parameters.
Returns
The trial run.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "trial_days": 7 }' > /dev/null
curl "$PROVENANCE_API/v1/mandate/policies/trial" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies/trial" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "trial_days": 7 }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/trial`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": True,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}).json()
policy_version = step1["version"]
step2 = httpx.post(f"{api}/v1/mandate/policies/versions/{policy_version}/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"trial_days": 7
}).json()
data = httpx.get(f"{api}/v1/mandate/policies/trial", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_trial",
"domain": "intent",
"active": true,
"version": 23,
"started_at": "2026-11-08T18:05:02.786Z",
"ends_at": "2026-11-15T18:05:02.786Z",
"evaluated": 0,
"differences": 0,
"totals": {
"evaluated": 0,
"both_allowed": 0,
"both_denied": 0,
"divergent": 0,
"would_have_denied": 0,
"would_have_allowed": 0,
"would_have_auto_approved": 0
},
"examples": []
}Get the shadow report
GET/v1/mandate/policies/shadow_report
Compares the shadow version with the active policy over a time window: how often they disagreed, per rule, and which decisions the shadow would have denied.
Parameters
created_gtetimestampquery- The start of the time window, as an ISO 8601 time.
created_ltetimestampquery- The end of the time window, as an ISO 8601 time.
Returns
The shadow report.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/policies/shadow_report" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/shadow_report`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/policies/shadow_report", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "shadow_report",
"shadow_active": false,
"shadow_version": null,
"from": null,
"to": null,
"shadow_policy_version": null,
"totals": {
"evaluated": 0,
"both_allowed": 0,
"both_denied": 0,
"divergent": 0,
"would_have_denied": 0,
"would_have_allowed": 0,
"would_have_auto_approved": 0
},
"divergence_rate": 0,
"per_rule": [],
"would_have_denied": []
}Get rule performance
GET/v1/mandate/policies/performance
Agent policies don't offer rule performance yet (checkout policies do): this answers 400 policy_feature_unsupported. The route is here so every policy has the same routes.
Parameters
fromstringquery- The first UTC day, YYYY-MM-DD (default: 29 days before
to). tostringquery- The last UTC day, YYYY-MM-DD (default: today). A window covers at most 366 days.
versionintegerquery- Only the decisions this version made (default: every version in the window, in the live version's rule order).
currencystringquery- The ISO 4217 currency values are summed in (default: the one with the most orders).
Returns
The rule set's totals and each rule's numbers.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/policies/performance" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/performance`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/policies/performance", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_performance",
"domain": "checkout",
"from": "2026-11-03",
"to": "2026-12-02",
"version": null,
"currency": "USD",
"other_currencies": [],
"totals": {
"matched": 1,
"value_minor": 3800,
"outcomes": [
{
"outcome": "approve",
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
},
{
"outcome": "challenge",
"count": 1,
"value_minor": 3800,
"currency": "USD",
"share": 1
},
{
"outcome": "reject",
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
}
],
"results": {
"true_positive": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"false_positive": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"missed": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"allowed": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"unlabelled": {
"count": 1,
"value_minor": 3800,
"currency": "USD"
}
},
"labelled": 0,
"enough_labels": false
},
"rules": [
{
"rule_id": "fallback",
"name": null,
"outcomes": [
"challenge"
],
"matched": 1,
"value_minor": 3800,
"results": {
"true_positive": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"false_positive": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"missed": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"allowed": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"unlabelled": {
"count": 1,
"value_minor": 3800,
"currency": "USD"
}
}
}
],
"labels_note": "A rejected order has no outcome, so rejections count only when a label says whether they were right; the rest show as No label yet."
}List automatic approval clauses
GET/v1/mandate/policies/auto_approve
Lists the auto_approve clauses on your active policy, each with whether it is on, paused or expired, what it approved in its current window, and its last 30 days. Free on every plan.
Parameters
No parameters.
Returns
The clauses.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PATCH "$PROVENANCE_API/v1/account/policies/lists/auto_payees" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "kind": "allow", "entries": ["Northside"] }' > /dev/null
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}' > /dev/null
curl "$PROVENANCE_API/v1/mandate/policies/auto_approve" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/auto_payees`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "kind": "allow", "entries": ["Northside"] }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/auto_approve`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.patch(f"{api}/v1/account/policies/lists/auto_payees", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"kind": "allow",
"entries": [
"Northside"
]
}).json()
step2 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": True,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}).json()
data = httpx.get(f"{api}/v1/mandate/policies/auto_approve", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "list",
"data": [
{
"object": "auto_approve_clause",
"id": "northside-small",
"rule_id": "rul_01M7WC6GD4Z0VNK0QZ2TJ2KPGS",
"policy_version": 1,
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20,
"expires_at": "2027-02-18T11:41:48.323Z",
"status": "active",
"review_due": false,
"paused_at": null,
"pause_reason": null,
"pause_detail": null,
"resumed_at": null,
"usage": {
"window": "week",
"window_start": "2026-11-16T00:00:00.000Z",
"count": 0,
"amount": 0,
"max_count": null,
"max_amount": 2000
},
"last_30_days": {
"approved": 0,
"approved_amount": 0,
"sampled": 0,
"over_limit": 0,
"guarded": 0
}
}
],
"has_more": false,
"next_cursor": null
}List suggested clauses
GET/v1/mandate/policies/suggestions
Lists the auto_approve clauses suggested from your approvals, each with its backtest: groups of at least 20 approvals across 2 weeks or more with none declined (at most 10 open). Dismissed ones are left out unless you ask for them. Pro and above. See automate approvals.
Parameters
statusenumquery- Only suggestions in this state. One of
open,dismissed,shadowed,enabled.
Returns
The suggestions.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/policies/suggestions" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/suggestions`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/policies/suggestions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "list",
"data": [],
"has_more": false,
"next_cursor": null
}List policy versions
GET/v1/mandate/policies/versions
Lists a domain's saved policy versions, newest first, and which is active.
Parameters
draft_groupstringquery- Sandbox. Also list the drafts waiting in this draft group (a rules embed session minted with
rules.draft_group, the live demo's per-visitor drafts). Without it, the groups' unpublished drafts are left out. 1 to 64 characters.
Returns
The policy versions, newest first.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": True
}
}
]
}
}).json()
policy_version = step1["version"]
data = httpx.get(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "list",
"data": [
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"version": 12,
"active": true,
"note": "cap wires at 10k",
"created_by": "key_4648YH0X1181K8YGZQVWNF1Q84",
"created_at": "2026-11-08T18:03:55.245Z",
"source": "api",
"domain": "intent"
},
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"version": 11,
"active": false,
"note": "try in shadow: Northside pay invoice up to 300",
"created_by": "key_196PC31R0085T91904QYG9JS3J",
"created_at": "2026-11-17T14:20:00.425Z",
"domain": "intent"
},
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"version": 10,
"active": false,
"note": "invoices need a person",
"created_by": "key_4648YH0X1181K8YGZQVWNF1Q84",
"created_at": "2026-11-08T18:03:55.231Z",
"source": "api",
"domain": "intent"
},
"… 9 more"
],
"has_more": false,
"next_cursor": null
}List the records a backtest would change
GET/v1/mandate/policies/backtest/{id}/changes
Lists the requests whose outcome differs between the live rules and the version a backtest tested, newest first, each with both outcomes, both rules and its label. POST …/backtest answers with the id; the newest 20 backtests per policy are kept and at most 500 records counted.
Parameters
idstringpathRequired- The backtest's id (
pbt_…), fromPOST …/backtest. limitintegerquery- Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid.
cursorstringquery- Opaque; pass a response's
next_cursorback to get the next page.
Returns
One page of the records that would change.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/mandate/policies/backtest/pbt_01M8WMKZJ4EZ1EWXVEN3N4HE9R/changes" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/backtest/pbt_01M8WMKZJ4EZ1EWXVEN3N4HE9R/changes`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/policies/backtest/pbt_01M8WMKZJ4EZ1EWXVEN3N4HE9R/changes", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "list",
"data": [
{
"id": "cas_01M81CRZ5CX8S238KB791A7JB0",
"kind": "checkout_assessment",
"created_at": "2026-12-01T18:05:02.794Z",
"value_minor": 124000,
"currency": "USD",
"live": "challenge",
"draft": "reject",
"live_rule_id": "first-order-over-500",
"draft_rule_id": "two-risk-signs",
"label": "disputed",
"live_result": "true_positive",
"draft_result": "true_positive"
}
],
"has_more": false,
"next_cursor": null,
"total": 1,
"capped": false,
"policy_version": 13
}Publish a policy
PUT/v1/mandate/policies
Validates a policy document, saves it as the next version and makes it active, returning it as saved. Rule IDs are Provenance's (rul_…): leave id out of a new rule. An approval rule may carry auto_approve clauses (Pro and above), each expiring in 90 days unless it sets expires_at (at most 365); one where a person is always required is refused with auto_approve_not_allowed.
Parameters
documentobjectRequired- A RiskPolicyDocument (claims_risk) or intent PolicyDocument.
Show child attributes
thresholdsobject- Status cutoffs; must satisfy 0 < verified < partial < 100. They never apply to an asset with
signature_invalid,device_revokedordevice_cert_mismatch, which is alwaysfailed.Show child attributes
verifiednumber- Whether it was verified.
partialnumber- How many were partial.
factor_weightsobject- Per-factor point overrides, keyed by risk-factor code (e.g. gps_absent). Each value is CLAMPED to [0, 2×default] at evaluation. Re-weighting a decisive factor (
signature_invalid,device_revoked,device_cert_mismatch) changes the score but not thefailedstatus. rulesarray of objects- Required-signal rules. When a rule's
whenmatches and the required signal is absent, an ADVISORY CARRIER_POLICY_<SIGNAL>_MISSING factor is added (never a hard failure).Show child attributes
idstringRequired- Unique identifier for the object.
labelstring- The rule's name in the builder.
enabledboolean- Whether the rule is on.
falsekeeps it but it fires no signal; absent means on. whenarray of objects | object- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
Show child attributes
factstring- The fact the condition reads (
transaction_amount,order.amount,agent.verified), orfieldto readpathfrom the request. openum- The comparison operator. A field condition takes the comparisons,
in,matches,contains,contains_any,is_emptyandis_not_empty. Every operator except the two null operators fails to match a missing or null fact,neincluded.is_emptymatches a fact that is missing, null, an empty string or an empty list;is_not_emptymatches any other value. valueany- The value to compare with (a string, number, boolean or a list of them).
is_emptyandis_not_emptytaketrue. pathstring- With
fact: field: up to 6 dotted names, each optionally followed by[]for every element of a list (at most one[]), such asmetadata.cost_centerororder.items[].sku. itemsenum- With a path through a list: whether any element (the default) or every element must match. One of
any,all. metricenum- With
fact: velocity: what is counted. One ofverify_count,amount_sum. windowenum- With
fact: velocity: the window.1hand24hare rolling;monthis the calendar month in UTC, counted peraccountoragent. One of1h,24h,month. perenum- With
fact: velocity: what it is counted per.agentis the registered agent the token names (none: 0). One ofdevice,session,account,agent. setstring- With
fact: canaryorprediction: the canary family or probe. best_effortboolean- With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum- With
z_gtorpct_gt: the baseline the score is compared against. One ofagent,account. if_unavailableenum- What an unavailable reading means for this condition:
skip(no match),match, orask(match and ask a person).ignoreis an external risk fact's older word forskip; a capture fact or Trace finding takesskipormatch. One ofskip,match,ask,ignore. matchenum- Whether all, any, none or at least
nof the group's items must match (noneholds when no item does; a condition on a missing fact doesn't hold). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). N-of-M. conditionsarray of objects- The group's conditions and groups (1 to 10).
requireobjectRequired- What a matching action needs.
Show child attributes
signalenum- The signal a matching capture must carry:
gps,biometricorattestation. One ofgps,biometric,attestation.
timezonestring- An IANA time zone, such as
America/Chicago, for a person'stime.local_hourandtime.local_weekdayfacts. tighten_onlyboolean- A person's rules only. A change that only makes the rules stricter saves without a passkey; one that loosens them needs the passkey and is refused for 7 days after a recovery. Turning it off is a loosening.
versioninteger- Informational; the stored version number is assigned on save.
external_confirmationsobject- Which confirmations given outside Provenance count, and whose keys. Empty by default; it also governs your store's cart approvals. Every plan. The issuers listed here are also the ones whose mandates cover a checkout assessment's cart (
checkout.covered: third_party_mandate).Show child attributes
acceptarray of enums- The kinds you accept.
ap2_issuersarray of objects- Required with
ap2_user_mandate: the AP2 issuers whose signatures count. Their mandates also cover a checkout assessment's cart, with or withoutaccept.Show child attributes
namestringRequired- The name shown as "Confirmed in <name>".
jwks_urlstringRequired- The issuer's JWKS (https).
acp_issuersarray of objects- The ACP issuers you trust: a checkout completion whose signed intent (
provenance_intent.token) one of them signed covers a checkout assessment's cart.Show child attributes
namestringRequired- The issuer's name, as
authority.issuershows it. jwks_urlstringRequired- The issuer's JWKS (https).
platformsarray of objects- Required with
platform: the agent platforms whose signed confirmations count.Show child attributes
namestringRequired- The platform's name.
jwks_urlstringRequired- The platform's JWKS (https).
voiceobject- When a confirmation call may approve on the keypad, and when it needs the passkey. Set on your approval policy (
/mandate/policies) or your checkout rules (/authorize/policies). Absent fields take the defaults: approve on the call up to 25.00 USD to a counterparty this person has paid before, and a passkey otherwise. Grants, delegations, new payees and contact or recovery changes always need the passkey, and so does any rule that requires a biometric.Show child attributes
enabledbooleanfalse: a call never approves; it reads the request and sends the passkey link. Defaulttrue.voice_maxinteger- Approve on the call up to this amount, in minor units of
currency. Default 2500 (25.00 USD).0means never. currencystring- The ISO 4217 currency of
voice_max. DefaultUSD. A request in another currency needs the passkey. voice_requires_known_counterpartyboolean- A counterparty this person hasn't paid before needs the passkey. Default
true. never_voice_action_typesarray of strings- Action types (
context.action_type) that always need the passkey.
passkeysobject- On a checkout policy, what a new passkey needs on a cart approval.
signalsarray of objects- Named checks with no outcome (
signal.<key>), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
sig_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed: a later write can't change it.
labelstringRequired- The account's name for the signal; change it at any time.
whenarray of objects | objectRequired- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
Show child attributes
factstring- The fact the condition reads (
transaction_amount,order.amount,agent.verified), orfieldto readpathfrom the request. openum- The comparison operator. A field condition takes the comparisons,
in,matches,contains,contains_any,is_emptyandis_not_empty. Every operator except the two null operators fails to match a missing or null fact,neincluded.is_emptymatches a fact that is missing, null, an empty string or an empty list;is_not_emptymatches any other value. valueany- The value to compare with (a string, number, boolean or a list of them).
is_emptyandis_not_emptytaketrue. pathstring- With
fact: field: up to 6 dotted names, each optionally followed by[]for every element of a list (at most one[]), such asmetadata.cost_centerororder.items[].sku. itemsenum- With a path through a list: whether any element (the default) or every element must match. One of
any,all. metricenum- With
fact: velocity: what is counted. One ofverify_count,amount_sum. windowenum- With
fact: velocity: the window.1hand24hare rolling;monthis the calendar month in UTC, counted peraccountoragent. One of1h,24h,month. perenum- With
fact: velocity: what it is counted per.agentis the registered agent the token names (none: 0). One ofdevice,session,account,agent. setstring- With
fact: canaryorprediction: the canary family or probe. best_effortboolean- With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum- With
z_gtorpct_gt: the baseline the score is compared against. One ofagent,account. if_unavailableenum- What an unavailable reading means for this condition:
skip(no match),match, orask(match and ask a person).ignoreis an external risk fact's older word forskip; a capture fact or Trace finding takesskipormatch. One ofskip,match,ask,ignore. matchenum- Whether all, any, none or at least
nof the group's items must match (noneholds when no item does; a condition on a missing fact doesn't hold). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). N-of-M. conditionsarray of objects- The group's conditions and groups (1 to 10).
scorecardsarray of objects- Scorecards (
scorecard.<key>.score,scorecard.<key>.matched), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
scd_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed.
labelstringRequired- The account's name for the scorecard; change it at any time.
rowsarray of objectsRequired- The rows. Each reads a signal or its own
when.Show child attributes
signalstring- A signal's key in this document (one of
signalandwhen). whenarray of objects | object- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
pointsintegerRequired- Points the row adds when it matches.
labelstring- The row's name.
min_availableinteger- How many rows must be readable for the total to be available (default: all rows but one).
groupsarray of objects- Rule groups (
group.<key>.outcome), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
grp_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed.
labelstringRequired- The account's name for the group; change it at any time.
flowsarray of objects- The sub-flows this rule set calls (checkout and agent rules). Rules read
flow.<key>.outcome,flow.<key>.versionand each declared outputflow.<key>.<output>, or take the flow's outcome withrequire.flow.Show child attributes
keystringRequired- The sub-flow's key.
followenumlatest(the default) follows the published version;pinnedkeepsversion. One oflatest,pinned.versioninteger- The pinned version (only with
followset topinned).
settingsobject- How unavailable facts and fact resolution work for every rule of the document.
Show child attributes
if_unavailableenum- What an unavailable fact means for every rule:
skip(the condition doesn't match),match(it matches) orask(it matches and a person is asked instead of the rule's outcome; refused on issuer rules). The olderfail_closedandfail_openstay Trace and agent rules' words for an unavailable Trace finding. One ofskip,match,ask,fail_closed,fail_open. preflightboolean- Trace rules only: run the rules on model output on the prompt first, before generation.
resolveenumneeded(default) reads only the facts the deciding rule still needs;aheadalso reads the same cost tier of later rules, one round sooner. One ofneeded,ahead.
fallbackobject- The built-in fallback rows' outcomes, by row: what happens when no rule decides. A store's checkout rules have
covered(a cart a token or mandate covers; Approve by default),uncovered(Challenge) andafter_approval(an approved cart; Approve), eachapprove,challengeorreject(approve,revieworrejectafter approval). Capture rules havepasses(Approve) andflagged(Review), eachapprove,revieworreject. Agent policies haveassess(an action no rule decides; Approve by default),approve,review(ask a person) orreject. The rows always run last and are never deleted; a row left out keeps its built-in outcome.
notestring- A note for the record.
Returns
The new policy version. See the policy version object.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}'
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": True
}
}
]
}
}).json()Response 201
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"domain": "intent",
"version": 4,
"active": true,
"note": "cap wires at 10k",
"created_at": "2026-11-17T14:20:00.092Z",
"document": {
"rules": [
{
"id": "rul_01M7MY20PWTEKQRPRKPG8ZHQRE",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
},
"label": "Wires over 10k denied"
}
]
}
}Reset to the default policy
DELETE/v1/mandate/policies
Returns a domain to the built-in default. Saved versions are kept.
Parameters
No parameters.
Returns
The default policy, now active.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.delete(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy",
"id": null,
"domain": "intent",
"document": {
"version": 0,
"rules": [
{
"id": "default-require-biometric",
"when": [
{
"fact": "require_biometric",
"op": "eq",
"value": true
}
],
"require": {
"biometric": true
},
"reason": "biometric_required"
},
{
"id": "default-hardware-over-500",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 500
}
],
"require": {
"hardware": true
},
"reason": "hardware_required_above_500"
}
]
},
"version": null,
"is_default": true
}Simulate a policy
POST/v1/mandate/policies/simulate
Evaluates a draft or the active policy against facts you supply and changes nothing. For claims_risk it returns the score, status and factors the claim would get.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentany- Draft to test; omit to use the active policy.
factsobject- The facts the policy evaluates. For claims_risk: claim_type, state, case_type, gps_present, biometric_present and attested. A missing or unrecognized case_type counts as insurance_claim, as it does on attest.
base_signalsobject- claims_risk only — base risk signals to combine before scoring.
orderobject- An order in the cart shape (
order_id, integertotalin minor units,currency,items); itsorder.*facts joinfacts, as on verify. attimestamp- When the preview starts (default now): business hours and escalation times count from it.
requestobject- The request a
fieldcondition reads itspathfrom:payload,context,orderandmetadata, as on verify.
Returns
What the policy would decide. A webhook rule reports would_call_webhook without calling it. A rule with a route adds routing: who gets it now, each step, and the end.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/mandate/policies/simulate" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
},
"facts": {
"action_type": "wire",
"transaction_amount": 12000
}
}'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/simulate`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
},
"facts": {
"action_type": "wire",
"transaction_amount": 12000
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/policies/simulate", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": True
}
}
]
},
"facts": {
"action_type": "wire",
"transaction_amount": 12000
}
}).json()Response 200
{
"object": "policy_simulation",
"domain": "intent",
"allowed": false,
"reason": "policy_denied",
"policy": {
"id": "pol_3D9BF5244EF1898ABFF5897D48",
"version": 0,
"rule": {
"id": "rul_01M7NCA5B5A4RJQXVA80KWDYQ2",
"name": "Wires over 10k denied",
"phase": "assess",
"action": "reject",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire",
"actual": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000,
"actual": 12000
}
]
}
}
}Suggest a clause from an approval
POST/v1/mandate/policies/suggestions
"Always approve this?": a suggestion pre-filled from one request a person in your company approved (its action type, counterparty and agent, its amount as the cap, a weekly limit from that pattern's busiest week), with its backtest. People who approve can do this from the inbox. Pro and above.
Parameters
approval_idstringRequired- The approved request.
Returns
The suggestion (200 with the existing one, refreshed, for the same kind of request).
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/mandate/intents" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"action_description": "Pay invoice INV-2207: $320.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}' > step.json
export INTENT_TOKEN=$(jq -r '.intent_token' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/assessments" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{
\"intent_token\": \"$INTENT_TOKEN\",
\"action_description\": \"Pay invoice INV-2207: \$320.00 to Northside\",
\"context\": {
\"action_type\": \"pay_invoice\",
\"counterparty\": \"Northside\",
\"transaction_amount\": 320
}
}" > step.json
export APPROVAL_ID=$(jq -r '.approval_id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/approvals/$APPROVAL_ID/respond" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "decision": "approve" }' > /dev/null
curl -X POST "$PROVENANCE_API/v1/mandate/policies/suggestions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{ \"approval_id\": \"$APPROVAL_ID\" }"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/intents`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"action_description": "Pay invoice INV-2207: $320.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}),
})).json();
const intentToken = step2.intent_token;
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"intent_token": intentToken,
"action_description": "Pay invoice INV-2207: $320.00 to Northside",
"context": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"transaction_amount": 320
}
}),
})).json();
const approvalId = step3.approval_id;
const step4 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approvals/${approvalId}/respond`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "decision": "approve" }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/suggestions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "approval_id": approvalId }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": True
}
}
]
}
}).json()
step2 = httpx.post(f"{api}/v1/mandate/intents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"action_description": "Pay invoice INV-2207: $320.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}).json()
intent_token = step2["intent_token"]
step3 = httpx.post(f"{api}/v1/mandate/assessments", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"intent_token": intent_token,
"action_description": "Pay invoice INV-2207: $320.00 to Northside",
"context": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"transaction_amount": 320
}
}).json()
approval_id = step3["approval_id"]
step4 = httpx.post(f"{api}/v1/mandate/approvals/{approval_id}/respond", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"decision": "approve"
}).json()
data = httpx.post(f"{api}/v1/mandate/policies/suggestions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"approval_id": approval_id
}).json()Response 201
{
"object": "policy_suggestion",
"id": "psg_01M7MY20YQ6TVRWGZT11AEARN2",
"status": "open",
"source": "inbox",
"rule_id": "rul_01M7MY20Q0W9R1BHSP1CFXRFQ1",
"facts": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"agent_id": null
},
"clause": {
"id": "auto-rul-01m7my20q0w9r1bhsp1cfxrfq1-pay-invoi",
"label": "Northside pay invoice up to 400",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
},
{
"fact": "counterparty",
"op": "eq",
"value": "Northside"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 400
}
],
"limit": {
"window": "week",
"max_amount": 400
},
"sample_rate": 20
},
"backtest": {
"window_days": 90,
"approvals": 1,
"would_skip": 1,
"skip_rate": 1,
"hours_saved": 0,
"would_have_allowed_denied": 0,
"summary": "Would have skipped 1 of 1 approvals (100%) in 90 days, about 0 minutes of waiting; would have allowed 0 requests a person denied."
},
"approvals": 1,
"approval_id": "appr_01M7MY20V8NQYGVKMRSNSG1WYC",
"dismissed_until": null,
"shadow": null,
"applied_version": null,
"created_at": "2026-11-17T14:20:00.343Z",
"updated_at": "2026-11-17T14:20:00.343Z"
}Dismiss a suggestion
POST/v1/mandate/policies/suggestions/{id}/dismiss
Hides the suggestion for 90 days; the nightly job leaves it alone until then.
Parameters
idstringpathRequired- The suggestion's ID.
Returns
The suggestion, dismissed.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/mandate/intents" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}' > step.json
export INTENT_TOKEN=$(jq -r '.intent_token' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/assessments" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{
\"intent_token\": \"$INTENT_TOKEN\",
\"action_description\": \"Pay invoice INV-2208: \$280.00 to Northside\",
\"context\": {
\"action_type\": \"pay_invoice\",
\"counterparty\": \"Northside\",
\"transaction_amount\": 280
}
}" > step.json
export APPROVAL_ID=$(jq -r '.approval_id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/approvals/$APPROVAL_ID/respond" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "decision": "approve" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/suggestions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{ \"approval_id\": \"$APPROVAL_ID\" }" > step.json
export SUGGESTION_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/mandate/policies/suggestions/$SUGGESTION_ID/dismiss" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/intents`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}),
})).json();
const intentToken = step2.intent_token;
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"intent_token": intentToken,
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"context": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"transaction_amount": 280
}
}),
})).json();
const approvalId = step3.approval_id;
const step4 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approvals/${approvalId}/respond`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "decision": "approve" }),
})).json();
const step5 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/suggestions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "approval_id": approvalId }),
})).json();
const suggestionId = step5.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/suggestions/${suggestionId}/dismiss`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": True
}
}
]
}
}).json()
step2 = httpx.post(f"{api}/v1/mandate/intents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}).json()
intent_token = step2["intent_token"]
step3 = httpx.post(f"{api}/v1/mandate/assessments", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"intent_token": intent_token,
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"context": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"transaction_amount": 280
}
}).json()
approval_id = step3["approval_id"]
step4 = httpx.post(f"{api}/v1/mandate/approvals/{approval_id}/respond", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"decision": "approve"
}).json()
step5 = httpx.post(f"{api}/v1/mandate/policies/suggestions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"approval_id": approval_id
}).json()
suggestion_id = step5["id"]
data = httpx.post(f"{api}/v1/mandate/policies/suggestions/{suggestion_id}/dismiss", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_suggestion",
"id": "psg_01M89Z9WKNRGZ1B6P3A0ZZA0EJ",
"status": "dismissed",
"source": "inbox",
"rule_id": "rul_01M89Z9WJBGRAN377ARE0T6Z24",
"facts": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"agent_id": null
},
"clause": {
"id": "auto-rul-01m89z9wjbgran377are0t6z24-pay-invoi",
"label": "Northside pay invoice up to 300",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
},
{
"fact": "counterparty",
"op": "eq",
"value": "Northside"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 300
}
],
"limit": {
"window": "week",
"max_amount": 300
},
"sample_rate": 20
},
"backtest": {
"window_days": 90,
"approvals": 1,
"would_skip": 1,
"skip_rate": 1,
"hours_saved": 0,
"would_have_allowed_denied": 0,
"summary": "Would have skipped 1 of 1 approvals (100%) in 90 days, about 0 minutes of waiting; would have allowed 0 requests a person denied."
},
"approvals": 1,
"approval_id": "appr_01M89Z9WKA5KFSPRG5H7Z9KF04",
"dismissed_until": "2027-02-23T18:25:49.688Z",
"shadow": null,
"applied_version": null,
"created_at": "2026-11-25T18:25:49.681Z",
"updated_at": "2026-11-25T18:25:49.688Z"
}Try a suggestion in shadow, or turn it on
POST/v1/mandate/policies/suggestions/{id}/apply
Puts the clause (or your edited clause) on its rule. shadow runs it as the shadow policy for 7 days (verifies record shadow_reason: auto_approved, nothing is approved); enforce publishes it as the active version. People who approve but don't edit policy can propose: the change is held for an owner or admin. Pro and above.
Parameters
idstringpathRequired- The suggestion's ID.
modeenumRequired- Try it in shadow, or turn it on. One of
shadow,enforce. clauseobject- An edited clause (
id,label,when,limit,sample_rate,expires_at).
Returns
The suggestion, shadowed or enabled.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/mandate/intents" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}' > step.json
export INTENT_TOKEN=$(jq -r '.intent_token' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/assessments" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{
\"intent_token\": \"$INTENT_TOKEN\",
\"action_description\": \"Pay invoice INV-2208: \$280.00 to Northside\",
\"context\": {
\"action_type\": \"pay_invoice\",
\"counterparty\": \"Northside\",
\"transaction_amount\": 280
}
}" > step.json
export APPROVAL_ID=$(jq -r '.approval_id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/approvals/$APPROVAL_ID/respond" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "decision": "approve" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/suggestions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d "{ \"approval_id\": \"$APPROVAL_ID\" }" > step.json
export SUGGESTION_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/mandate/policies/suggestions/$SUGGESTION_ID/apply" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "mode": "shadow" }'
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies/versions/1/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/intents`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}),
})).json();
const intentToken = step2.intent_token;
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"intent_token": intentToken,
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"context": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"transaction_amount": 280
}
}),
})).json();
const approvalId = step3.approval_id;
const step4 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/approvals/${approvalId}/respond`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "decision": "approve" }),
})).json();
const step5 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/suggestions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "approval_id": approvalId }),
})).json();
const suggestionId = step5.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/suggestions/${suggestionId}/apply`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "mode": "shadow" }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "invoices need a person",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": True
}
}
]
}
}).json()
step2 = httpx.post(f"{api}/v1/mandate/intents", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"agent_session_id": "sess_payables_1",
"device_id": "dev_00000000000000000000000000000001"
}).json()
intent_token = step2["intent_token"]
step3 = httpx.post(f"{api}/v1/mandate/assessments", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"intent_token": intent_token,
"action_description": "Pay invoice INV-2208: $280.00 to Northside",
"context": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"transaction_amount": 280
}
}).json()
approval_id = step3["approval_id"]
step4 = httpx.post(f"{api}/v1/mandate/approvals/{approval_id}/respond", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"decision": "approve"
}).json()
step5 = httpx.post(f"{api}/v1/mandate/policies/suggestions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"approval_id": approval_id
}).json()
suggestion_id = step5["id"]
data = httpx.post(f"{api}/v1/mandate/policies/suggestions/{suggestion_id}/apply", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"mode": "shadow"
}).json()Response 200
{
"object": "policy_suggestion",
"id": "psg_01M89Z9WKNRGZ1B6P3A0ZZA0EJ",
"status": "shadowed",
"source": "inbox",
"rule_id": "rul_01M89Z9WJBGRAN377ARE0T6Z24",
"facts": {
"action_type": "pay_invoice",
"counterparty": "Northside",
"agent_id": null
},
"clause": {
"id": "auto-rul-01m89z9wjbgran377are0t6z24-pay-invoi",
"label": "Northside pay invoice up to 300",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
},
{
"fact": "counterparty",
"op": "eq",
"value": "Northside"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 300
}
],
"limit": {
"window": "week",
"max_amount": 750
},
"sample_rate": 20
},
"backtest": {
"window_days": 90,
"approvals": 2,
"would_skip": 2,
"skip_rate": 1,
"hours_saved": 0,
"would_have_allowed_denied": 0,
"summary": "Would have skipped 2 of 2 approvals (100%) in 90 days, about 0 minutes of waiting; would have allowed 0 requests a person denied."
},
"approvals": 2,
"approval_id": "appr_01M89Z9WKWX9D0Y5G6NBFFSYF8",
"dismissed_until": "2027-02-23T18:25:49.688Z",
"shadow": {
"version": 4,
"until": "2026-12-02T18:25:49.697Z",
"would_have_auto_approved": 0
},
"applied_version": null,
"created_at": "2026-11-25T18:25:49.681Z",
"updated_at": "2026-11-25T18:25:49.697Z"
}Backtest a clause
POST/v1/mandate/policies/auto_approve/preview
Replays a clause on one of your approval rules over its last 90 days of requests. Nothing is saved.
Parameters
rule_idstringRequired- The approval rule.
clauseobjectRequired- The clause (
id,label,when,limit,sample_rate).
Returns
The backtest.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PATCH "$PROVENANCE_API/v1/account/policies/lists/auto_payees" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "kind": "allow", "entries": ["Northside"] }' > /dev/null
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}' > /dev/null
curl -X POST "$PROVENANCE_API/v1/mandate/policies/auto_approve/preview" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"rule_id": "invoices",
"clause": {
"id": "northside-under-300",
"label": "Northside invoices under 300",
"when": [
{
"fact": "counterparty",
"op": "eq",
"value": "Northside"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 300
}
],
"limit": {
"window": "week",
"max_amount": 1500
}
}
}'
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/auto_payees`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "kind": "allow", "entries": ["Northside"] }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/auto_approve/preview`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"rule_id": "invoices",
"clause": {
"id": "northside-under-300",
"label": "Northside invoices under 300",
"when": [
{
"fact": "counterparty",
"op": "eq",
"value": "Northside"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 300
}
],
"limit": {
"window": "week",
"max_amount": 1500
}
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.patch(f"{api}/v1/account/policies/lists/auto_payees", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"kind": "allow",
"entries": [
"Northside"
]
}).json()
step2 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": True,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}).json()
data = httpx.post(f"{api}/v1/mandate/policies/auto_approve/preview", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"rule_id": "invoices",
"clause": {
"id": "northside-under-300",
"label": "Northside invoices under 300",
"when": [
{
"fact": "counterparty",
"op": "eq",
"value": "Northside"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 300
}
],
"limit": {
"window": "week",
"max_amount": 1500
}
}
}).json()Response 200
{
"object": "auto_approve_preview",
"rule_id": "rul_01M89Z9WJBGRAN377ARE0T6Z24",
"clause": {
"id": "northside-under-300",
"label": "Northside invoices under 300",
"when": [
{
"fact": "counterparty",
"op": "eq",
"value": "Northside"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 300
}
],
"limit": {
"window": "week",
"max_amount": 1500
}
},
"window_days": 90,
"approvals": 0,
"would_skip": 0,
"skip_rate": 0,
"hours_saved": 0,
"would_have_allowed_denied": 0,
"summary": "Would have skipped 0 of 0 approvals (0%) in 90 days, about 0 minutes of waiting; would have allowed 0 requests a person denied."
}Turn a paused clause back on
POST/v1/mandate/policies/auto_approve/{id}/resume
Turns a paused auto_approve clause back on and clears its limit streak. A clause pauses itself when a person denies or asks for changes on a request it would have covered, when it reaches its limit three windows in a row, or when a merchant reports an action it approved. Ledgered. In live mode, a developer's request is held for an owner or admin.
Parameters
idstringpathRequired- The clause's ID.
Returns
The clause, on again (unchanged when it wasn't paused).
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PATCH "$PROVENANCE_API/v1/account/policies/lists/auto_payees" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "kind": "allow", "entries": ["Northside"] }' > /dev/null
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}' > /dev/null
curl -X POST "$PROVENANCE_API/v1/mandate/policies/auto_approve/northside-small/resume" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/auto_payees`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "kind": "allow", "entries": ["Northside"] }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": true,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/auto_approve/northside-small/resume`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.patch(f"{api}/v1/account/policies/lists/auto_payees", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"kind": "allow",
"entries": [
"Northside"
]
}).json()
step2 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "automate Northside invoices",
"document": {
"rules": [
{
"id": "invoices",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "pay_invoice"
}
],
"require": {
"approval": True,
"auto_approve": [
{
"id": "northside-small",
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20
}
]
}
}
]
}
}).json()
data = httpx.post(f"{api}/v1/mandate/policies/auto_approve/northside-small/resume", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "auto_approve_clause",
"id": "northside-small",
"rule_id": "rul_01M7WC6JTP47G4397QGVK4VZHD",
"policy_version": 1,
"label": "Northside invoices under $500",
"when": [
{
"fact": "counterparty",
"op": "in_list",
"value": "auto_payees"
},
{
"fact": "transaction_amount",
"op": "lte",
"value": 500
}
],
"limit": {
"window": "week",
"max_amount": 2000
},
"sample_rate": 20,
"expires_at": "2027-02-18T11:41:50.806Z",
"status": "active",
"review_due": false,
"paused_at": null,
"pause_reason": null,
"pause_detail": null,
"resumed_at": null,
"usage": {
"window": "week",
"window_start": "2026-11-16T00:00:00.000Z",
"count": 0,
"amount": 0,
"max_count": null,
"max_amount": 2000
},
"last_30_days": {
"approved": 0,
"approved_amount": 0,
"sampled": 0,
"over_limit": 0,
"guarded": 0
}
}Review a policy version's changes
GET/v1/mandate/policies/versions/{version}/diff
Compares a version with the live one (or with against, another version) rule by rule, in plain sentences: each added, removed, changed or moved rule, with what changed in it.
Parameters
versionintegerpathRequired- The version number.
againststringqueryactive(the default) or another version number to compare with.
Returns
The changes.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/diff" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/diff`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": True,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}).json()
policy_version = step1["version"]
data = httpx.get(f"{api}/v1/mandate/policies/versions/{policy_version}/diff", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_diff",
"domain": "intent",
"version": 1,
"against": null,
"changes": [
{
"rule_id": "rul_01M8D8YP4CRNSD8G0WFACNWDJB",
"label": "Orders over $10,000",
"change": "added",
"parts": [],
"before": null,
"after": "If amount is over 10,000, then approve and notify Admins"
},
{
"rule_id": "rul_01M8D8YP4CJ8Z35W7Y70CXST05",
"label": "Orders over $5,000",
"change": "added",
"parts": [],
"before": null,
"after": "If all of: Amount is over 5,000; and any of (Action type is wire or Metadata.cost_center is research), then review. Step 1: Admins (any one); if not done in 2 hr, go to step 2. Step 2: Owner (any one); if not done in 1 day, use the account default"
},
{
"rule_id": "default-require-biometric",
"label": null,
"change": "removed",
"parts": [],
"before": "If face or fingerprint asked for is true, then require face, fingerprint or passkey from the person",
"after": null
},
{
"rule_id": "default-hardware-over-500",
"label": null,
"change": "removed",
"parts": [],
"before": "If amount is over 500, then require a hardware-backed phone",
"after": null
}
]
}Publish a policy version
POST/v1/mandate/policies/versions/{version}/publish
Makes a draft the live agent policy now. With trial_days (1 to 30, Pro and above) it runs silently next to the live version first; promote it from the trial run.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
versionintegerpathRequired- The version number.
trial_daysinteger- Run the draft silently next to the live version for this many days instead of publishing now.
acknowledge_rate_changeboolean- Publish although this version's latest backtest moves Challenge plus Reject by more than 5 points against the live version. Without it that publish answers 409
policy_rate_change_unacknowledgedwith the change.
Returns
The live version, or the trial run when trial_days is set.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl -X POST "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": True,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}).json()
policy_version = step1["version"]
data = httpx.post(f"{api}/v1/mandate/policies/versions/{policy_version}/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"version": 20,
"active": true,
"note": "big orders go to admins, then the owner",
"created_by": "key_4648YH0X1181K8YGZQVWNF1Q84",
"created_at": "2026-11-08T18:05:02.779Z",
"source": "api",
"domain": "intent"
}Export policy versions
GET/v1/mandate/policies/versions/export
Returns every version with its document, for your own records. Available on the Enterprise plan.
Parameters
No parameters.
Returns
Every version.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/mandate/policies/versions/export" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/export`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/mandate/policies/versions/export", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_version_export",
"domain": "intent",
"exported_at": "2026-11-08T18:05:02.785Z",
"versions": []
}Backtest a policy
POST/v1/mandate/policies/backtest
Pro plan and above (402 plan_required below it). Replays a draft (or the live document) over the last days (default 30) of your own requests and says how often each rule would have matched and decided, such as Last 30 days: would have asked 14 times, about 3 a week. Field conditions aren't replayed.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentobject- A policy document: ordered rules, in one format for an agent policy, a store's checkout rules and a person's own rules.
Show child attributes
rulesarray of objectsRequired- The rules, in order (at most 50; up to 200 on Enterprise).
Show child attributes
idstring- The rule's ID, set by Provenance:
rul_and a ULID, given when the rule is first saved and kept in every later version while the rule exists; a default row has a fixedrul_default_…ID, the same in every account. Leave it out of a new rule, and send a saved rule back with its ID to keep it. Arul_ID the policy never had is replaced with a new one. Any other value is kept aslegacy_idand names the same rule when sent again. Therul_default_prefix is reserved for the default rows (400 policy_invalid). A person's own rules and the risk policies keep their IDs as written. Always present on a read. refstring- Set by Provenance: the rule's short display ID (
R-103, orR-04outside checkout), shown beside the rule in the console and on every decision aspolicy.rule.ref. Kept across versions and never reused in the policy. What you send here is ignored. legacy_idstring- Set by Provenance: the ID the rule had before rule IDs were set by Provenance (November 2026), or the value it was first written with. A decision recorded with that ID still finds the rule. What you send here is ignored.
groupstring- The rule group (
groups[].key) this rule belongs to. It still runs in order as an ordinary rule. labelstring- The rule's name, such as
Orders over $500. Evaluation never reads it. whenarray of objects | objectRequired- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
Show child attributes
factstring- The fact the condition reads (
transaction_amount,order.amount,agent.verified), orfieldto readpathfrom the request. openum- The comparison operator. A field condition takes the comparisons,
in,matches,contains,contains_any,is_emptyandis_not_empty. Every operator except the two null operators fails to match a missing or null fact,neincluded.is_emptymatches a fact that is missing, null, an empty string or an empty list;is_not_emptymatches any other value. valueany- The value to compare with (a string, number, boolean or a list of them).
is_emptyandis_not_emptytaketrue. pathstring- With
fact: field: up to 6 dotted names, each optionally followed by[]for every element of a list (at most one[]), such asmetadata.cost_centerororder.items[].sku. itemsenum- With a path through a list: whether any element (the default) or every element must match. One of
any,all. metricenum- With
fact: velocity: what is counted. One ofverify_count,amount_sum. windowenum- With
fact: velocity: the window.1hand24hare rolling;monthis the calendar month in UTC, counted peraccountoragent. One of1h,24h,month. perenum- With
fact: velocity: what it is counted per.agentis the registered agent the token names (none: 0). One ofdevice,session,account,agent. setstring- With
fact: canaryorprediction: the canary family or probe. best_effortboolean- With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum- With
z_gtorpct_gt: the baseline the score is compared against. One ofagent,account. if_unavailableenum- What an unavailable reading means for this condition:
skip(no match),match, orask(match and ask a person).ignoreis an external risk fact's older word forskip; a capture fact or Trace finding takesskipormatch. One ofskip,match,ask,ignore. matchenum- Whether all, any, none or at least
nof the group's items must match (noneholds when no item does; a condition on a missing fact doesn't hold). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). N-of-M. conditionsarray of objects- The group's conditions and groups (1 to 10).
requireobjectRequired- A rule's THEN part:
denyblocks,approvalasks a person,biometric,hardwareormin_tierask for stronger proof,webhookasks your webhook, andnotify(alone) allows and notifies. On your checkout and card issuer rules,no_challenge(alone) approves (Capture and Trace rules sayfrictionless), and on an after-approval rulereview(alone) holds the order for your review.Show child attributes
reviewenum- Checkout rules with
phase: after_approvalonly, set alone: Review. The customer approved, and the order waits for your decision (status: in_review, no token yet) until you approve or reject it, or it times out. One oftrue. no_challengeenum- Checkout rules (
/v1/authorize/policies) and card issuer rules, set alone: Approve. When the rule matches, the cart is approved (allow, reasonpolicy_rule_approved) and no later rule runs, whether or not a token, mandate or earlier approval covers it. A cart nothing covers gets no token. A write may also sendfrictionless. One oftrue. frictionlessenum- Capture and Trace rules, set alone: Approve (Allow). On checkout and card issuer rules, an older word for
no_challenge, still accepted on a write. When a checkout rule matches, the cart is approved (allow, reasonpolicy_rule_approved) and no later rule runs, whether or not a token, mandate or earlier approval covers it. A cart nothing covers gets no token. One oftrue. ucp_fallbackenum- Checkout rules only, with
approval: truebefore approval: what a Universal Commerce Protocol checkout does when the platform didn't negotiate the approval Action.escalate(the default) hands the checkout to your checkout page;hold_after_orderopens the approval and you hold the order until it is approved. One ofescalate,hold_after_order. denyboolean- Block the request; the rule's
reasonis what the agent sees. lockenum | object- Trace rules only, with
denyorapproval: lock the agent session (trueorscope: session), the registered agent (agent) or the run (run) until a person clears it;revoke_sessionalso revokes the session's intent tokens.Show child attributes
scopeenum- What the lock names. One of
session,agent,run. revoke_sessionenum- Also revoke the session's intent tokens. One of
true.
suspend_agentenum- Trace rules only, with
deny: suspend the registered agent. One oftrue. sample_rateinteger- Spot checks, on a Reject rule (
deny) of checkout, agent, capture or Trace rules (Trace at phaseactiononly): 1 in N of the records it would reject is asked about instead (Challenge; a capture shot goes to In review, a Trace action to Review), chosen from the record id. Card issuer rules and Trace rules at phasecompletionrefuse it: nobody can answer in time. Off unless set. flowstring- Checkout and agent rules: the rule takes this sub-flow's outcome as its own (a key in the document's
flows). The flow'snonepasses to the next rule. Takes no other requirement. approvalboolean- Ask a person to approve.
approversinteger- How many distinct approvers are needed, for a route without
steps. routeobject- Who approves a rule's request and how long it waits: either a chain of
steps, or a first target withescalateandwait.Show child attributes
tostring- The first target. With
stepsit is the first step's first target and may be left out. stepsarray of objects- An approval chain of 1 to 5 steps, in order. The chain waits the sum of its steps'
after(1 minute to 7 days); then the rule'sif_unansweredapplies, else the account's approval expiry default. A chain leaves outescalate,waitandapprovers. approvers_fromenum- How approvals count toward the number needed. One of
any,distinct_people. escalatearray of objects- Escalation steps, for a route without
steps. waitstring- How long the request waits in all, for a route without
steps. if_unansweredenum- What happens when nobody answers. Left out, the account's approval expiry default applies. One of
expire,decline,approve_below. approve_below_amountnumber- With
approve_below: the amount it approves at or under. hoursstring- The approver group (
agr_…) whose business hours apply. outside_hoursenum- What happens to a request outside business hours. One of
hold,escalate. assignenum- Who gets it first. A chain uses
all. One ofall,round_robin,least_pending.
biometricboolean- Require face, fingerprint or passkey from the person.
hardwareboolean- Require a hardware-backed phone.
min_tierenum- The weakest device tier allowed. One of
simulated,software,tee,strongbox,sep. webhookstring- The name of the policy webhook to ask.
notifyobject- "Approve and notify": the rule allows the request and tells the people named, the account's webhook endpoints, or both. It never decides, so evaluation goes on to the next rule. A notify rule's
requireholdsnotifyalone.Show child attributes
toarray of strings- People, groups or roles to tell (1 to 10 route targets, such as
role:adminsoruser:owner). webhookboolean- Also send the
mandate.policy.notifiedevent to the account's webhook endpoints.
approval_min_credential_age_sinteger- With
approval: how old the approving passkey must be, in seconds. approval_methodenum- With
approval: only the approver's phone in the Provenance app approves. One ofdevice_key. individualboolean- With
approval: the request is never approved in a batch. auto_approvearray of objects- Clauses under which the approval counts as given without a person.
reasonstring- The reason code a matching rule reports. On a person's rules:
store_not_allowedon a block, orask_aboveoroutside_hourson an ask (the codes the rules moved from Your rules keep), else none (person_rule). on_requestenum- A person's rules only: what the rule does to a company's approval request sent to the person, when it matches.
holdkeeps the request in the person's home and sends nothing;deferdelivers it like quiet hours. Absent: the rule leaves companies' requests alone. Such a rule reads only the store and the time. One ofhold,defer. phaseenum- Trace rules:
action(absent; before a tool runs) orcompletion(on model output). Your checkout rules: when the rule runs.assess(absent) runs atPOST /v1/authorize/checkout_assessments;after_approvalruns once the customer has decided a cart approval and before the token is minted, over the assessment's facts and theapproval.*facts (approval.decision,approval.location, …). After-approval rules approve (frictionless; checkout rules sayno_challenge), review (review) or reject (deny); they never challenge. Every plan. One ofassess,after_approval,action,completion. enabledboolean- Whether the rule is on; absent means on.
falsekeeps the rule in the document (and its versions) but skips it: it never matches, decides, notifies or counts in a backtest. Turning a rule off or on is a change like any other (a new draft or version); on a person's tighten-only rules, turning one off loosens them. if_unavailableenum- What an unavailable fact means for this rule, over the document's
settings.if_unavailable(a condition's own setting wins).fail_closedandfail_openstay Trace and agent rules' words. One ofskip,match,ask,fail_closed,fail_open.
timezonestring- An IANA time zone, such as
America/Chicago, for a person'stime.local_hourandtime.local_weekdayfacts. tighten_onlyboolean- A person's rules only. A change that only makes the rules stricter saves without a passkey; one that loosens them needs the passkey and is refused for 7 days after a recovery. Turning it off is a loosening.
versioninteger- Informational; the stored version number is assigned on save.
external_confirmationsobject- Which confirmations given outside Provenance count, and whose keys. Empty by default; it also governs your store's cart approvals. Every plan. The issuers listed here are also the ones whose mandates cover a checkout assessment's cart (
checkout.covered: third_party_mandate).Show child attributes
acceptarray of enums- The kinds you accept.
ap2_issuersarray of objects- Required with
ap2_user_mandate: the AP2 issuers whose signatures count. Their mandates also cover a checkout assessment's cart, with or withoutaccept.Show child attributes
namestringRequired- The name shown as "Confirmed in <name>".
jwks_urlstringRequired- The issuer's JWKS (https).
acp_issuersarray of objects- The ACP issuers you trust: a checkout completion whose signed intent (
provenance_intent.token) one of them signed covers a checkout assessment's cart.Show child attributes
namestringRequired- The issuer's name, as
authority.issuershows it. jwks_urlstringRequired- The issuer's JWKS (https).
platformsarray of objects- Required with
platform: the agent platforms whose signed confirmations count.Show child attributes
namestringRequired- The platform's name.
jwks_urlstringRequired- The platform's JWKS (https).
voiceobject- When a confirmation call may approve on the keypad, and when it needs the passkey. Set on your approval policy (
/mandate/policies) or your checkout rules (/authorize/policies). Absent fields take the defaults: approve on the call up to 25.00 USD to a counterparty this person has paid before, and a passkey otherwise. Grants, delegations, new payees and contact or recovery changes always need the passkey, and so does any rule that requires a biometric.Show child attributes
enabledbooleanfalse: a call never approves; it reads the request and sends the passkey link. Defaulttrue.voice_maxinteger- Approve on the call up to this amount, in minor units of
currency. Default 2500 (25.00 USD).0means never. currencystring- The ISO 4217 currency of
voice_max. DefaultUSD. A request in another currency needs the passkey. voice_requires_known_counterpartyboolean- A counterparty this person hasn't paid before needs the passkey. Default
true. never_voice_action_typesarray of strings- Action types (
context.action_type) that always need the passkey.
passkeysobject- On a checkout policy, what a new passkey needs on a cart approval.
signalsarray of objects- Named checks with no outcome (
signal.<key>), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
sig_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed: a later write can't change it.
labelstringRequired- The account's name for the signal; change it at any time.
whenarray of objects | objectRequired- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
Show child attributes
factstring- The fact the condition reads (
transaction_amount,order.amount,agent.verified), orfieldto readpathfrom the request. openum- The comparison operator. A field condition takes the comparisons,
in,matches,contains,contains_any,is_emptyandis_not_empty. Every operator except the two null operators fails to match a missing or null fact,neincluded.is_emptymatches a fact that is missing, null, an empty string or an empty list;is_not_emptymatches any other value. valueany- The value to compare with (a string, number, boolean or a list of them).
is_emptyandis_not_emptytaketrue. pathstring- With
fact: field: up to 6 dotted names, each optionally followed by[]for every element of a list (at most one[]), such asmetadata.cost_centerororder.items[].sku. itemsenum- With a path through a list: whether any element (the default) or every element must match. One of
any,all. metricenum- With
fact: velocity: what is counted. One ofverify_count,amount_sum. windowenum- With
fact: velocity: the window.1hand24hare rolling;monthis the calendar month in UTC, counted peraccountoragent. One of1h,24h,month. perenum- With
fact: velocity: what it is counted per.agentis the registered agent the token names (none: 0). One ofdevice,session,account,agent. setstring- With
fact: canaryorprediction: the canary family or probe. best_effortboolean- With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum- With
z_gtorpct_gt: the baseline the score is compared against. One ofagent,account. if_unavailableenum- What an unavailable reading means for this condition:
skip(no match),match, orask(match and ask a person).ignoreis an external risk fact's older word forskip; a capture fact or Trace finding takesskipormatch. One ofskip,match,ask,ignore. matchenum- Whether all, any, none or at least
nof the group's items must match (noneholds when no item does; a condition on a missing fact doesn't hold). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). N-of-M. conditionsarray of objects- The group's conditions and groups (1 to 10).
scorecardsarray of objects- Scorecards (
scorecard.<key>.score,scorecard.<key>.matched), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
scd_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed.
labelstringRequired- The account's name for the scorecard; change it at any time.
rowsarray of objectsRequired- The rows. Each reads a signal or its own
when.Show child attributes
signalstring- A signal's key in this document (one of
signalandwhen). whenarray of objects | object- A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum- Whether all, any, none or at least
nof the items must match (noneholds when no item does). One ofall,any,none,at_least. ninteger- With
match: at_least: how many items must match (1 to the item count). itemsarray of objects- Conditions and groups (at most 10).
pointsintegerRequired- Points the row adds when it matches.
labelstring- The row's name.
min_availableinteger- How many rows must be readable for the total to be available (default: all rows but one).
groupsarray of objects- Rule groups (
group.<key>.outcome), for checkout, agent, capture, Trace and card issuer rules.Show child attributes
idstring- The server's id (
grp_and a ULID), kept across versions. keystring- The fact's name part. Derived from the first label when left out, then fixed.
labelstringRequired- The account's name for the group; change it at any time.
flowsarray of objects- The sub-flows this rule set calls (checkout and agent rules). Rules read
flow.<key>.outcome,flow.<key>.versionand each declared outputflow.<key>.<output>, or take the flow's outcome withrequire.flow.Show child attributes
keystringRequired- The sub-flow's key.
followenumlatest(the default) follows the published version;pinnedkeepsversion. One oflatest,pinned.versioninteger- The pinned version (only with
followset topinned).
settingsobject- How unavailable facts and fact resolution work for every rule of the document.
Show child attributes
if_unavailableenum- What an unavailable fact means for every rule:
skip(the condition doesn't match),match(it matches) orask(it matches and a person is asked instead of the rule's outcome; refused on issuer rules). The olderfail_closedandfail_openstay Trace and agent rules' words for an unavailable Trace finding. One ofskip,match,ask,fail_closed,fail_open. preflightboolean- Trace rules only: run the rules on model output on the prompt first, before generation.
resolveenumneeded(default) reads only the facts the deciding rule still needs;aheadalso reads the same cost tier of later rules, one round sooner. One ofneeded,ahead.
fallbackobject- The built-in fallback rows' outcomes, by row: what happens when no rule decides. A store's checkout rules have
covered(a cart a token or mandate covers; Approve by default),uncovered(Challenge) andafter_approval(an approved cart; Approve), eachapprove,challengeorreject(approve,revieworrejectafter approval). Capture rules havepasses(Approve) andflagged(Review), eachapprove,revieworreject. Agent policies haveassess(an action no rule decides; Approve by default),approve,review(ask a person) orreject. The rows always run last and are never deleted; a row left out keeps its built-in outcome.
versioninteger- Replay a saved version instead of
document(send one or the other). Where the backtest is kept, it becomes that version's test at publish. daysinteger- How many days to replay (default 30).
Returns
How the document would have decided.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/mandate/policies/backtest" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"document": {
"rules": [
{
"id": "wires-need-a-person",
"label": "Wires",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
}
],
"require": {
"approval": true
}
}
]
},
"days": 30
}'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/backtest`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"document": {
"rules": [
{
"id": "wires-need-a-person",
"label": "Wires",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
}
],
"require": {
"approval": true
}
}
]
},
"days": 30
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/mandate/policies/backtest", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"document": {
"rules": [
{
"id": "wires-need-a-person",
"label": "Wires",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
}
],
"require": {
"approval": True
}
}
]
},
"days": 30
}).json()Response 200
{
"object": "policy_backtest",
"days": 30,
"from": "2026-10-29T10:49:28.114Z",
"to": "2026-11-28T10:49:28.114Z",
"available": true,
"requests": 12,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 9,
"challenged": 3,
"rejected": 0
},
"amounts": {
"fact": "transaction_amount",
"allowed": [
{
"currency": null,
"amount": 880
}
],
"challenged": [],
"rejected": [],
"unsummed": 9
},
"rules": [
{
"rule_id": "wires-need-a-person",
"label": "Wires",
"outcome": "ask",
"matched": 3,
"decided": 3,
"per_week": 0.7,
"amounts": [],
"summary": "Last 30 days: would have reviewed 3 times, about 3 a month"
}
]
}Stop the trial run
DELETE/v1/mandate/policies/trial
Stops the trial run. The draft stays in the history and can be published or tried again.
Parameters
No parameters.
Returns
No trial run.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "trial_days": 7 }' > /dev/null
curl -X DELETE "$PROVENANCE_API/v1/mandate/policies/trial" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "trial_days": 7 }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/trial`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": True,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}).json()
policy_version = step1["version"]
step2 = httpx.post(f"{api}/v1/mandate/policies/versions/{policy_version}/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"trial_days": 7
}).json()
data = httpx.delete(f"{api}/v1/mandate/policies/trial", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_trial",
"domain": "intent",
"active": false,
"version": null
}Promote the trial run
POST/v1/mandate/policies/trial/promote
Publishes the draft on trial and ends the trial run. Answers 409 policy_trial_not_active when no trial run is going on.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
Returns
The new live version, with promoted_from_trial. See the policy version object.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "trial_days": 7 }' > /dev/null
curl -X POST "$PROVENANCE_API/v1/mandate/policies/trial/promote" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": true,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "trial_days": 7 }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/trial/promote`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/mandate/policies/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "big orders go to admins, then the owner",
"document": {
"rules": [
{
"id": "notify-finance",
"label": "Orders over $10,000",
"when": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"notify": {
"to": [
"role:admins"
]
}
}
},
{
"id": "big-orders",
"label": "Orders over $5,000",
"when": {
"match": "all",
"items": [
{
"fact": "transaction_amount",
"op": "gt",
"value": 5000
},
{
"match": "any",
"conditions": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "field",
"path": "metadata.cost_center",
"op": "eq",
"value": "research"
}
]
}
]
},
"require": {
"approval": True,
"route": {
"steps": [
{
"to": [
"role:admins"
],
"after": "2h"
},
{
"to": [
"role:owners"
],
"after": "1d"
}
]
}
}
}
]
}
}).json()
policy_version = step1["version"]
step2 = httpx.post(f"{api}/v1/mandate/policies/versions/{policy_version}/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"trial_days": 7
}).json()
data = httpx.post(f"{api}/v1/mandate/policies/trial/promote", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_version",
"policy_id": "pol_3D9BF5244EF1898ABFF5897D48",
"version": 24,
"active": true,
"note": "big orders go to admins, then the owner",
"created_by": "key_4648YH0X1181K8YGZQVWNF1Q84",
"created_at": "2026-11-08T18:05:02.787Z",
"trial_ends_at": "2026-11-15T18:05:02.788Z",
"source": "api",
"domain": "intent",
"promoted_from_trial": true
}Shadow a policy version
POST/v1/mandate/policies/versions/{version}/shadow
Evaluates a saved version on every verify alongside the active policy, without enforcing it, and records its verdict on each decision. One version per domain can be the shadow.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
versionintegerpathRequired- The version number.
Returns
The version, now running in shadow. See the policy version object.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -X POST "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/shadow`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": True
}
}
]
}
}).json()
policy_version = step1["version"]
step2 = httpx.delete(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.post(f"{api}/v1/mandate/policies/versions/{policy_version}/shadow", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_version",
"domain": "intent",
"version": 15,
"active": false,
"shadow": true
}Stop shadowing a policy version
DELETE/v1/mandate/policies/versions/{version}/shadow
Stops evaluating the shadow version. The version stays saved.
Parameters
versionintegerpathRequired- The version number.
Returns
The version, now out of shadow.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}' > step.json
export POLICY_VERSION=$(jq -r '.version' step.json)
curl -s -X DELETE "$PROVENANCE_API/v1/mandate/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -X DELETE "$PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": true
}
}
]
}
}),
})).json();
const policyVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/shadow`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies/versions/${policyVersion}/shadow`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"note": "cap wires at 10k",
"document": {
"rules": [
{
"label": "Wires over 10k denied",
"when": [
{
"fact": "action_type",
"op": "eq",
"value": "wire"
},
{
"fact": "transaction_amount",
"op": "gt",
"value": 10000
}
],
"require": {
"deny": True
}
}
]
}
}).json()
policy_version = step1["version"]
step2 = httpx.delete(f"{api}/v1/mandate/policies", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
step3 = httpx.post(f"{api}/v1/mandate/policies/versions/{policy_version}/shadow", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.delete(f"{api}/v1/mandate/policies/versions/{policy_version}/shadow", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_shadow",
"domain": "intent",
"shadow": false
}