Platform · API reference
Policy builder
The builder's account-wide settings: the field catalog, templates, the approval expiry default, who can manage policies, outside approver seats and migrations.
Related guide: Build a policy
The policy settings object
Attributes
objectenumRequired- The type of object. One of
policy_settings. approval_expiry_defaultenumRequired- What happens when an approval chain ends unanswered: decline, escalate to the owner for one more day, approve at or under
approve_below_amount, or hold it open (up to 7 days). An account that hasn't chosen readsexpirewithis_defaulttrue: the request expires and never goes ahead. One ofexpire,decline,escalate_owner,approve_below,hold. approve_below_amountnumber | null- With
approve_below: the amount an unanswered request is approved at or under. checkout_review_timeoutinteger- How long a checkout review waits for your decision, in seconds (default 86400, 24 hours). Applies to reviews opened after a change.
checkout_review_at_expiryenum- What a checkout review does when nobody decides it in time (default
reject: the approval endsexpired,deny_reason: review_expired). One ofreject,approve. checkout_token_downgrade_windowinteger- How far back
agent.recent_token_presentedlooks for an intent token or a mandate from the same agent or visit, in seconds (default 86400, 24 hours). The default rule "Unclassified" challenges an order with nothing attached from an agent that sent one inside it. is_defaultbooleanRequired- Whether the account still has the factory default.
updated_attimestamp | null- When the setting last changed.
can_manageboolean- Whether the caller may change it (Manage policies).
Create a sub-flow
POST/v1/account/policies/flows
Creates a sub-flow with a label. Its key comes from the label (or key) and is then fixed; rule sets call it by the key. Add its rules with POST /v1/account/policies/flows/{key}/versions. Needs Manage policies (a key needs the authorize or mandate scope).
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
labelstringRequired- The account's name for the sub-flow.
keystring- The key (default derived from the label).
Returns
The sub-flow, created with no version.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "New customer checks", "key": "smp_create_checks" }'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "New customer checks", "key": "smp_create_checks" }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "New customer checks",
"key": "smp_create_checks"
}).json()Response 201
{
"object": "policy_flow",
"id": "pfl_01M8WNRNVW45QQ3DQWHN6HJ9GG",
"key": "smp_create_checks",
"label": "New customer checks",
"published_version": null,
"archived": false,
"archived_at": null,
"created_at": "2026-12-03T00:44:42.748Z",
"updated_at": "2026-12-03T00:44:42.748Z"
}Retrieve a sub-flow
GET/v1/account/policies/flows/{key}
Returns one sub-flow and the version callers that follow the latest run on.
Parameters
No parameters.
Returns
The sub-flow.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_get_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_get_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl "$PROVENANCE_API/v1/account/policies/flows/smp_get_checks" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_get_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_get_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_get_checks`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_get_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_get_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
data = httpx.get(f"{api}/v1/account/policies/flows/smp_get_checks", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_flow",
"id": "pfl_01M8WNRNVW8YAQBXKF7RTH6Y2P",
"key": "smp_get_checks",
"label": "Sample checks",
"published_version": null,
"archived": false,
"archived_at": null,
"created_at": "2026-12-03T00:44:42.748Z",
"updated_at": "2026-12-03T00:44:42.748Z"
}Retrieve a sub-flow version
GET/v1/account/policies/flows/{key}/versions/{version}
Returns one version of the sub-flow, with its inputs, outputs and rules.
Parameters
No parameters.
Returns
The version.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_getversion_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_getversion_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl "$PROVENANCE_API/v1/account/policies/flows/smp_getversion_checks/versions/1" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_getversion_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_getversion_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_getversion_checks/versions/1`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_getversion_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_getversion_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
data = httpx.get(f"{api}/v1/account/policies/flows/smp_getversion_checks/versions/1", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_flow_version",
"key": "smp_getversion_checks",
"version": 1,
"published": false,
"inputs": [
"order.amount"
],
"outputs": [],
"document": {
"rules": [
{
"id": "rul_01M8WNRNW7N7DNPXQ7QJRK7Z6D",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
},
"label": "Large order"
}
]
},
"calls": [],
"published_at": null,
"acknowledgement": null,
"created_at": "2026-12-03T00:44:42.759Z"
}Retrieve a sub-flow's performance
GET/v1/account/policies/flows/{key}/performance
The sub-flow's counts in each calling rule set over UTC days (default the last 30): how many decisions the rules that take its outcome made, their value and the outcome of each. Served from the rule performance rollup.
Parameters
fromstringquery- The first UTC day (
YYYY-MM-DD). tostringquery- The last UTC day (default today).
Returns
One row per calling rule set.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_perf_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_perf_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_perf_checks/versions/1/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl "$PROVENANCE_API/v1/account/policies/flows/smp_perf_checks/performance" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_perf_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_perf_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_perf_checks/versions/1/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_perf_checks/performance`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_perf_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_perf_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
step3 = httpx.post(f"{api}/v1/account/policies/flows/smp_perf_checks/versions/1/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.get(f"{api}/v1/account/policies/flows/smp_perf_checks/performance", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_flow_performance",
"key": "smp_perf_checks",
"from": "2026-11-04",
"to": "2026-12-03",
"callers": []
}Retrieve a counterparty list
GET/v1/account/policies/lists/{name}
Returns one named list with its entries.
Parameters
namestringpathRequired- A name you choose.
Returns
The list and its entries.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -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"
]
}' > /dev/null
curl "$PROVENANCE_API/v1/account/policies/lists/approved-suppliers" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/approved-suppliers`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"kind": "allow",
"entries": [
"acct_brindlecote_supplies",
"acct_acme"
]
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/approved-suppliers`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.patch(f"{api}/v1/account/policies/lists/approved-suppliers", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"kind": "allow",
"entries": [
"acct_brindlecote_supplies",
"acct_acme"
]
}).json()
data = httpx.get(f"{api}/v1/account/policies/lists/approved-suppliers", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"id": "01M7W7YDBRQZ6HBHF0BWSQYQ74",
"object": "policy_list",
"name": "approved-suppliers",
"kind": "allow",
"count": 2,
"updated_at": "2026-11-20T10:27:28.760Z",
"entries": [
"acct_brindlecote_supplies",
"acct_acme"
]
}Rename a sub-flow
PATCH/v1/account/policies/flows/{key}
Changes the label. The key stays as it is, so every call keeps working.
Parameters
labelstringRequired- The new name.
Returns
The sub-flow, renamed.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_rename_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_rename_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -X PATCH "$PROVENANCE_API/v1/account/policies/flows/smp_rename_checks" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "First-order checks" }'const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_rename_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_rename_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_rename_checks`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "First-order checks" }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_rename_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_rename_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
data = httpx.patch(f"{api}/v1/account/policies/flows/smp_rename_checks", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "First-order checks"
}).json()Response 200
{
"object": "policy_flow",
"id": "pfl_01M8WNRNVZ1YQCC641R9D8J3AM",
"key": "smp_rename_checks",
"label": "First-order checks",
"published_version": null,
"archived": false,
"archived_at": null,
"created_at": "2026-12-03T00:44:42.751Z",
"updated_at": "2026-12-03T00:44:42.752Z"
}Set a counterparty list
PATCH/v1/account/policies/lists/{name}
Creates a named list or replaces it whole, with up to 10,000 entries.
Parameters
namestringpathRequired- A name you choose.
kindenum- What kind of object or event it is. One of
allow,deny. entriesarray of stringsRequired- The list's entries.
Returns
The list, replaced.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
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"
]
}'const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/approved-suppliers`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"kind": "allow",
"entries": [
"acct_brindlecote_supplies",
"acct_acme"
]
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.patch(f"{api}/v1/account/policies/lists/approved-suppliers", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"kind": "allow",
"entries": [
"acct_brindlecote_supplies",
"acct_acme"
]
}).json()Response 200
{
"id": "01M6VQBCN2CPGBXCN79FD6CDV7",
"object": "policy_list",
"name": "approved-suppliers",
"kind": "allow",
"count": 2,
"updated_at": "2026-11-07T19:21:46.405Z"
}List sub-flows
GET/v1/account/policies/flows
Returns the account's sub-flows, oldest first. A sub-flow is a named block of rules an account keeps once and calls from more than one rule set (checkout and agent rules).
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 sub-flows.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "list",
"data": [],
"has_more": false,
"next_cursor": null
}List a sub-flow's versions
GET/v1/account/policies/flows/{key}/versions
Returns the sub-flow's versions, newest first.
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 versions.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_versions_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_versions_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl "$PROVENANCE_API/v1/account/policies/flows/smp_versions_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_versions_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_versions_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_versions_checks/versions`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_versions_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_versions_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
data = httpx.get(f"{api}/v1/account/policies/flows/smp_versions_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "list",
"data": [
{
"object": "policy_flow_version",
"key": "smp_versions_checks",
"version": 1,
"published": false,
"inputs": [
"order.amount"
],
"outputs": [],
"document": {
"rules": [
{
"id": "rul_01M8WNRNW13BSHK8CCTZ7PAMXT",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
},
"label": "Large order"
}
]
},
"calls": [],
"published_at": null,
"acknowledgement": null,
"created_at": "2026-12-03T00:44:42.754Z"
}
],
"has_more": false,
"next_cursor": null
}List a sub-flow's callers
GET/v1/account/policies/flows/{key}/callers
The rule sets whose published version calls the sub-flow, each following the latest or pinned (with the version it runs on); and the rule sets that can't call it, with the inputs their domain lacks.
Parameters
No parameters.
Returns
The callers.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_callers_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_callers_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_callers_checks/versions/1/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl "$PROVENANCE_API/v1/account/policies/flows/smp_callers_checks/callers" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_callers_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_callers_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_callers_checks/versions/1/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_callers_checks/callers`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_callers_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_callers_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
step3 = httpx.post(f"{api}/v1/account/policies/flows/smp_callers_checks/versions/1/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.get(f"{api}/v1/account/policies/flows/smp_callers_checks/callers", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_flow_callers",
"key": "smp_callers_checks",
"published_version": 1,
"callers": [],
"cannot": []
}List counterparty lists
GET/v1/account/policies/lists
Lists your account's named lists, used by in_list and not_in_list conditions.
Parameters
No parameters.
Returns
The lists, with their entry counts.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/account/policies/lists" \
-H "Authorization: Bearer $PROVENANCE_KEY"const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists`, {
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/account/policies/lists", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "list",
"data": [],
"has_more": false,
"next_cursor": null
}Delete a counterparty list
DELETE/v1/account/policies/lists/{name}
Deletes a named list. Rules that name it stop matching.
Parameters
namestringpathRequired- A name you choose.
Returns
The deleted object.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -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"
]
}' > /dev/null
curl -X DELETE "$PROVENANCE_API/v1/account/policies/lists/approved-suppliers" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/approved-suppliers`, {
method: "PATCH",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"kind": "allow",
"entries": [
"acct_brindlecote_supplies",
"acct_acme"
]
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/lists/approved-suppliers`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.patch(f"{api}/v1/account/policies/lists/approved-suppliers", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"kind": "allow",
"entries": [
"acct_brindlecote_supplies",
"acct_acme"
]
}).json()
data = httpx.delete(f"{api}/v1/account/policies/lists/approved-suppliers", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"id": "01M7W7YJ1V129XCADT52D8NN68",
"object": "policy_list",
"deleted": true
}Archive a sub-flow
DELETE/v1/account/policies/flows/{key}
Archives the sub-flow: no rule set can call it after. Refused with 409 policy_flow_in_use while a published rule set calls it. Its versions are kept.
Parameters
No parameters.
Returns
The sub-flow, archived.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_archive_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_archive_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -X DELETE "$PROVENANCE_API/v1/account/policies/flows/smp_archive_checks" \
-H "Authorization: Bearer $PROVENANCE_KEY"const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_archive_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_archive_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_archive_checks`, {
method: "DELETE",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_archive_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_archive_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
data = httpx.delete(f"{api}/v1/account/policies/flows/smp_archive_checks", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()Response 200
{
"object": "policy_flow",
"id": "pfl_01M8WNRNW03WYBATMESYQXYMXG",
"key": "smp_archive_checks",
"label": "Sample checks",
"published_version": null,
"archived": true,
"archived_at": "2026-12-03T00:44:42.753Z",
"created_at": "2026-12-03T00:44:42.752Z",
"updated_at": "2026-12-03T00:44:42.753Z"
}Save a sub-flow version
POST/v1/account/policies/flows/{key}/versions
Saves the next version, unpublished. The rules give one of the four outcomes only (or take another sub-flow's); every fact they read is a declared input and every input a registered fact; each output reads an input or a signal or scorecard of the sub-flow. Sub-flows call sub-flows at most 3 deep, and a loop is refused with its path (policy_cycle).
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
inputsarray of stringsRequired- The facts the sub-flow reads.
outputsarray of objects- What callers can read as
flow.<key>.<output>(notoutcomeorversion).Show child attributes
keystringRequired- The output's name.
fromstringRequired- The fact it reads.
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.
Returns
The version, saved and unpublished.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_version_checks" }' > /dev/null
curl -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_version_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount",
"order.currency"
],
"outputs": [
{
"key": "risk",
"from": "scorecard.risk.score"
}
],
"document": {
"scorecards": [
{
"label": "Risk",
"key": "risk",
"rows": [
{
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"points": 40
},
{
"when": [
{
"fact": "order.currency",
"op": "ne",
"value": "USD"
}
],
"points": 30
}
]
}
],
"rules": [
{
"label": "High risk",
"when": [
{
"fact": "scorecard.risk.score",
"op": "gte",
"value": 70
}
],
"require": {
"deny": true
}
}
]
}
}'const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_version_checks" }),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_version_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount",
"order.currency"
],
"outputs": [
{
"key": "risk",
"from": "scorecard.risk.score"
}
],
"document": {
"scorecards": [
{
"label": "Risk",
"key": "risk",
"rows": [
{
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"points": 40
},
{
"when": [
{
"fact": "order.currency",
"op": "ne",
"value": "USD"
}
],
"points": 30
}
]
}
],
"rules": [
{
"label": "High risk",
"when": [
{
"fact": "scorecard.risk.score",
"op": "gte",
"value": 70
}
],
"require": {
"deny": true
}
}
]
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_version_checks"
}).json()
data = httpx.post(f"{api}/v1/account/policies/flows/smp_version_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount",
"order.currency"
],
"outputs": [
{
"key": "risk",
"from": "scorecard.risk.score"
}
],
"document": {
"scorecards": [
{
"label": "Risk",
"key": "risk",
"rows": [
{
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"points": 40
},
{
"when": [
{
"fact": "order.currency",
"op": "ne",
"value": "USD"
}
],
"points": 30
}
]
}
],
"rules": [
{
"label": "High risk",
"when": [
{
"fact": "scorecard.risk.score",
"op": "gte",
"value": 70
}
],
"require": {
"deny": True
}
}
]
}
}).json()Response 201
{
"object": "policy_flow_version",
"key": "smp_version_checks",
"version": 1,
"published": false,
"inputs": [
"order.amount",
"order.currency"
],
"outputs": [
{
"key": "risk",
"from": "scorecard.risk.score"
}
],
"document": {
"rules": [
{
"id": "rul_01M8WNRNW63B0EQ6XKH434KP5W",
"when": [
{
"fact": "scorecard.risk.score",
"op": "gte",
"value": 70
}
],
"require": {
"deny": true
},
"label": "High risk"
}
],
"scorecards": [
{
"id": "scd_01M8WNRNW6YK3XD0NNAEWP602G",
"key": "risk",
"label": "Risk",
"rows": [
{
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"points": 40
},
{
"when": [
{
"fact": "order.currency",
"op": "ne",
"value": "USD"
}
],
"points": 30
}
]
}
]
},
"calls": [],
"published_at": null,
"acknowledgement": null,
"created_at": "2026-12-03T00:44:42.758Z"
}Backtest a sub-flow version
POST/v1/account/policies/flows/{key}/versions/{version}/backtest
Replays each rule set that follows the latest with this version against the published one, over its last 30 days: each one's outcome rates and labelled results, and whether the change in Challenge plus Reject is more than 5 points. Pinned rule sets aren't tested: publishing doesn't change them. Nothing is written.
Parameters
No parameters.
Returns
Each following rule set's backtest.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_backtest_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_backtest_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_backtest_checks/versions/1/backtest" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{}'const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_backtest_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_backtest_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_backtest_checks/versions/1/backtest`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_backtest_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_backtest_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
data = httpx.post(f"{api}/v1/account/policies/flows/smp_backtest_checks/versions/1/backtest", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={}).json()Response 200
{
"object": "policy_flow_backtest",
"key": "smp_backtest_checks",
"version": 1,
"against": null,
"callers": [],
"needs_acknowledgement": false
}Publish a sub-flow version
POST/v1/account/policies/flows/{key}/versions/{version}/publish
Makes the version the latest: rule sets that follow the latest run on it from their next decision; pinned ones don't change. Refused (400) when a following rule set lacks an input, and (409) when one moves Challenge plus Reject by more than 5 points, unless acknowledge_rate_change is true: one acknowledgement covers them all.
Parameters
Idempotency-Keystringheader- Retry a create safely: the same key + request returns the stored response (24 h, per caller).
acknowledge_rate_changeboolean- Publish although a following rule set moves by more than 5 points.
Returns
The version, published, with each following rule set's backtest.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_publish_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_publish_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_publish_checks/versions/1/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "acknowledge_rate_change": true }'const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_publish_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_publish_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_publish_checks/versions/1/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "acknowledge_rate_change": true }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_publish_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_publish_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
data = httpx.post(f"{api}/v1/account/policies/flows/smp_publish_checks/versions/1/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"acknowledge_rate_change": True
}).json()Response 200
{
"object": "policy_flow_version",
"key": "smp_publish_checks",
"version": 1,
"published": true,
"inputs": [
"order.amount"
],
"outputs": [],
"document": {
"rules": [
{
"id": "rul_01M8WNRNWBDZDKZVM0X3HZ18YQ",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
},
"label": "Large order"
}
]
},
"calls": [],
"published_at": "2026-12-03T00:44:42.764Z",
"acknowledgement": null,
"created_at": "2026-12-03T00:44:42.763Z",
"callers": []
}Simulate a sub-flow
POST/v1/account/policies/flows/{key}/simulate
Runs the sub-flow alone over the facts you send: its outcome (approve, challenge, review, reject or none) and each output. The published version unless version names another. Nothing is written.
Parameters
factsobjectRequired- The facts by name.
versioninteger- The version to run (default the published one).
Returns
The outcome and outputs.
Errors
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "Sample checks", "key": "smp_simulate_checks" }' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_simulate_checks/versions" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}' > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_simulate_checks/versions/1/publish" \
-H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -X POST "$PROVENANCE_API/v1/account/policies/flows/smp_simulate_checks/simulate" \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "facts": { "order.amount": 600 } }'const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "label": "Sample checks", "key": "smp_simulate_checks" }),
})).json();
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_simulate_checks/versions`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": true
}
}
]
}
}),
})).json();
const step3 = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_simulate_checks/versions/1/publish`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/account/policies/flows/smp_simulate_checks/simulate`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
body: JSON.stringify({ "facts": { "order.amount": 600 } }),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/account/policies/flows", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"label": "Sample checks",
"key": "smp_simulate_checks"
}).json()
step2 = httpx.post(f"{api}/v1/account/policies/flows/smp_simulate_checks/versions", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"inputs": [
"order.amount"
],
"document": {
"rules": [
{
"label": "Large order",
"when": [
{
"fact": "order.amount",
"op": "gt",
"value": 500
}
],
"require": {
"approval": True
}
}
]
}
}).json()
step3 = httpx.post(f"{api}/v1/account/policies/flows/smp_simulate_checks/versions/1/publish", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.post(f"{api}/v1/account/policies/flows/smp_simulate_checks/simulate", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
"facts": {
"order.amount": 600
}
}).json()Response 200
{
"object": "policy_flow_simulation",
"key": "smp_simulate_checks",
"version": 1,
"outcome": "challenge",
"outputs": {}
}