View as Markdown

Concepts

Policies

A policy is your account's versioned list of rules that decides whether something is allowed, denied or sent to a person for approval. Every product uses the same format: rules with when conditions and a require, saved as versions, simulated before you save and tested on live traffic before they enforce anything. You change what's allowed with no code change.

ProductWhat its policy decidesGuide
IdentifyWhich agents and bots get through to your site or APIWrite a traffic policy
AuthorizeWhether an agent checkout is approved, challenged or rejected, and when buying from another agent needs a personSet your checkout rules, seller rules
AttestWhether a captured photo is approved, sent to review or rejected, and which signals a claim must carryCapture rules, risk scoring
MandateWhether an agent's action runs, is denied, or waits for a person's approvalBuild a policy

The rest of this page uses the Mandate policy, which checks an agent's action at every verify; the other domains read their own facts with the same rules. Domains lists each one's path.

When to use it

  • Require a passkey or a person's approval above an amount, or for some action types.
  • Deny actions outright, such as payments to counterparties outside an approved list.
  • Rate-limit an agent, or hand the decision to your own service.

How it works

  1. Your executor sends facts. Verify reads facts from the token, from the request's context, and from Provenance itself, such as velocity and time.
  2. Rules run in order. Each rule has when conditions (all of them, any of them or none of them, with one level of groups) and a require. The first rule that matches and whose requirement isn't met decides the result.
  3. Verify returns the outcome. No failing rule means valid: true. Otherwise the result names the reason and the rule that decided (policy), or returns approval_pending.
  1. Facts
    token, context, velocity, time
  2. Rules, in order
    first unmet requirement decides
  3. Result
    valid, denied or approval_pending

The token checks (signature, expiry, description and payload) always run first. A condition on a fact that's missing doesn't match, so the rule doesn't apply. Accounts that never saved a policy use the default: hardware-backed devices above 500, and a passkey when context.require_biometric is true.

Key fields

