Authorize · API reference
Checkout policies
Your store's versioned checkout rules, which decide when an assessment asks the person or rejects.
Related guide: Assess an agent checkout
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_78F44446F59D72D9B2D553FA8D",
"domain": "checkout",
"version": 1,
"active": true,
"note": "ask for gift cards over 100 and digital orders to a new address",
"created_at": "2026-11-26T20:42:40.914Z",
"document": {
"rules": [
{
"id": "rul_01M8CSH6CJ06F6CTNTGP66SNP6",
"legacy_id": "gift-cards",
"ref": "R-106",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "rul_01M8CSH6CJ6YCKZTAYVKJ1NMBJ",
"legacy_id": "digital-new-address",
"ref": "R-107",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "rul_01M8CSH6CJWFN127WHXH8THYZP",
"legacy_id": "no-bulk",
"ref": "R-108",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}Events
Sent to your webhook endpoints when they subscribe:
authorize.policy.publishedauthorize.rule_suggestion.created
Create a checkout rule draft
POST/v1/authorize/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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": True
}
}
]
}
}).json()Response 201
{
"object": "policy_version",
"policy_id": "pol_AC2A5612965B31B91188589F91",
"version": 7,
"active": false,
"note": "big orders from new shoppers or unsigned agents",
"created_by": "key_5TNJ55HASM8B88CR75NF76ZXY9",
"created_at": "2026-11-17T14:21:13.426Z",
"draft": true,
"source": "api",
"domain": "checkout",
"document": {
"rules": [
{
"id": "rul_01M7MY48AJ9B0NVQS0SWKM925N",
"legacy_id": "big-orders",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
},
"label": "Big orders from new shoppers or unsigned agents"
}
]
}
}Retrieve your checkout rules
GET/v1/authorize/policies
Returns your active checkout rules, or the built-in default with is_default true: the rows rul_default_covered_by_mandate, rul_default_looks_like_a_person (a low bot likelihood) and rul_default_unclassified_approve (approve), rul_default_no_mandate_or_approval (challenge), then the after-approval rows. An agent Identify blocks is rejected before any rule runs.
Parameters
No parameters.
Returns
The active checkout rules.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy",
"id": null,
"domain": "checkout",
"document": {
"rules": [
{
"id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"when": [
{
"fact": "checkout.covered",
"op": "in",
"value": [
"mandate",
"third_party_mandate"
]
}
],
"require": {
"no_challenge": true
}
},
{
"id": "rul_default_ucp_completed_by_person",
"label": "Shopper finished the checkout",
"when": [
{
"fact": "ucp.completed_by",
"op": "eq",
"value": "person"
}
],
"require": {
"no_challenge": true
}
},
{
"id": "rul_default_looks_like_a_person",
"label": "Looks like a person",
"when": [
{
"fact": "agent.bot_likelihood",
"op": "eq",
"value": "low"
}
],
"require": {
"no_challenge": true
}
},
"… 5 more"
]
},
"version": null,
"is_default": true
}Retrieve a checkout rule version
GET/v1/authorize/policies/versions/{version}
Returns one saved checkout rule version's document. A draft that has not gone live carries draft: true, and draft_group when a rules embed session saved it in one.
Parameters
versionintegerpathRequired- The version number.
Returns
The version. See the policy version object.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X PUT "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/authorize/policies", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": True
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": True
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": True
},
"reason": "over_store_limit"
}
]
}
}).json()
checkout_version = step1["version"]
data = httpx.get(f"{api}/v1/authorize/policies/versions/{checkout_version}", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_version",
"domain": "checkout",
"version": 3,
"active": true,
"document": {
"rules": [
{
"id": "rul_01M7MY1ZCA30XGEZM1PE4EYY4Y",
"legacy_id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "rul_01M7MY1ZCAQEGYQCGK1Q7XWNER",
"legacy_id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "rul_01M7MY1ZCAWBHACDAR60ZW988C",
"legacy_id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
},
"note": "ask for gift cards over 100 and digital orders to a new address",
"created_at": "2026-11-17T14:19:58.741Z"
}Get a checkout rule version's plan
GET/v1/authorize/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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/plan" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/plan`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": True
}
}
]
}
}).json()
checkout_version = step1["version"]
data = httpx.get(f"{api}/v1/authorize/policies/versions/{checkout_version}/plan", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_plan",
"domain": "checkout",
"version": 8,
"plan_hash": "1d6e24eec18bd80b4a935210f30f82366dc5363bb777616445bdef82342a13c5",
"node_count": 10,
"reads": [
{
"fact": "agent.verified",
"tier": 0,
"provider": "request"
},
{
"fact": "merchant.customer_account_age_days",
"tier": 0,
"provider": "request"
},
{
"fact": "order.amount",
"tier": 0,
"provider": "request"
}
],
"rules": [
{
"id": "rul_01M8V3E8B3DGQ4T1S1DTC4RC0J",
"tier": 0,
"reads": [
{
"fact": "order.amount",
"tier": 0,
"provider": "request"
},
{
"fact": "agent.verified",
"tier": 0,
"provider": "request"
},
{
"fact": "merchant.customer_account_age_days",
"tier": 0,
"provider": "request"
}
]
}
],
"nodes": [
{
"id": "fact:order.amount",
"kind": "fact",
"tier": 0,
"reads": [],
"fact": "order.amount"
},
{
"id": "cond:rul_01M8V3E8B3DGQ4T1S1DTC4RC0J:0",
"kind": "condition",
"tier": 0,
"reads": [
"fact:order.amount"
]
},
{
"id": "fact:agent.verified",
"kind": "fact",
"tier": 0,
"reads": [],
"fact": "agent.verified"
},
"… 7 more"
],
"warnings": [],
"approve_on_tier3_only": []
}Get the Suggestions settings
GET/v1/authorize/policies/rule_suggestions/settings
How often Suggestions runs for the checkout rule set (weekly by default), when the next run is due, how many "Run now" are left this month (four a month) and what the last run did. Needs the assist on; see the guide.
Parameters
No parameters.
Returns
The settings.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/settings" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/settings`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies/rule_suggestions/settings", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "authorize_suggestion_settings",
"domain": "checkout",
"pace": "weekly",
"paces": [
"daily",
"weekly",
"biweekly",
"monthly",
"off"
],
"next_run_at": "2026-12-09T10:00:00.000Z",
"run_now": {
"limit": 4,
"used": 1,
"left": 3,
"month": "2026-12"
},
"last_run": {
"object": "authorize_suggestion_run",
"id": "psr_01M8V9AMPR7XMCPSPQR470N8V6",
"domain": "checkout",
"trigger": "run_now",
"result": "suggested",
"reason": null,
"queries": 1,
"drafted": 5,
"kept": 2,
"dropped": {
"not_better": 1,
"approve_rule": 1,
"too_few_labels": 1
},
"cost_micro_usd": 3600,
"created_at": "2026-12-02T10:00:00.000Z",
"finished_at": "2026-12-02T10:00:02.035Z"
},
"updated_at": "2026-12-02T10:00:00.000Z"
}Retrieve a rule suggestion
GET/v1/authorize/policies/rule_suggestions/{id}
One checkout rule draft with its evidence, backtest and status. Needs the assist on; see the guide.
Parameters
idstringpathRequired- The suggestion's ID (
prs_).
Returns
The suggestion.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "authorize_rule_suggestion",
"id": "prs_01M81CRZ5CX8S238KB791A7JB0",
"domain": "checkout",
"status": "open",
"label": "First-time agent orders",
"rule": {
"id": "draft-c52be145f4",
"label": "First-time agent orders",
"when": [
{
"fact": "store.agent_order",
"op": "eq",
"value": true
},
{
"fact": "store.customer_order_count",
"op": "eq",
"value": 0
}
],
"require": {
"approval": true
}
},
"action": "ask",
"description": "If all of: Placed by an AI agent is true; and Customer's past orders is 0, then challenge the shopper",
"explanation": "12 of 24 orders in this group were flagged or disputed, against 6% of all orders.",
"explanation_source": "model",
"explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
"evidence": {
"orders": 24,
"flagged": 12,
"disputed": 12,
"rate": 0.5,
"baseline_rate": 0.0577,
"total_orders": 260,
"total_flagged": 15,
"window_from": "2026-08-24T10:28:05.396Z",
"window_to": "2026-11-22T10:28:05.396Z",
"by_label": {
"fraud": 12
},
"flagged_caught": 12
},
"backtest": {
"object": "policy_backtest",
"days": 30,
"from": "2026-10-23T10:28:05.396Z",
"to": "2026-11-22T10:28:05.396Z",
"available": true,
"requests": 260,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 236,
"challenged": 24,
"rejected": 0
},
"amounts": {
"fact": "order.amount",
"allowed": [
{
"currency": "USD",
"amount": 28320
}
],
"challenged": [
{
"currency": "USD",
"amount": 2880
}
],
"rejected": [],
"unsummed": 0
},
"rules": [
{
"rule_id": "draft-c52be145f4",
"label": "First-time agent orders",
"outcome": "ask",
"matched": 24,
"decided": 24,
"per_week": 5.6,
"amounts": [
{
"currency": "USD",
"amount": 2880
}
],
"summary": "Last 30 days: would have challenged 24 times, about 6 a week"
},
{
"rule_id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"outcome": "approve",
"matched": 0,
"decided": 0,
"per_week": 0,
"amounts": [],
"summary": "Last 30 days: would not have approved"
}
]
},
"limited_data": true,
"policy_version": null,
"shadow_version": null,
"published_version": null,
"dismissed_until": null,
"created_at": "2026-11-22T10:28:05.396Z",
"updated_at": "2026-11-22T10:28:05.396Z"
}Get the trial run
GET/v1/authorize/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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "trial_days": 7 }' > /dev/null
curl "$PROVENANCE_API/v1/authorize/policies/trial" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies/trial" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({ "trial_days": 7 }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/trial`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": True
}
}
]
}
}).json()
checkout_version = step1["version"]
step2 = httpx.post(f"{api}/v1/authorize/policies/versions/{checkout_version}/publish", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"trial_days": 7
}).json()
data = httpx.get(f"{api}/v1/authorize/policies/trial", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_trial",
"domain": "checkout",
"active": true,
"version": 12,
"started_at": "2026-11-08T18:05:02.803Z",
"ends_at": "2026-11-15T18:05:02.803Z",
"evaluated": 0,
"differences": 0,
"examples": []
}Get the checkout shadow report
GET/v1/authorize/policies/shadow_report
Compares the shadow version's verdicts with the outcomes your assessments got over a time window: how many it evaluated, how often it disagreed and each outcome change.
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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies/shadow_report" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/shadow_report`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies/shadow_report", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "shadow_report",
"domain": "checkout",
"shadow_active": false,
"shadow_version": null,
"from": null,
"to": null,
"evaluated": 0,
"diverged": 0,
"divergence_rate": 0,
"transitions": {}
}Get rule performance
GET/v1/authorize/policies/performance
Returns how the checkout rules performed over a window of UTC days (default: the last 30): the orders each rule decided, their value, the outcome shares, and the four results your labels give, with "No label yet" for the rest. A rejected order counts as right or wrong only when a label says so. Rules come in the version's order, then the fallback.
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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/authorize/checkout_assessments" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"cart": {
"order_id": "ord_8815",
"total": 3800,
"currency": "USD",
"merchant_id": "harborbean",
"origin": "https://harborbean.example",
"items": [
{
"sku": "mug-sage",
"name": "Stoneware mug",
"quantity": 2,
"unit_amount": 1900
}
]
}
}' > /dev/null
curl "$PROVENANCE_API/v1/authorize/policies/performance" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/checkout_assessments`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"cart": {
"order_id": "ord_8815",
"total": 3800,
"currency": "USD",
"merchant_id": "harborbean",
"origin": "https://harborbean.example",
"items": [
{
"sku": "mug-sage",
"name": "Stoneware mug",
"quantity": 2,
"unit_amount": 1900
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/performance`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/checkout_assessments", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"cart": {
"order_id": "ord_8815",
"total": 3800,
"currency": "USD",
"merchant_id": "harborbean",
"origin": "https://harborbean.example",
"items": [
{
"sku": "mug-sage",
"name": "Stoneware mug",
"quantity": 2,
"unit_amount": 1900
}
]
}
}).json()
data = httpx.get(f"{api}/v1/authorize/policies/performance", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_performance",
"domain": "checkout",
"from": "2026-11-03",
"to": "2026-12-02",
"version": null,
"currency": "USD",
"other_currencies": [],
"totals": {
"matched": 5,
"value_minor": 19000,
"outcomes": [
{
"outcome": "approve",
"count": 5,
"value_minor": 19000,
"currency": "USD",
"share": 1
},
{
"outcome": "challenge",
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
},
{
"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": 5,
"value_minor": 19000,
"currency": "USD"
}
},
"labelled": 0,
"enough_labels": false
},
"rules": [
{
"rule_id": "rul_default_covered_by_mandate",
"name": "Within a mandate",
"outcomes": [],
"matched": 0,
"value_minor": 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": 0,
"value_minor": 0,
"currency": "USD"
}
}
},
{
"rule_id": "rul_default_ucp_completed_by_person",
"name": "Shopper finished the checkout",
"outcomes": [],
"matched": 0,
"value_minor": 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": 0,
"value_minor": 0,
"currency": "USD"
}
}
},
{
"rule_id": "rul_default_looks_like_a_person",
"name": "Looks like a person",
"outcomes": [],
"matched": 0,
"value_minor": 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": 0,
"value_minor": 0,
"currency": "USD"
}
}
},
"… 6 more"
],
"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."
}Set the Suggestions pace
PATCH/v1/authorize/policies/rule_suggestions/settings
Sets how often the scheduled Suggestions run comes: daily, weekly, biweekly, monthly or off. Needs Manage policies (console) or the authorize scope.
Parameters
paceenumRequired- How often the scheduled run comes. One of
daily,weekly,biweekly,monthly,off.
Returns
The settings after the change.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X PATCH "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/settings" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "pace": "monthly" }'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/settings`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({ "pace": "monthly" }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.patch(f"{api}/v1/authorize/policies/rule_suggestions/settings", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"pace": "monthly"
}).json()Response 200
{
"object": "authorize_suggestion_settings",
"domain": "checkout",
"pace": "monthly",
"paces": [
"daily",
"weekly",
"biweekly",
"monthly",
"off"
],
"next_run_at": "2027-01-01T10:00:00.000Z",
"run_now": {
"limit": 4,
"used": 1,
"left": 3,
"month": "2026-12"
},
"last_run": null,
"updated_at": "2026-12-02T10:05:00.000Z"
}List checkout rule versions
GET/v1/authorize/policies/versions
Lists your saved checkout rule versions, newest first, and which is active.
Parameters
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. 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 versions, newest first.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X PUT "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/authorize/policies", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": True
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": True
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": True
},
"reason": "over_store_limit"
}
]
}
}).json()
checkout_version = step1["version"]
data = httpx.get(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "list",
"data": [
{
"object": "policy_version",
"policy_id": "pol_AC2A5612965B31B91188589F91",
"version": 2,
"active": true,
"note": "ask for gift cards over 100 and digital orders to a new address",
"created_by": "key_7FHWBSCG1E8PJV9C3XB7HS0CF4",
"created_at": "2026-11-08T18:03:55.115Z",
"source": "api",
"key_last4": "pR5x",
"domain": "checkout"
},
{
"object": "policy_version",
"policy_id": "pol_AC2A5612965B31B91188589F91",
"version": 1,
"active": false,
"note": "ask for gift cards over 100 and digital orders to a new address",
"created_by": "key_7FHWBSCG1E8PJV9C3XB7HS0CF4",
"created_at": "2026-11-08T18:03:55.114Z",
"source": "api",
"key_last4": "pR5x",
"domain": "checkout"
}
],
"has_more": false,
"next_cursor": null
}List the records a backtest would change
GET/v1/authorize/policies/backtest/{id}/changes
Lists the orders 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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies/backtest/pbt_01M8WMKZJ4EZ1EWXVEN3N4HE9R/changes" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/backtest/pbt_01M8WMKZJ4EZ1EWXVEN3N4HE9R/changes`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies/backtest/pbt_01M8WMKZJ4EZ1EWXVEN3N4HE9R/changes", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).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
}List rule suggestions
GET/v1/authorize/policies/rule_suggestions
Lists the checkout rule drafts: open and shadowed ones, and the rest from the last 90 days, newest first. Statistics count the evidence and the 30-day backtest; a model writes the label and explanation. Needs the assist on; see the guide.
Parameters
statusenumquery- Only suggestions in this status. One of
open,shadowed,published,dismissed,expired. 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
A page of suggestions.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies/rule_suggestions" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies/rule_suggestions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "list",
"data": [
{
"object": "authorize_rule_suggestion",
"id": "prs_01M81CRZ5CX8S238KB791A7JB0",
"domain": "checkout",
"status": "open",
"label": "First-time agent orders",
"rule": {
"id": "draft-c52be145f4",
"label": "First-time agent orders",
"when": [
{
"fact": "store.agent_order",
"op": "eq",
"value": true
},
{
"fact": "store.customer_order_count",
"op": "eq",
"value": 0
}
],
"require": {
"approval": true
}
},
"action": "ask",
"description": "If all of: Placed by an AI agent is true; and Customer's past orders is 0, then challenge the shopper",
"explanation": "12 of 24 orders in this group were flagged or disputed, against 6% of all orders.",
"explanation_source": "model",
"explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
"evidence": {
"orders": 24,
"flagged": 12,
"disputed": 12,
"rate": 0.5,
"baseline_rate": 0.0577,
"total_orders": 260,
"total_flagged": 15,
"window_from": "2026-08-24T10:28:05.396Z",
"window_to": "2026-11-22T10:28:05.396Z",
"by_label": {
"fraud": 12
},
"flagged_caught": 12
},
"backtest": {
"object": "policy_backtest",
"days": 30,
"from": "2026-10-23T10:28:05.396Z",
"to": "2026-11-22T10:28:05.396Z",
"available": true,
"requests": 260,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 236,
"challenged": 24,
"rejected": 0
},
"amounts": {
"fact": "order.amount",
"allowed": [
{
"currency": "USD",
"amount": 28320
}
],
"challenged": [
{
"currency": "USD",
"amount": 2880
}
],
"rejected": [],
"unsummed": 0
},
"rules": [
{
"rule_id": "draft-c52be145f4",
"label": "First-time agent orders",
"outcome": "ask",
"matched": 24,
"decided": 24,
"per_week": 5.6,
"amounts": [
{
"currency": "USD",
"amount": 2880
}
],
"summary": "Last 30 days: would have challenged 24 times, about 6 a week"
},
{
"rule_id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"outcome": "approve",
"matched": 0,
"decided": 0,
"per_week": 0,
"amounts": [],
"summary": "Last 30 days: would not have approved"
}
]
},
"limited_data": true,
"policy_version": null,
"shadow_version": null,
"published_version": null,
"dismissed_until": null,
"created_at": "2026-11-22T10:28:05.396Z",
"updated_at": "2026-11-22T10:28:05.396Z"
}
],
"has_more": false,
"next_cursor": null
}List Suggestions runs
GET/v1/authorize/policies/rule_suggestions/runs
The last 50 Suggestions runs for the checkout rule set, newest first: what started each, its result and reason, the queries it ran, what it kept and dropped, and what it cost us. Counts only. Needs the assist on.
Parameters
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
A page of runs.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/runs" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/runs`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies/rule_suggestions/runs", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "list",
"data": [
{
"object": "authorize_suggestion_run",
"id": "psr_01M8V9AMPR7XMCPSPQR470N8V6",
"domain": "checkout",
"trigger": "scheduled",
"result": "below_floor",
"reason": "Suggestions need at least 200 orders across 14 days; this rule set has 40 over 9 days.",
"queries": 0,
"drafted": 0,
"kept": 0,
"dropped": {},
"cost_micro_usd": 0,
"created_at": "2026-12-02T10:00:00.000Z",
"finished_at": "2026-12-02T10:00:00.010Z"
}
],
"has_more": false,
"next_cursor": null
}List the records the shadow version would change
GET/v1/authorize/policies/shadow/changes
Lists the orders whose recorded shadow outcome differs from what the live rules decided, newest first, each with both outcomes, both rules, its label and its name (your order ID). At most 500 records are counted. Checkout policies only.
Parameters
created_gtetimestampquery- Orders assessed at or after this time.
created_ltetimestampquery- Orders assessed at or before this time.
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 the shadow version would change.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/authorize/policies/shadow/changes" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/shadow/changes`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/authorize/policies/shadow/changes", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "list",
"data": [],
"has_more": false,
"next_cursor": null,
"total": 0,
"capped": false,
"policy_version": null
}Publish your checkout rules
PUT/v1/authorize/policies
Saves your checkout rules as the next version, live at once. Rules run in order and the first match decides: approve (require.no_challenge), challenge (require.approval) or reject (require.deny). Any-of, velocity and named lists need Pro. A rule that never runs comes back in warnings; a Reject on behaviour alone is behaviour_only_reject. Empty rules saves no rules.
Parameters
documentobjectRequired{ rules: [{ id, when: [{ fact, op, value }], require: { no_challenge: true } | { approval: true } | { deny: true }, reason? }] }, and optionallypasskeysandvoice.Show child attributes
rulesarray of objects- The rules in the order they run.
passkeysobject- What a new passkey needs on a cart approval.
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.
notestring- A note for the record.
Returns
The new version, now active. See the policy version object.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X PUT "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}'
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.put(f"{api}/v1/authorize/policies", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": True
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": True
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": True
},
"reason": "over_store_limit"
}
]
}
}).json()Response 201
{
"object": "policy_version",
"policy_id": "pol_78F44446F59D72D9B2D553FA8D",
"domain": "checkout",
"version": 1,
"active": true,
"note": "ask for gift cards over 100 and digital orders to a new address",
"created_at": "2026-11-26T20:42:40.914Z",
"document": {
"rules": [
{
"id": "rul_01M8CSH6CJ06F6CTNTGP66SNP6",
"legacy_id": "gift-cards",
"ref": "R-106",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "rul_01M8CSH6CJ6YCKZTAYVKJ1NMBJ",
"legacy_id": "digital-new-address",
"ref": "R-107",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "rul_01M8CSH6CJWFN127WHXH8THYZP",
"legacy_id": "no-bulk",
"ref": "R-108",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}Revert to the default checkout rules
DELETE/v1/authorize/policies
Deactivates your checkout rules (history is kept) and returns the built-in default: the rows rul_default_covered_by_mandate (Approve) and rul_default_no_mandate_or_approval (Challenge).
Parameters
No parameters.
Returns
The built-in default, now active.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.delete(f"{api}/v1/authorize/policies", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy",
"id": null,
"domain": "checkout",
"document": {
"rules": [
{
"id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"when": [
{
"fact": "checkout.covered",
"op": "in",
"value": [
"mandate",
"third_party_mandate"
]
}
],
"require": {
"no_challenge": true
}
},
{
"id": "rul_default_ucp_completed_by_person",
"label": "Shopper finished the checkout",
"when": [
{
"fact": "ucp.completed_by",
"op": "eq",
"value": "person"
}
],
"require": {
"no_challenge": true
}
},
{
"id": "rul_default_looks_like_a_person",
"label": "Looks like a person",
"when": [
{
"fact": "agent.bot_likelihood",
"op": "eq",
"value": "low"
}
],
"require": {
"no_challenge": true
}
},
"… 5 more"
]
},
"version": null,
"is_default": true
}Review a checkout rule version's changes
GET/v1/authorize/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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/diff" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/diff`, {
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": True
}
}
]
}
}).json()
checkout_version = step1["version"]
data = httpx.get(f"{api}/v1/authorize/policies/versions/{checkout_version}/diff", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_diff",
"domain": "checkout",
"version": 8,
"against": null,
"changes": [
{
"rule_id": "rul_01M7MY48AJ9B0NVQS0SWKM925N",
"label": "Big orders from new shoppers or unsigned agents",
"change": "added",
"parts": [],
"before": null,
"after": "If all of: Order total is over 500; and any of (Agent verified is false or Shopper account age (days) is under 7), then challenge the shopper"
},
{
"rule_id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"change": "removed",
"parts": [],
"before": "If covered by is one of mandate, third_party_mandate, then approve",
"after": null
},
{
"rule_id": "rul_default_looks_like_a_person",
"label": "Looks like a person",
"change": "removed",
"parts": [],
"before": "If bot likelihood is low, then approve",
"after": null
},
"… 4 more"
]
}Publish a checkout rule version
POST/v1/authorize/policies/versions/{version}/publish
Makes a draft the live checkout rules 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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl -X POST "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": True
}
}
]
}
}).json()
checkout_version = step1["version"]
data = httpx.post(f"{api}/v1/authorize/policies/versions/{checkout_version}/publish", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_version",
"policy_id": "pol_AC2A5612965B31B91188589F91",
"version": 9,
"active": true,
"note": "big orders from new shoppers or unsigned agents",
"created_by": "key_7FHWBSCG1E8PJV9C3XB7HS0CF4",
"created_at": "2026-11-08T18:05:02.794Z",
"source": "api",
"domain": "checkout"
}Export checkout rule versions
GET/v1/authorize/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/authorize/policies/versions/export" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/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/authorize/policies/versions/export", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_version_export",
"domain": "checkout",
"exported_at": "2026-11-20T11:41:55.786Z",
"versions": []
}Backtest checkout rules
POST/v1/authorize/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. Field conditions and the coverage check aren't replayed, so totals.allowed counts carts no rule asked about or blocked, not carts that go through without a challenge.
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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/authorize/policies/backtest" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"document": {
"rules": [
{
"id": "unsigned-agents",
"label": "Unsigned agents",
"when": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
}
],
"require": {
"approval": true
}
}
]
},
"days": 30
}'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/backtest`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"document": {
"rules": [
{
"id": "unsigned-agents",
"label": "Unsigned agents",
"when": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
}
],
"require": {
"approval": true
}
}
]
},
"days": 30
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/policies/backtest", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"document": {
"rules": [
{
"id": "unsigned-agents",
"label": "Unsigned agents",
"when": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
}
],
"require": {
"approval": True
}
}
]
},
"days": 30
}).json()Response 200
{
"object": "policy_backtest",
"days": 30,
"from": "2026-11-03T00:29:17.122Z",
"to": "2026-12-03T00:29:17.122Z",
"available": true,
"requests": 5,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 0,
"challenged": 5,
"rejected": 0
},
"amounts": {
"fact": "order.amount",
"allowed": [],
"challenged": [
{
"currency": "USD",
"amount": 190
}
],
"rejected": [],
"unsummed": 0
},
"rates": {
"records": 5,
"live": {
"approve": {
"count": 5,
"value_minor": 19000,
"currency": "USD",
"share": 100
},
"challenge": {
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
},
"review": {
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
},
"reject": {
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
}
},
"draft": {
"approve": {
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
},
"challenge": {
"count": 5,
"value_minor": 19000,
"currency": "USD",
"share": 100
},
"review": {
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
},
"reject": {
"count": 0,
"value_minor": 0,
"currency": "USD",
"share": 0
}
},
"change_points": {
"approve": -100,
"challenge": 100,
"review": 0,
"reject": 0
},
"challenge_reject_change_points": 100
},
"changes": {
"total": 5,
"capped": false,
"data": [
{
"id": "cas_01M8WMT9QGJ57Q99Y812QFTKEA",
"kind": "checkout_assessment",
"created_at": "2026-12-03T00:28:07.280Z",
"value_minor": 3800,
"currency": "USD",
"live": "approve",
"draft": "challenge",
"live_rule_id": "rul_default_unclassified_approve",
"draft_rule_id": "unsigned-agents",
"label": null,
"live_result": "unlabelled",
"draft_result": "unlabelled"
},
{
"id": "cas_01M8WMT9PBWMV78SADW3JTY0XS",
"kind": "checkout_assessment",
"created_at": "2026-12-03T00:28:07.243Z",
"value_minor": 3800,
"currency": "USD",
"live": "approve",
"draft": "challenge",
"live_rule_id": null,
"draft_rule_id": "unsigned-agents",
"label": "disputed",
"live_result": "missed",
"draft_result": "true_positive"
},
{
"id": "cas_01M8WMT9P7Y89SXJSR4P0CRMVZ",
"kind": "checkout_assessment",
"created_at": "2026-12-03T00:28:07.240Z",
"value_minor": 3800,
"currency": "USD",
"live": "approve",
"draft": "challenge",
"live_rule_id": "rul_default_unclassified_approve",
"draft_rule_id": "unsigned-agents",
"label": null,
"live_result": "unlabelled",
"draft_result": "unlabelled"
},
{
"id": "cas_01M8WMT9P5FBR889VYH57W0FJX",
"kind": "checkout_assessment",
"created_at": "2026-12-03T00:28:07.237Z",
"value_minor": 3800,
"currency": "USD",
"live": "approve",
"draft": "challenge",
"live_rule_id": "rul_default_unclassified_approve",
"draft_rule_id": "unsigned-agents",
"label": null,
"live_result": "unlabelled",
"draft_result": "unlabelled"
},
{
"id": "cas_01M8WMT9P0B6G2E2G7HFK32TFB",
"kind": "checkout_assessment",
"created_at": "2026-12-03T00:28:07.234Z",
"value_minor": 3800,
"currency": "USD",
"live": "approve",
"draft": "challenge",
"live_rule_id": null,
"draft_rule_id": "unsigned-agents",
"label": null,
"live_result": "unlabelled",
"draft_result": "unlabelled"
}
]
},
"labels": {
"labelled": 1,
"enough_labels": false,
"live": {
"true_positive": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"false_positive": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"missed": {
"count": 1,
"value_minor": 3800,
"currency": "USD"
},
"allowed": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"unlabelled": {
"count": 4,
"value_minor": 15200,
"currency": "USD"
}
},
"draft": {
"true_positive": {
"count": 1,
"value_minor": 3800,
"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": 4,
"value_minor": 15200,
"currency": "USD"
}
},
"added": {
"true_positive": {
"count": 1,
"value_minor": 3800,
"currency": "USD"
},
"false_positive": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"missed": {
"count": -1,
"value_minor": -3800,
"currency": "USD"
},
"allowed": {
"count": 0,
"value_minor": 0,
"currency": "USD"
},
"unlabelled": {
"count": 0,
"value_minor": 0,
"currency": "USD"
}
},
"newly_stopped": {
"disputed": {
"count": 1,
"value_minor": 3800,
"currency": "USD"
},
"clean": {
"count": 0,
"value_minor": 0,
"currency": "USD"
}
}
},
"rules": [
{
"rule_id": "unsigned-agents",
"label": "Unsigned agents",
"outcome": "ask",
"matched": 5,
"decided": 5,
"per_week": 1.2,
"amounts": [
{
"currency": "USD",
"amount": 190
}
],
"summary": "Last 30 days: would have challenged 5 times, about 1 a week"
}
],
"id": "pbt_01M8WMWDY4XHXVACCKV9WF856J"
}Refresh rule suggestions
POST/v1/authorize/policies/rule_suggestions/refresh
Runs the checkout rule drafts now instead of waiting for the nightly run. Once a day per policy (429 after); each draft shown counts toward the monthly limit. Below the evidence floor nothing is sent to the model (below_floor). Needs the assist on; see the guide.
Parameters
No parameters.
Returns
What the run did, and the open drafts.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/refresh" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/refresh`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/policies/rule_suggestions/refresh", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "rule_suggestion_refresh",
"domain": "checkout",
"result": "drafted",
"created": 1,
"open": [
{
"object": "authorize_rule_suggestion",
"id": "prs_01M81CRZ5CX8S238KB791A7JB0",
"domain": "checkout",
"status": "open",
"label": "First-time agent orders",
"rule": {
"id": "draft-c52be145f4",
"label": "First-time agent orders",
"when": [
{
"fact": "store.agent_order",
"op": "eq",
"value": true
},
{
"fact": "store.customer_order_count",
"op": "eq",
"value": 0
}
],
"require": {
"approval": true
}
},
"action": "ask",
"description": "If all of: Placed by an AI agent is true; and Customer's past orders is 0, then challenge the shopper",
"explanation": "12 of 24 orders in this group were flagged or disputed, against 6% of all orders.",
"explanation_source": "model",
"explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
"evidence": {
"orders": 24,
"flagged": 12,
"disputed": 12,
"rate": 0.5,
"baseline_rate": 0.0577,
"total_orders": 260,
"total_flagged": 15,
"window_from": "2026-08-24T10:28:05.396Z",
"window_to": "2026-11-22T10:28:05.396Z",
"by_label": {
"fraud": 12
},
"flagged_caught": 12
},
"backtest": {
"object": "policy_backtest",
"days": 30,
"from": "2026-10-23T10:28:05.396Z",
"to": "2026-11-22T10:28:05.396Z",
"available": true,
"requests": 260,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 236,
"challenged": 24,
"rejected": 0
},
"amounts": {
"fact": "order.amount",
"allowed": [
{
"currency": "USD",
"amount": 28320
}
],
"challenged": [
{
"currency": "USD",
"amount": 2880
}
],
"rejected": [],
"unsummed": 0
},
"rules": [
{
"rule_id": "draft-c52be145f4",
"label": "First-time agent orders",
"outcome": "ask",
"matched": 24,
"decided": 24,
"per_week": 5.6,
"amounts": [
{
"currency": "USD",
"amount": 2880
}
],
"summary": "Last 30 days: would have challenged 24 times, about 6 a week"
},
{
"rule_id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"outcome": "approve",
"matched": 0,
"decided": 0,
"per_week": 0,
"amounts": [],
"summary": "Last 30 days: would not have approved"
}
]
},
"limited_data": true,
"policy_version": null,
"shadow_version": null,
"published_version": null,
"dismissed_until": null,
"created_at": "2026-11-22T10:28:05.396Z",
"updated_at": "2026-11-22T10:28:05.396Z"
}
]
}Run Suggestions now
POST/v1/authorize/policies/rule_suggestions/runs
Runs Suggestions for the checkout rule set now. Four a calendar month (429 after; the scheduled runs go on). Each draft is tested with a query you can read and kept only when it tests better. With no model provider the run ends unavailable and stores nothing. Nothing here publishes. See the guide.
Parameters
No parameters.
Returns
What the run did, the suggestions it added, and the settings after it.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/runs" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/runs`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/policies/rule_suggestions/runs", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "authorize_suggestion_run",
"id": "psr_01M8V9AMPR7XMCPSPQR470N8V6",
"domain": "checkout",
"trigger": "run_now",
"result": "suggested",
"reason": null,
"queries": 1,
"drafted": 5,
"kept": 1,
"dropped": {
"not_better": 2,
"approve_rule": 1,
"too_few_labels": 1
},
"cost_micro_usd": 3600,
"created_at": "2026-12-02T10:00:00.000Z",
"finished_at": "2026-12-02T10:00:02.035Z",
"suggestions": [
{
"object": "authorize_rule_suggestion",
"id": "prs_01M8V9APP7FSWH0J5DBXTT7ZPX",
"domain": "checkout",
"status": "open",
"label": "Unverified agents, 500 and up",
"rule": {
"label": "Unverified agents, 500 and up",
"when": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "order.amount",
"op": "gte",
"value": 500
}
],
"require": {
"approval": true
}
},
"action": "ask",
"description": "If all of: Agent verified is false; and Order total is at least 500, then challenge the shopper",
"explanation": "12 of the 30 orders from unverified agents at 500 and up were reported as fraud.",
"explanation_source": "model",
"explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
"evidence": {
"orders": 30,
"added": {
"true_positive": {
"count": 12,
"value": 7200
},
"false_positive": {
"count": 2,
"value": 1200
}
},
"window_days": 90
},
"backtest": {
"object": "policy_backtest",
"available": true,
"days": 30,
"from": "2026-11-02T10:00:00.000Z",
"to": "2026-12-02T10:00:00.000Z",
"requests": 260,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 230,
"challenged": 30,
"rejected": 0
},
"rules": []
},
"limited_data": false,
"policy_version": null,
"shadow_version": null,
"published_version": null,
"dismissed_until": null,
"created_at": "2026-12-02T10:00:02.000Z",
"updated_at": "2026-12-02T10:00:02.000Z",
"kind": "rule",
"change": "new",
"target": null,
"draft": {
"rule": {
"label": "Unverified agents, 500 and up",
"when": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "order.amount",
"op": "gte",
"value": 500
}
],
"require": {
"approval": true
}
}
},
"test": {
"sql": "SELECT count(*)::int AS matched, COALESCE(sum(order_amount), 0)::float8 AS value, (count(*) FILTER (WHERE bad AND NOT stopped))::int AS added_true_positive, (count(*) FILTER (WHERE clean AND NOT stopped))::int AS added_false_positive, COALESCE(sum(order_amount) FILTER (WHERE bad AND NOT stopped), 0)::float8 AS added_true_positive_value, COALESCE(sum(order_amount) FILTER (WHERE clean AND NOT stopped), 0)::float8 AS added_false_positive_value FROM orders WHERE (COALESCE((agent_verified = false), false) AND COALESCE((order_amount >= 500), false))",
"written_by": "job",
"window": {
"from": "2026-09-03T10:00:00.000Z",
"to": "2026-12-02T10:00:00.000Z"
},
"matched": 30,
"value": 18000,
"added": {
"true_positive": {
"count": 12,
"value": 7200
},
"false_positive": {
"count": 2,
"value": 1200
}
},
"note": "The query tests the change on its own; the backtest tests it in its place in the flow, so the two can differ a little."
},
"replay": {
"days": 30,
"requests": 260,
"labels": {
"labelled": 30,
"enough_labels": true,
"added": {
"true_positive": {
"count": 12
},
"false_positive": {
"count": 2
},
"missed": {
"count": -12
},
"allowed": {
"count": 0
},
"unlabelled": {
"count": 2
}
}
}
},
"source": {
"type": "run"
},
"run_id": "psr_01M8V9AMPR7XMCPSPQR470N8V6"
}
],
"settings": {
"object": "authorize_suggestion_settings",
"domain": "checkout",
"pace": "weekly",
"paces": [
"daily",
"weekly",
"biweekly",
"monthly",
"off"
],
"next_run_at": "2026-12-09T10:00:00.000Z",
"run_now": {
"limit": 4,
"used": 1,
"left": 3,
"month": "2026-12"
},
"last_run": null,
"updated_at": "2026-12-02T10:00:00.000Z"
}
}Try a rule suggestion in shadow mode
POST/v1/authorize/policies/rule_suggestions/{id}/shadow
Creates a draft version (the live rules plus this rule) and runs it in shadow; live decisions don't change. The suggestion moves to shadowed. To go live, publish shadow_version with POST /v1/authorize/policies/versions/{version}/publish. Needs the assist on; see the guide.
Parameters
idstringpathRequired- The suggestion's ID (
prs_).
Returns
The suggestion, shadowed.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0/shadow`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0/shadow", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "authorize_rule_suggestion",
"id": "prs_01M81CRZ5CX8S238KB791A7JB0",
"domain": "checkout",
"status": "shadowed",
"label": "First-time agent orders",
"rule": {
"id": "draft-c52be145f4",
"label": "First-time agent orders",
"when": [
{
"fact": "store.agent_order",
"op": "eq",
"value": true
},
{
"fact": "store.customer_order_count",
"op": "eq",
"value": 0
}
],
"require": {
"approval": true
}
},
"action": "ask",
"description": "If all of: Placed by an AI agent is true; and Customer's past orders is 0, then challenge the shopper",
"explanation": "12 of 24 orders in this group were flagged or disputed, against 6% of all orders.",
"explanation_source": "model",
"explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
"evidence": {
"orders": 24,
"flagged": 12,
"disputed": 12,
"rate": 0.5,
"baseline_rate": 0.0577,
"total_orders": 260,
"total_flagged": 15,
"window_from": "2026-08-24T10:28:05.396Z",
"window_to": "2026-11-22T10:28:05.396Z",
"by_label": {
"fraud": 12
},
"flagged_caught": 12
},
"backtest": {
"object": "policy_backtest",
"days": 30,
"from": "2026-10-23T10:28:05.396Z",
"to": "2026-11-22T10:28:05.396Z",
"available": true,
"requests": 260,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 236,
"challenged": 24,
"rejected": 0
},
"amounts": {
"fact": "order.amount",
"allowed": [
{
"currency": "USD",
"amount": 28320
}
],
"challenged": [
{
"currency": "USD",
"amount": 2880
}
],
"rejected": [],
"unsummed": 0
},
"rules": [
{
"rule_id": "draft-c52be145f4",
"label": "First-time agent orders",
"outcome": "ask",
"matched": 24,
"decided": 24,
"per_week": 5.6,
"amounts": [
{
"currency": "USD",
"amount": 2880
}
],
"summary": "Last 30 days: would have challenged 24 times, about 6 a week"
},
{
"rule_id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"outcome": "approve",
"matched": 0,
"decided": 0,
"per_week": 0,
"amounts": [],
"summary": "Last 30 days: would not have approved"
}
]
},
"limited_data": true,
"policy_version": null,
"shadow_version": 1,
"published_version": null,
"dismissed_until": null,
"created_at": "2026-11-22T10:28:05.396Z",
"updated_at": "2026-11-22T10:28:05.426Z"
}Dismiss a rule suggestion
POST/v1/authorize/policies/rule_suggestions/{id}/dismiss
Hides the draft for 90 days; a draft with the same conditions isn't suggested again meanwhile. A published suggestion can't be dismissed. Needs the assist on; see the guide.
Parameters
idstringpathRequired- The suggestion's ID (
prs_).
Returns
The suggestion, dismissed.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0/dismiss" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0/dismiss`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/policies/rule_suggestions/prs_01M81CRZ5CX8S238KB791A7JB0/dismiss", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "authorize_rule_suggestion",
"id": "prs_01M81CRZ5CX8S238KB791A7JB0",
"domain": "checkout",
"status": "dismissed",
"label": "First-time agent orders",
"rule": {
"id": "draft-c52be145f4",
"label": "First-time agent orders",
"when": [
{
"fact": "store.agent_order",
"op": "eq",
"value": true
},
{
"fact": "store.customer_order_count",
"op": "eq",
"value": 0
}
],
"require": {
"approval": true
}
},
"action": "ask",
"description": "If all of: Placed by an AI agent is true; and Customer's past orders is 0, then challenge the shopper",
"explanation": "12 of 24 orders in this group were flagged or disputed, against 6% of all orders.",
"explanation_source": "model",
"explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
"evidence": {
"orders": 24,
"flagged": 12,
"disputed": 12,
"rate": 0.5,
"baseline_rate": 0.0577,
"total_orders": 260,
"total_flagged": 15,
"window_from": "2026-08-24T10:28:05.572Z",
"window_to": "2026-11-22T10:28:05.572Z",
"by_label": {
"fraud": 12
},
"flagged_caught": 12
},
"backtest": {
"object": "policy_backtest",
"days": 30,
"from": "2026-10-23T10:28:05.572Z",
"to": "2026-11-22T10:28:05.572Z",
"available": true,
"requests": 260,
"truncated": false,
"field_conditions_unscored": false,
"totals": {
"allowed": 236,
"challenged": 24,
"rejected": 0
},
"amounts": {
"fact": "order.amount",
"allowed": [
{
"currency": "USD",
"amount": 28320
}
],
"challenged": [
{
"currency": "USD",
"amount": 2880
}
],
"rejected": [],
"unsummed": 0
},
"rules": [
{
"rule_id": "draft-c52be145f4",
"label": "First-time agent orders",
"outcome": "ask",
"matched": 24,
"decided": 24,
"per_week": 5.6,
"amounts": [
{
"currency": "USD",
"amount": 2880
}
],
"summary": "Last 30 days: would have challenged 24 times, about 6 a week"
},
{
"rule_id": "rul_default_covered_by_mandate",
"label": "Within a mandate",
"outcome": "approve",
"matched": 0,
"decided": 0,
"per_week": 0,
"amounts": [],
"summary": "Last 30 days: would not have approved"
}
]
},
"limited_data": true,
"policy_version": null,
"shadow_version": null,
"published_version": null,
"dismissed_until": "2027-02-20T10:28:05.584Z",
"created_at": "2026-11-22T10:28:05.572Z",
"updated_at": "2026-11-22T10:28:05.584Z"
}Stop the trial run
DELETE/v1/authorize/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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "trial_days": 7 }' > /dev/null
curl -X DELETE "$PROVENANCE_API/v1/authorize/policies/trial" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({ "trial_days": 7 }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/trial`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": True
}
}
]
}
}).json()
checkout_version = step1["version"]
step2 = httpx.post(f"{api}/v1/authorize/policies/versions/{checkout_version}/publish", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"trial_days": 7
}).json()
data = httpx.delete(f"{api}/v1/authorize/policies/trial", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_trial",
"domain": "checkout",
"active": false,
"version": null
}Promote the trial run
POST/v1/authorize/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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl -s -X POST "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "trial_days": 7 }' > /dev/null
curl -X POST "$PROVENANCE_API/v1/authorize/policies/trial/promote" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": false
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": true
}
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({ "trial_days": 7 }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/trial/promote`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/policies/versions", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "big orders from new shoppers or unsigned agents",
"document": {
"rules": [
{
"id": "big-orders",
"label": "Big orders from new shoppers or unsigned agents",
"when": {
"match": "all",
"items": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
},
{
"match": "any",
"conditions": [
{
"fact": "agent.verified",
"op": "eq",
"value": False
},
{
"fact": "merchant.customer_account_age_days",
"op": "lt",
"value": 7
}
]
}
]
},
"require": {
"approval": True
}
}
]
}
}).json()
checkout_version = step1["version"]
step2 = httpx.post(f"{api}/v1/authorize/policies/versions/{checkout_version}/publish", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"trial_days": 7
}).json()
data = httpx.post(f"{api}/v1/authorize/policies/trial/promote", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_version",
"policy_id": "pol_AC2A5612965B31B91188589F91",
"version": 13,
"active": true,
"note": "big orders from new shoppers or unsigned agents",
"created_by": "key_7FHWBSCG1E8PJV9C3XB7HS0CF4",
"created_at": "2026-11-08T18:05:02.805Z",
"trial_ends_at": "2026-11-15T18:05:02.805Z",
"source": "api",
"domain": "checkout",
"promoted_from_trial": true
}Shadow a checkout rule version
POST/v1/authorize/policies/versions/{version}/shadow
Evaluates a saved version on every assessment beside your active rules, without enforcing it, and records its verdict on the assessment (shadow). One version 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_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X PUT "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl -X POST "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/shadow`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/authorize/policies", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": True
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": True
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": True
},
"reason": "over_store_limit"
}
]
}
}).json()
checkout_version = step1["version"]
data = httpx.post(f"{api}/v1/authorize/policies/versions/{checkout_version}/shadow", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_version",
"domain": "checkout",
"version": 5,
"active": true,
"shadow": true
}Stop shadowing checkout rules
DELETE/v1/authorize/policies/versions/{version}/shadow
Stops evaluating the shadow version. The version stays in your history.
Parameters
versionintegerpathRequired- The version number.
Returns
The shadow is off.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X PUT "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}' > step.json
export CHECKOUT_VERSION=$(jq -r '.version' step.json)
curl -X DELETE "$PROVENANCE_API/v1/authorize/policies/versions/$CHECKOUT_VERSION/shadow" \
-H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/authorize/policies" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/nullconst step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies`, {
method: "PUT",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": true
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": true
},
"reason": "over_store_limit"
}
]
}
}),
})).json();
const checkoutVersion = step1.version;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/versions/${checkoutVersion}/shadow`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.put(f"{api}/v1/authorize/policies", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"note": "ask for gift cards over 100 and digital orders to a new address",
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": True
}
},
{
"id": "digital-new-address",
"when": [
{
"fact": "merchant.delivery_timeframe",
"op": "eq",
"value": "electronic"
},
{
"fact": "merchant.ship_to",
"op": "eq",
"value": "new_address"
}
],
"require": {
"approval": True
}
},
{
"id": "no-bulk",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 5000
}
],
"require": {
"deny": True
},
"reason": "over_store_limit"
}
]
}
}).json()
checkout_version = step1["version"]
data = httpx.delete(f"{api}/v1/authorize/policies/versions/{checkout_version}/shadow", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}).json()Response 200
{
"object": "policy_shadow",
"domain": "checkout",
"shadow": false
}Simulate your checkout rules
POST/v1/authorize/policies/simulate
Evaluates a draft or your active checkout rules against facts you supply and changes nothing. checkout.covered stands in for the coverage check. With phase: after_approval, only your after-approval rules run (approval.decision defaults to approved), and outcome is the cart approval's status: approved, in_review or denied.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentobject- Draft rules to test; omit to use your active rules.
factsobject- The facts the rules read:
checkout.covered,order.*,agent.*,merchant.*,network.*. orderobject- A cart (
order_id, integertotalin minor units,currency,items); itsorder.*facts joinfacts. requestobject- The request a
fieldcondition reads itspathfrom:order(the cart) andmetadata(the cart's metadata), as on an assessment. phaseenum- Which rules run: the assessment's (default) or the after-approval rules. One of
assess,after_approval.
Returns
The outcome the facts would get.
Errors
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/authorize/policies/simulate" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "small-orders",
"label": "No mandate or approval, under $25",
"when": [
{
"fact": "checkout.covered",
"op": "eq",
"value": "none"
},
{
"fact": "order.amount",
"op": "lt",
"value": 25
}
],
"require": {
"no_challenge": true
}
}
]
},
"facts": {
"checkout.covered": "none",
"order.amount": 20
}
}'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/policies/simulate`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": true
}
},
{
"id": "small-orders",
"label": "No mandate or approval, under $25",
"when": [
{
"fact": "checkout.covered",
"op": "eq",
"value": "none"
},
{
"fact": "order.amount",
"op": "lt",
"value": 25
}
],
"require": {
"no_challenge": true
}
}
]
},
"facts": {
"checkout.covered": "none",
"order.amount": 20
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/authorize/policies/simulate", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"document": {
"rules": [
{
"id": "gift-cards",
"when": [
{
"fact": "merchant.gift_card_amount",
"op": "gt",
"value": 100
}
],
"require": {
"approval": True
}
},
{
"id": "small-orders",
"label": "No mandate or approval, under $25",
"when": [
{
"fact": "checkout.covered",
"op": "eq",
"value": "none"
},
{
"fact": "order.amount",
"op": "lt",
"value": 25
}
],
"require": {
"no_challenge": True
}
}
]
},
"facts": {
"checkout.covered": "none",
"order.amount": 20
}
}).json()Response 200
{
"object": "policy_simulation",
"domain": "checkout",
"outcome": "allow",
"reason": "policy_rule_approved",
"policy": {
"id": "pol_78F44446F59D72D9B2D553FA8D",
"version": 0,
"rule": {
"id": "small-orders",
"ref": null,
"name": "No mandate or approval, under $25",
"phase": "assess",
"action": "approve",
"conditions": [
{
"fact": "checkout.covered",
"op": "eq",
"value": "none",
"actual": "none"
},
{
"fact": "order.amount",
"op": "lt",
"value": 25,
"actual": 20
}
]
}
}
}