SDK reference · Node SDK

prov.mandate.policies.set

prov.mandate.policies.set in Node SDK. Validate + create a new version and activate it.

Signature

prov.mandate.policies.set(document: AnyPolicyDocument, opts?: { note?: string } & DomainOpts): Promise<PolicyVersion>

Parameters

documentAnyPolicyDocumentRequired
opts{ note?: string } & DomainOpts

Request fields

documentobjectRequired
A RiskPolicyDocument (claims_risk) or intent PolicyDocument.
Show child attributes
thresholdsobject
Status cutoffs; must satisfy 0 < verified < partial < 100. They never apply to an asset with signature_invalid, device_revoked or device_cert_mismatch, which is always failed.
Show child attributes
verifiednumber
Whether it was verified.
partialnumber
How many were partial.
factor_weightsobject
Per-factor point overrides, keyed by risk-factor code (e.g. gps_absent). Each value is CLAMPED to [0, 2×default] at evaluation. Re-weighting a decisive factor (signature_invalid, device_revoked, device_cert_mismatch) changes the score but not the failed status.
rulesarray of objects
Required-signal rules. When a rule's when matches and the required signal is absent, an ADVISORY CARRIER_POLICY_<SIGNAL>_MISSING factor is added (never a hard failure).
Show child attributes
idstringRequired
Unique identifier for the object.
labelstring
The rule's name in the builder.
enabledboolean
Whether the rule is on. false keeps it but it fires no signal; absent means on.
whenarray of objects | object
A rule's or signal's IF part. Either a list of conditions that must all match, or an object that picks a mode over conditions and groups (groups nest to three levels with the rule's own; at most 10 items in a group and 20 conditions in all).
Show child attributes
matchenum
Whether all, any, none or at least n of the items must match (none holds when no item does). One of all, 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), or field to read path from the request.
openum
The comparison operator. A field condition takes the comparisons, in, matches, contains, contains_any, is_empty and is_not_empty. Every operator except the two null operators fails to match a missing or null fact, ne included. is_empty matches a fact that is missing, null, an empty string or an empty list; is_not_empty matches any other value.
valueany
The value to compare with (a string, number, boolean or a list of them). is_empty and is_not_empty take true.
pathstring
With fact: field: up to 6 dotted names, each optionally followed by [] for every element of a list (at most one []), such as metadata.cost_center or order.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 of verify_count, amount_sum.
windowenum
With fact: velocity: the window. 1h and 24h are rolling; month is the calendar month in UTC, counted per account or agent. One of 1h, 24h, month.
perenum
With fact: velocity: what it is counted per. agent is the registered agent the token names (none: 0). One of device, session, account, agent.
setstring
With fact: canary or prediction: the canary family or probe.
best_effortboolean
With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum
With z_gt or pct_gt: the baseline the score is compared against. One of agent, account.
if_unavailableenum
What an unavailable reading means for this condition: skip (no match), match, or ask (match and ask a person). ignore is an external risk fact's older word for skip; a capture fact or Trace finding takes skip or match. One of skip, match, ask, ignore.
matchenum
Whether all, any, none or at least n of the group's items must match (none holds when no item does; a condition on a missing fact doesn't hold). One of all, any, none, at_least.
ninteger
With match: at_least: how many items must match (1 to the item count). N-of-M.
conditionsarray of objects
The group's conditions and groups (1 to 10).
requireobjectRequired
What a matching action needs.
Show child attributes
signalenum
The signal a matching capture must carry: gps, biometric or attestation. One of gps, biometric, attestation.
timezonestring
An IANA time zone, such as America/Chicago, for a person's time.local_hour and time.local_weekday facts.
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 without accept.
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.issuer shows 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
enabledboolean
false: a call never approves; it reads the request and sends the passkey link. Default true.
voice_maxinteger
Approve on the call up to this amount, in minor units of currency. Default 2500 (25.00 USD). 0 means never.
currencystring
The ISO 4217 currency of voice_max. Default USD. 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 n of the items must match (none holds when no item does). One of all, 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), or field to read path from the request.
openum
The comparison operator. A field condition takes the comparisons, in, matches, contains, contains_any, is_empty and is_not_empty. Every operator except the two null operators fails to match a missing or null fact, ne included. is_empty matches a fact that is missing, null, an empty string or an empty list; is_not_empty matches any other value.
valueany
The value to compare with (a string, number, boolean or a list of them). is_empty and is_not_empty take true.
pathstring
With fact: field: up to 6 dotted names, each optionally followed by [] for every element of a list (at most one []), such as metadata.cost_center or order.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 of verify_count, amount_sum.
windowenum
With fact: velocity: the window. 1h and 24h are rolling; month is the calendar month in UTC, counted per account or agent. One of 1h, 24h, month.
perenum
With fact: velocity: what it is counted per. agent is the registered agent the token names (none: 0). One of device, session, account, agent.
setstring
With fact: canary or prediction: the canary family or probe.
best_effortboolean
With a canary or probe: an unavailable reading evaluates false instead of failing closed.
baselineenum
With z_gt or pct_gt: the baseline the score is compared against. One of agent, account.
if_unavailableenum
What an unavailable reading means for this condition: skip (no match), match, or ask (match and ask a person). ignore is an external risk fact's older word for skip; a capture fact or Trace finding takes skip or match. One of skip, match, ask, ignore.
matchenum
Whether all, any, none or at least n of the group's items must match (none holds when no item does; a condition on a missing fact doesn't hold). One of all, 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 signal and when).
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 n of the items must match (none holds when no item does). One of all, 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>.version and each declared output flow.<key>.<output>, or take the flow's outcome with require.flow.
Show child attributes
keystringRequired
The sub-flow's key.
followenum
latest (the default) follows the published version; pinned keeps version. One of latest, pinned.
versioninteger
The pinned version (only with follow set to pinned).
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) or ask (it matches and a person is asked instead of the rule's outcome; refused on issuer rules). The older fail_closed and fail_open stay Trace and agent rules' words for an unavailable Trace finding. One of skip, match, ask, fail_closed, fail_open.
preflightboolean
Trace rules only: run the rules on model output on the prompt first, before generation.
resolveenum
needed (default) reads only the facts the deciding rule still needs; ahead also reads the same cost tier of later rules, one round sooner. One of needed, 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) and after_approval (an approved cart; Approve), each approve, challenge or reject (approve, review or reject after approval). Capture rules have passes (Approve) and flagged (Review), each approve, review or reject. Agent policies have assess (an action no rule decides; Approve by default), approve, review (ask a person) or reject. 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

Promise<PolicyVersion> The new policy version.

HTTP operation

PUT /v1/mandate/policies: Publish a policy

Errors

Example

const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/mandate/policies`, {
  method: "PUT",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "note": "cap wires at 10k",
    "document": {
      "rules": [
        {
          "label": "Wires over 10k denied",
          "when": [
            {
              "fact": "action_type",
              "op": "eq",
              "value": "wire"
            },
            {
              "fact": "transaction_amount",
              "op": "gt",
              "value": 10000
            }
          ],
          "require": {
            "deny": true
          }
        }
      ]
    }
  }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.