idstring
Set by Provenance: rul_ and a ULID, returned as policy.rule.id. Leave it out for a new rule; send it back unchanged to keep the rule across versions. See rule ids.
labelstring
Optional. The rule's name, such as "Large invoices". Evaluation never reads it.
whenobject[] | object
Conditions, each { fact, op, value }. A list means all must match; { "match": "any", "items": [...] } picks all, any or none ("none", a NOT group) over conditions and groups. Empty matches every action. See build a policy.
requireobject
What a matching action needs; see the table below.
reasonstring
Optional. Replaces the derived reason code in the result.
requireMeets the rule whenOtherwise
biometric: trueThe approval behind the token was biometric (from Provenance's record of it, never a claim in the token)policy_biometric_required
hardware: trueThe approving device was hardware-attested (from the same record)policy_hardware_required
min_tier: "<tier>"The device's tier is at least <tier>: simulated, software, tee, strongbox, seppolicy_tier_required
deny: trueNeverpolicy_denied
approval: trueA person approved this token; add approvers: N for N people, and individual: true to keep it out of batch approvalapproval_pending; see step-up approval
webhook: "<name>"Your service answers allowpolicy_webhook_denied

With approval: true, a route chooses who gets the request, who it goes to next and how long it waits. It never changes what the rule requires. See route approvals.

auto_approve

With approval: true, auto_approve holds up to 5 clauses that give the approval without a person. A clause approves when its own conditions hold, it's within its limit, the token isn't one of its spot checks, and no run-time guard needs a person.

The verify is then valid, the approval is recorded with decided_via: "rule", and the ledger row carries auto_approval. A clause is refused where a person is always required (auto_approve_not_allowed). See automate approvals.

{
  "id": "invoices",
  "when": [{ "fact": "action_type", "op": "eq", "value": "pay_invoice" }],
  "require": {
    "approval": true,
    "auto_approve": [{
      "id": "northside-small",
      "label": "Northside invoices under $500",
      "when": [
        { "fact": "counterparty", "op": "in_list", "value": "auto_payees" },
        { "fact": "transaction_amount", "op": "lte", "value": 500 }
      ],
      "limit": { "window": "week", "max_amount": 2000 },
      "sample_rate": 20,
      "expires_at": "2027-01-29T15:00:00.000Z"
    }]
  }
}

external_confirmations

A policy document may carry one external_confirmations section beside rules: the confirmations a person gave outside Provenance that count for your account. It is empty by default, it also governs your store's cart approvals, and it's on every plan. The issuers it lists are also the ones whose mandates cover a checkout assessment's cart.

{
  "rules": [],
  "external_confirmations": {
    "accept": ["ap2_user_mandate", "spc"],
    "ap2_issuers": [{ "name": "Example Wallet", "jwks_url": "https://wallet.example/.well-known/jwks.json" }]
  }
}
acceptstring[]
The kinds that count: ap2_user_mandate, spc, platform.
ap2_issuersobject[]
Required with ap2_user_mandate: each issuer's name and https jwks_url. Mandates are verified against these keys only. A listed wallet's mandate also covers a checkout assessment's cart, with or without accept.
acp_issuersobject[]
ACP issuers you trust: each one's name and https jwks_url. A completion whose signed intent one of them signed covers a checkout assessment's cart.
platformsobject[]
Required with platform: each agent platform's name and https jwks_url.

How each kind is checked: ask once.

Facts

FactTypeFrom
transaction_amount, action_type, counterparty, and any other scalar you sendScalarcontext at verify
require_biometricBooleancontext at verify
action_descriptionStringThe verify request
hardware_attested, biometric_boundBooleanThe approval record for the token
device_trust_tierStringThe approval record for the token
payload_boundBooleanVerify
intent_token_age_secondsNumberVerify
agent_idStringThe approval record, for a registered agent
hour_utc, weekday_utcNumberThe verify time, in UTC (weekday_utc 0 is Sunday)
approval.option_count, approval.chosen_optionNumberThe approval of a choose-one request
approval.batchedBooleanAn approval decided in a batch
approval.group_sizeNumberA group request
order.amount, order.currency, order.item_count, order.skus, order.categories, order.channel, …Number, string, listAn intent whose payload is a cart, or a deal; see route on what's in the order
counterparty.verified, counterparty.domain_verified, counterparty.has_recordBooleanA deal's seller (action_type: "deal.accept")
counterparty.deals_completed_count, counterparty.rating_count, counterparty.rating, counterparty.on_time_rate, counterparty.dispute_rateNumberA deal's seller; a rate or rating is absent until the seller has a record
purpose.fit, purpose.checkStringAn action under a child grant: the pattern check (inside, outside, untagged) and the opt-in AI check (consistent, unclear, inconsistent, unavailable); see keep subagents on task
delegation.depth, delegation.parent_agent, delegation.rootNumber, stringAn action under a child grant: hand-offs from the person's grant, the agent that handed it on, and the person's grant
delegation.over_limitStringThe limit a person would be asked about (amount, budget, dates, category, counterparty, block, uses, purchases, country), or none under a child grant; see over the limit at verify
run.depth, run.members_count, run.denials_count, run.out_of_scope_countNumberA token minted in an agent-team run; see halt a run
network.loop_flaggedBooleanA deal's or tab's seller: its account trades mostly with one company or a small group, so those deals don't count toward its record

The operators are:

opMatches when the fact
eq, neEquals, or doesn't equal, value
gt, gte, lt, lteCompares to the number value; never matches a non-number
inIs one of the array value
matchesMatches the glob value, with * and ?
in_list, not_in_listIs, or isn't, in the named list value
contains, contains_anyIs a list that holds value, or any of the array value
is_empty, is_not_emptyIs missing, null, an empty string or an empty list; or holds any other value. Takes "value": true

Every operator except is_empty and is_not_empty doesn't match a missing or null fact, ne included. To act on a fact that isn't there, test it with is_empty:

{ "fact": "billing.country", "op": "is_empty", "value": true }

A "none" rule or group holds when none of its conditions do, so a condition on a missing fact counts toward it:

{ "match": "none", "items": [{ "fact": "billing.country", "op": "in", "value": ["US", "CA"] }] }

0, false and an external provider's unavailable answer are values, so is_empty doesn't match them; if_unavailable decides the provider case. On a request field, a path through a list (items[].sku) is empty when no element holds a value. Spend and request limits, canaries and probes always hold a number, so they don't take either operator.

Try a rule

POST /v1/mandate/policies/simulate evaluates a draft document against facts you supply, and changes nothing. Export the sandbox account key first:

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5

curl $PROVENANCE_API/v1/mandate/policies/simulate \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document": { "rules": [{
      "label": "Wires over 10k denied",
      "when": [{ "fact": "action_type", "op": "eq", "value": "wire" }, { "fact": "transaction_amount", "op": "gt", "value": 10000 }],
      "require": { "deny": true }
    }] },
    "facts": { "action_type": "wire", "transaction_amount": 12000 }
  }'
{
  "object": "policy_simulation",
  "domain": "intent",
  "allowed": false,
  "reason": "policy_denied",
  "policy": {
    "id": "pol_3F9A1C7E52B04D8E6A1F27C9B4",
    "version": 0,
    "rule": {
      "id": "rul_01JD2Q8V5KX4T7M2R9B3C6D8EF",
      "name": "Wires over 10k denied",
      "phase": "assess",
      "action": "reject",
      "conditions": [
        { "fact": "action_type", "op": "eq", "value": "wire", "actual": "wire" },
        { "fact": "transaction_amount", "op": "gt", "value": 10000, "actual": 12000 }
      ]
    }
  }
}

policy is the rule that decided, the same block on every product: the policy's ID and the version that decided (0 for a draft you simulate, null for the built-in default), the rule's ID and name, its action (Approve, Challenge, Reject or Review), and each condition with the value the engine compared (actual). Only the deciding rule is listed. It is null when no rule decided.

Save, roll back and reset

PUT /v1/mandate/policies validates a document, saves it as the next version and makes it active. Versions never change once saved. Roll back by publishing an older one again with POST /v1/mandate/policies/versions/{version}/publish, or return to the default with DELETE /v1/mandate/policies, which keeps the history.

curl -s -X PUT $PROVENANCE_API/v1/mandate/policies \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "cap wires at 10k",
    "document": { "rules": [{
      "label": "Wires over 10k denied",
      "when": [{ "fact": "action_type", "op": "eq", "value": "wire" }, { "fact": "transaction_amount", "op": "gt", "value": 10000 }],
      "require": { "deny": true }
    }] }
  }' | tee policy.json
export POLICY_VERSION=$(jq -r .version policy.json)
{
  "object": "policy_version",
  "policy_id": "pol_6F2A91C04B7D3E58A1F09C2D47",
  "domain": "intent",
  "version": 1,
  "active": true,
  "note": "cap wires at 10k",
  "document": {
    "rules": [
      {
        "id": "rul_01JD2Q8V5KX4T7M2R9B3C6D8EF",
        "label": "Wires over 10k denied",
        "when": [{ "fact": "action_type", "op": "eq", "value": "wire" }, { "fact": "transaction_amount", "op": "gt", "value": 10000 }],
        "require": { "deny": true }
      }
    ]
  }
}

Rule ids

Provenance sets each rule's id: rul_ and a ULID, given when the rule is first saved and kept in every later version while the rule exists, so a rule id and a version name one rule text. The write returns the document as saved, with its ids; the policy itself has an id (pol_…) that stays the same on every version.

  • Leave id out for a new rule. Send a saved rule back with its id to keep it.
  • A rul_ id this policy never had is replaced with a new one, so a rule copied from another account or a draft starts its own history.
  • Any other id you send (such as one written before ids were set by Provenance) is kept on the rule as legacy_id, and sending it again names the same rule. A decision recorded with an old id still finds its rule.
  • rul_default_ is reserved for the default rows, which have the same ids in every account. A rule of your own can't use it (400 policy_invalid).

Invalid documents are refused with a 400 that points at the failing rule. A policy holds up to 50 rules of up to 10 conditions each.

Test a version on live traffic

A shadow version runs on every verify alongside the active one, on the same facts, but never enforces anything: responses, approvals and notifications are unchanged, and the shadow's verdict is recorded on each decision. Saving activates a version, so to shadow one, return to the policy you want enforced and then mark the saved version with POST /v1/mandate/policies/versions/{version}/shadow:

curl -s -X DELETE $PROVENANCE_API/v1/mandate/policies \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -X POST $PROVENANCE_API/v1/mandate/policies/versions/$POLICY_VERSION/shadow \
  -H "Authorization: Bearer $PROVENANCE_KEY"
{ "object": "policy_version", "domain": "intent", "version": 1, "active": false, "shadow": true }

GET /v1/mandate/policies/shadow_report then shows how the shadow compared: how many verifies it evaluated, where it disagreed with the active policy, and which decisions it would have denied. When the report looks right, activate the version. Stop shadowing with DELETE /v1/mandate/policies/versions/{version}/shadow. One version per domain can be the shadow.

Lists

A list is a named set of values, such as approved suppliers, for in_list and not_in_list conditions. Lists are available on every plan, hold up to 10,000 entries, and are replaced whole on each write to PATCH /v1/account/policies/lists/{name}:

curl -X PATCH $PROVENANCE_API/v1/account/policies/lists/approved-suppliers \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "kind": "allow", "entries": ["acct_brindlecote_supplies", "acct_acme"] }'
{
  "object": "policy_list",
  "name": "approved-suppliers",
  "kind": "allow",
  "count": 2
}

A rule then reads { "fact": "counterparty", "op": "not_in_list", "value": "approved-suppliers" } with "require": { "deny": true }.

Advanced conditions

Velocity is on Pro and above (on every plan until 2026-11-17). Several approvers needs Enterprise. Below either, the save is refused with a 402 naming the rules.

ConstructPlanShapeUse it for
VelocityPro{ "fact": "velocity", "metric", "window", "per", "op", "value" }Spend and request limits from the decision ledger. metric is verify_count or amount_sum; window is 1h or 24h (rolling) or month (the calendar month in UTC); per is device, session, account or agent (the registered agent the token names; a month counts per account or agent). Prior valid verifies count; the current one doesn't.
Several approversEnterprise"require": { "approval": true, "approvers": 2 }Actions that need that many different approvers. Each person counts once, and all of the account's API keys together count as one. A denial by any of them is final. On Pro, an approval chain step with mode: "n_of_m" asks several people instead.

The policy builder's Monthly limit per agent template is a velocity rule: once an agent's approved spend this month reaches the amount, every further order asks.

{ "id": "monthly-agent-limit", "when": [{ "fact": "velocity", "metric": "amount_sum", "window": "month", "per": "agent", "op": "gte", "value": 2000 }], "require": { "approval": true } }

A policy webhook rule, "require": { "webhook": "<name>" }, asks your own service and needs Pro or above. Provenance posts the facts, signed like webhooks, and waits up to 3 seconds for its decision; no answer denies with policy_webhook_unavailable.

Canary conditions read a Trace canary score, such as { "fact": "canary", "set": "prompt_injection", "op": "gte", "value": 1 }. They are on every plan, as are Trace rules. The console's policy editor has starting templates for consumer payments, treasury, canary guardrails and agent sandboxes.

Combine checks

Checkout, agent and Trace rules can stack weak checks. Every construct here is on every plan.

Nested groups. A group inside a rule's when can hold groups, three levels deep with the rule's own. A group can also hold when at least n of its items do ("match": "at_least"):

{ "label": "Many weak signals", "when": { "match": "all", "items": [
  { "fact": "order.amount", "op": "gt", "value": 250 },
  { "match": "at_least", "n": 2, "conditions": [
    { "fact": "signal.new_device", "op": "eq", "value": true },
    { "fact": "agent.bot_score", "op": "gt", "value": 80 },
    { "fact": "customer.orders_90d", "op": "eq", "value": 0 }
  ] }
] }, "require": { "deny": true } }

Signals. A signal is a named check with no outcome. Rules read it as signal.<key>, true or false. A signal can read other signals; a loop is refused with policy_cycle. Signals, scorecards and rule groups work on checkout, agent, capture, Trace and issuer rules; on capture and issuer rules they read that rule set's own facts.

{ "signals": [{ "label": "New device", "when": [{ "fact": "device.first_seen_days", "op": "lt", "value": 2 }] }] }

You name each signal with label and can rename it at any time. Its key comes from the first label (new_device) and doesn't change after that.

Scorecards. A scorecard adds up points from signals and checks, and rules act on the total. Each row reads a signal or its own when and carries points from -100 to 100. Rules read scorecard.<key>.score (the total) and scorecard.<key>.matched (how many rows matched):

{ "scorecards": [{ "label": "Order risk", "rows": [
    { "signal": "new_device", "points": 25 },
    { "label": "Large order", "when": [{ "fact": "order.amount", "op": "gt", "value": 500 }], "points": 25 }
  ] }],
  "rules": [{ "label": "High risk", "when": [{ "fact": "scorecard.order_risk.score", "op": "gte", "value": 50 }], "require": { "deny": true } }] }

A row whose fact is unavailable follows if_unavailable below and adds nothing by default. When fewer rows can be read than min_available (all rows but one, unless you set it), the total itself is unavailable. A rule set holds up to 10 scorecards of 30 rows.

Rule references and rule groups. A rule can read another rule saved before, by its short id: rule.R-103.matched is true when that rule's conditions hold for this request, whatever decided first.

A rule group names an ordered set of rules: list it under groups and set group on each of its rules. The group's rules still run in order as ordinary rules, and group.risk_checks.outcome reads what they give on their own: the outcome of the first of them that matches, else none.

{ "label": "Risk checks flagged it", "when": [{ "fact": "group.risk_checks.outcome", "op": "in", "value": ["reject", "challenge"] }], "require": { "approval": true } }

A rule that reads itself, or two that read each other, is refused with policy_cycle. A rule that approves on model-scored facts alone saves; the version's plan lists it in approve_on_tier3_only.

Sub-flows. A sub-flow is a named block of rules you keep once and run from more than one rule set: your checkout rules and your agent rules can both call "New customer checks". Create it with POST /v1/account/policies/flows, save its rules as a version (POST /v1/account/policies/flows/{key}/versions) with the facts it reads (inputs) and anything callers can read besides its outcome (outputs), then publish one. Its rules give one of the four outcomes; its outcome is the first rule that matches, else none.

A rule set lists the flows it calls under flows and reads flow.<key>.outcome, flow.<key>.version and each output, or takes the outcome as its own with "require": { "flow": "<key>" } (the flow's none passes to the next rule):

{ "flows": [{ "key": "new_customer_checks" }],
  "rules": [{ "label": "New customer checks", "when": [{ "fact": "order.amount", "op": "gt", "value": 100 }], "require": { "flow": "new_customer_checks" } }] }

A call follows the latest version by default, so publishing a new version changes every rule set that follows it at once. Pin a rule set with { "key": "new_customer_checks", "follow": "pinned", "version": 3 } to keep a version until you move the pin.

Before a version is published, each rule set that follows the latest runs its backtest with the new version (POST /v1/account/policies/flows/{key}/versions/{version}/backtest). When Challenge plus Reject moves by more than 5 points in any of them, publishing needs acknowledge_rate_change: true: one acknowledgement covers every rule set that follows, whoever publishes.

A rule set can call a sub-flow only when its domain has every input; a save or a publish that would break this is refused with policy_flow_input_missing, naming the facts or the rule sets.

Each decision records the versions it ran on (flow.<key>.version in its facts), so a replay of an old decision runs on what it ran on. Sub-flows call sub-flows up to three deep; a loop is refused with policy_cycle and its path. A sub-flow a published rule set calls can't be archived (policy_flow_in_use). Checkout and agent rules call sub-flows.

When a fact is unavailable. A fact your rules read can come back unavailable: a provider timed out or isn't set up. if_unavailable says what that means, on a condition, a rule or the whole document (settings.if_unavailable), the most specific first:

SettingWhat happens
skipThe condition doesn't match
matchThe condition matches and the rule's outcome applies
askThe condition matches and a person is asked instead of the rule's outcome. Issuer rules refuse it

With no setting, a condition reads the fact as it always has. Trace rules keep fail_closed and fail_open for Trace findings.

Spot checks. A Reject rule rejects records nobody can label later. Turn on spot checks with "require": { "deny": true, "sample_rate": 20 } and 1 in 20 of the records it would reject is challenged instead, chosen from the record's id. They're off until you set sample_rate (2 to 100), on checkout, agent, capture and Trace rules.

A spot-checked capture goes to In review and a Trace action to Review. Trace rules at phase completion and issuer rules refuse spot checks, because nobody can answer in time.

The path that decided. When the deciding rule nests, reads a signal, a scorecard, another rule or a group, or met an unavailable fact, its policy block carries trace: the rule's path as a tree, each part with its value and whether it matched, a scorecard with its rows. Facts that were unavailable are listed in the block's unavailable with the reason. A flat rule's block is unchanged.

"trace": { "nodes": [{ "kind": "scorecard", "key": "order_risk", "label": "Order risk", "score": 80, "op": "gte", "value": 75, "result": true,
  "rows": [{ "label": "Large order", "points": 50, "matched": true }, { "label": "Has items", "points": 30, "matched": true }] }] }

Before and after on past records. A backtest (POST /v1/authorize/policies/backtest and the other policies' backtest) replays each recent record under your live version and the draft. Beside its counts it returns rates (each outcome's share and order value under both, and the change in points) and changes (the records whose outcome would change, newest first). On checkout rules it also returns labels: true positive declines, false positive declines, missed and allowed for both versions, with what the draft newly stops.

The records that would change. A backtest of a checkout or agent policy that had records to compare is kept and returns an id. GET /v1/authorize/policies/backtest/{id}/changes pages them, newest first. The newest 20 backtests per policy are kept, with at most 500 records each.

Publishing a tested draft. Send version in place of document to backtest a saved draft. If that backtest moves Challenge plus Reject by more than 5 points, publishing the draft answers 409 policy_rate_change_unacknowledged with the change. Publish again with acknowledge_rate_change: true. Restoring an earlier version and starting a trial run are never asked.

A rejected order can't be disputed, so it counts as right or wrong only when a label says so; otherwise it is "No label yet". Under 20 labelled orders, enough_labels is false and the figures are only counts.

Checks at save. A save is refused when a condition names a fact no rule set can read (policy_fact_unknown), uses an operator that never matches the fact's type (policy_type_mismatch), or goes past a cap (policy_too_large: 50 signals, groups three levels deep). A condition kept exactly as your live version had it only warns, in the plan's warnings.

Domains

Each policy domain is versioned separately and has its own path:

PathDecides
/v1/mandate/policiesAgent decisions, as on this page
/v1/authorize/policiesWhether an agent checkout is approved, challenged or rejected (checkout rules); the seller rules templates are saved here as rules
/v1/attest/risk_policiesAttest's risk thresholds and required signals
/v1/attest/capture_policiesWhether each captured photo is approved, in review or rejected (capture rules)
/v1/identify/policiesWhich agents and bots Identify lets through