View as Markdown

Identify · API reference

Traffic policies

Your site's versioned rules for which agents and bots get through.

Related guide: Write a traffic policy

The policy version object

Attributes

objectenumRequired
The type of object. One of policy_version.
policy_idstring
The policy's ID (pol_…), the same on every version of it.
domainstringRequired
The policy domain.
versionintegerRequired
The version number.
activebooleanRequired
Whether this version is the active policy.
notestring | null
A note for the record.
created_atstring
When it was created.
created_bystring | null
Who saved the version.
documentobject
The policy document as saved, with Provenance's rule IDs.
shadowboolean
The shadow settings.
draftboolean
Present and true on a draft saved with POST .../versions that has not gone live.
trial_ends_attimestamp
Present while the version is on a trial run, with when the trial run ends.
restored_frominteger
On a restore, the version it copies.
promoted_from_trialboolean
Present and true when the version went live from its trial run.
sourceenum
Where the version was written: the console, the API, or a rules embed session (<provenance-rules>). Present on versions written since 2026-11-17. One of console, api, embed.
embed_sessionstring
On a version saved by a rules embed session, that session's id (the embed token's id, never the token). created_by names the API key or console member that minted the session.
draft_groupstring
Sandbox. The draft group a rules embed session saved this draft in (rules.draft_group). It stays once the draft is published. Listed only with ?draft_group= naming the group while the draft waits.
key_last4string
In the version list, on a version written through the API or a rules embed session, the last four characters of the account's API key that wrote it (or minted the session). Absent when created_by is a console member.
warningsarray of objects
Checkout rules only, present when a rule never runs (shadowed_by). The version is saved either way.
Show child attributes
typeenumRequired
Always shadowed_by. One of shadowed_by.
rule_idstringRequired
The rule that never runs.
shadowed_bystringRequired
The rule above it that always decides first.
messagestringRequired
The warning in words ("This rule never runs: 'No mandate or approval' decides first").

The policy version object

{
  "object": "policy_version",
  "policy_id": "pol_B48657D1A9F063C2215A7F9CEE",
  "domain": "traffic",
  "version": 1,
  "active": true,
  "note": "shopping agents need a person at checkout",
  "created_at": "2026-11-17T14:20:00.709Z",
  "document": {
    "rules": [
      {
        "id": "rul_01M7MY21A5PCJC8ZZKGG5EG8A3",
        "legacy_id": "shopping-agent-checkout",
        "when": [
          {
            "fact": "agent.class",
            "op": "eq",
            "value": "signed_agent"
          },
          {
            "fact": "action",
            "op": "eq",
            "value": "checkout"
          }
        ],
        "then": {
          "action": "require_intent",
          "binding": "order"
        }
      }
    ],
    "default": "allow"
  }
}

Events

Sent to your webhook endpoints when they subscribe:

  • identify.policy.published
  • identify.rule_suggestion.created

Create a traffic policy draft

POST/v1/identify/policies/versions

Validates a document and saves it as the next version without making it live: a draft (v13 while v12 is live). Review it with diff, check it with backtest, then publish it.

Parameters

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentobjectRequired
A 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.
notestring
A note for the record.

Returns

The draft, with draft true and its document. See the policy version object.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/identify/policies/versions" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }'
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 201

{
  "object": "policy_version",
  "policy_id": "pol_6669E93061F0B0EE5F165254BB",
  "version": 1,
  "active": false,
  "note": "shopping agents need a person at checkout",
  "created_by": "key_01M7W8383SCZ45HFJ03QFWT12E",
  "created_at": "2026-11-20T10:30:07.643Z",
  "draft": true,
  "source": "api",
  "domain": "traffic",
  "document": {
    "rules": [
      {
        "id": "rul_01M7W838GVKNECWD2JHXZ3X5J4",
        "legacy_id": "shopping-agent-checkout",
        "when": [
          {
            "fact": "agent.class",
            "op": "eq",
            "value": "signed_agent"
          },
          {
            "fact": "action",
            "op": "eq",
            "value": "checkout"
          }
        ],
        "then": {
          "action": "require_intent",
          "binding": "order"
        }
      }
    ],
    "default": "allow"
  }
}

Retrieve the active traffic policy

GET/v1/identify/policies

Returns the active traffic policy, or the built-in default with is_default true.

Parameters

No parameters.

Returns

The active policy for the domain.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "policy",
  "id": null,
  "domain": "traffic",
  "document": {
    "version": 0,
    "rules": [],
    "default": "allow"
  },
  "version": null,
  "is_default": true
}

Retrieve a traffic policy version

GET/v1/identify/policies/versions/{version}

Returns one saved traffic policy version's document.

Parameters

versionintegerpathRequired
The version number.

Returns

The policy version. See the policy version object.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }' > step.json
export TRAFFIC_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_VERSION" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 200

{
  "object": "policy_version",
  "domain": "traffic",
  "version": 3,
  "active": true,
  "document": {
    "rules": [
      {
        "id": "rul_01M7MY21A5PCJC8ZZKGG5EG8A3",
        "legacy_id": "shopping-agent-checkout",
        "when": [
          {
            "fact": "agent.class",
            "op": "eq",
            "value": "signed_agent"
          },
          {
            "fact": "action",
            "op": "eq",
            "value": "checkout"
          }
        ],
        "then": {
          "action": "require_intent",
          "binding": "order"
        }
      }
    ],
    "default": "allow"
  },
  "note": "shopping agents need a person at checkout",
  "created_at": "2026-11-17T14:20:00.716Z"
}

Get the shadow report

GET/v1/identify/policies/shadow_report

Compares the shadow version with the active traffic policy over a time window: how often they disagreed, per rule, and which decisions the shadow would have denied.

Parameters

created_gtetimestampquery
The start of the time window, as an ISO 8601 time.
created_ltetimestampquery
The end of the time window, as an ISO 8601 time.

Returns

The shadow report.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/identify/policies/shadow_report" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "shadow_report",
  "domain": "traffic",
  "shadow_active": false,
  "shadow_version": null,
  "from": null,
  "to": null,
  "evaluated": 0,
  "diverged": 0,
  "divergence_rate": 0,
  "transitions": {}
}

Get rule performance

GET/v1/identify/policies/performance

Traffic policies don't offer rule performance yet (checkout policies do): this answers 400 policy_feature_unsupported. The route is here so every policy has the same routes.

Parameters

fromstringquery
The first UTC day, YYYY-MM-DD (default: 29 days before to).
tostringquery
The last UTC day, YYYY-MM-DD (default: today). A window covers at most 366 days.
versionintegerquery
Only the decisions this version made (default: every version in the window, in the live version's rule order).
currencystringquery
The ISO 4217 currency values are summed in (default: the one with the most orders).

Returns

The rule set's totals and each rule's numbers.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/identify/policies/performance" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "policy_performance",
  "domain": "checkout",
  "from": "2026-11-03",
  "to": "2026-12-02",
  "version": null,
  "currency": "USD",
  "other_currencies": [],
  "totals": {
    "matched": 1,
    "value_minor": 3800,
    "outcomes": [
      {
        "outcome": "approve",
        "count": 0,
        "value_minor": 0,
        "currency": "USD",
        "share": 0
      },
      {
        "outcome": "challenge",
        "count": 1,
        "value_minor": 3800,
        "currency": "USD",
        "share": 1
      },
      {
        "outcome": "reject",
        "count": 0,
        "value_minor": 0,
        "currency": "USD",
        "share": 0
      }
    ],
    "results": {
      "true_positive": {
        "count": 0,
        "value_minor": 0,
        "currency": "USD"
      },
      "false_positive": {
        "count": 0,
        "value_minor": 0,
        "currency": "USD"
      },
      "missed": {
        "count": 0,
        "value_minor": 0,
        "currency": "USD"
      },
      "allowed": {
        "count": 0,
        "value_minor": 0,
        "currency": "USD"
      },
      "unlabelled": {
        "count": 1,
        "value_minor": 3800,
        "currency": "USD"
      }
    },
    "labelled": 0,
    "enough_labels": false
  },
  "rules": [
    {
      "rule_id": "fallback",
      "name": null,
      "outcomes": [
        "challenge"
      ],
      "matched": 1,
      "value_minor": 3800,
      "results": {
        "true_positive": {
          "count": 0,
          "value_minor": 0,
          "currency": "USD"
        },
        "false_positive": {
          "count": 0,
          "value_minor": 0,
          "currency": "USD"
        },
        "missed": {
          "count": 0,
          "value_minor": 0,
          "currency": "USD"
        },
        "allowed": {
          "count": 0,
          "value_minor": 0,
          "currency": "USD"
        },
        "unlabelled": {
          "count": 1,
          "value_minor": 3800,
          "currency": "USD"
        }
      }
    }
  ],
  "labels_note": "A rejected order has no outcome, so rejections count only when a label says whether they were right; the rest show as No label yet."
}

Get the trial run

GET/v1/identify/policies/trial

Traffic policies don't offer trial runs (agent, checkout and capture policies do): this answers 400 policy_feature_unsupported. The route is here so every policy has the same routes.

Parameters

No parameters.

Returns

The trial run.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/identify/policies/trial" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "policy_trial",
  "domain": "traffic",
  "active": true,
  "version": 12,
  "started_at": "2026-11-08T18:05:02.803Z",
  "ends_at": "2026-11-15T18:05:02.803Z",
  "evaluated": 0,
  "differences": 0,
  "examples": []
}

Get a traffic policy version's plan

GET/v1/identify/policies/versions/{version}/plan

The version compiled into its plan: each rule's facts with what reading them costs (the request and token, your own records, a network call or a model call), cheapest first, and warnings for a fact this rule set can't read, an operator that never matches its fact, or a rule that's never reached.

Parameters

versionintegerpathRequired
The version number.

Returns

The plan.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/identify/policies/versions" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }' > step.json
export TRAFFIC_DRAFT=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_DRAFT/plan" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 200

{
  "object": "policy_plan",
  "domain": "traffic",
  "version": 7,
  "plan_hash": "58c58ba827fb0f2e04e8da83e8e326d1d79088e41d97ec46cefd6d7d7317d74c",
  "node_count": 7,
  "reads": [
    {
      "fact": "action",
      "tier": 0,
      "provider": "request"
    },
    {
      "fact": "agent.class",
      "tier": 0,
      "provider": "request"
    }
  ],
  "rules": [
    {
      "id": "rul_01M8V3C46C9Z9Q09VF2JH1RQXF",
      "tier": 0,
      "reads": [
        {
          "fact": "agent.class",
          "tier": 0,
          "provider": "request"
        },
        {
          "fact": "action",
          "tier": 0,
          "provider": "request"
        }
      ]
    }
  ],
  "nodes": [
    {
      "id": "fact:agent.class",
      "kind": "fact",
      "tier": 0,
      "reads": [],
      "fact": "agent.class"
    },
    {
      "id": "cond:rul_01M8V3C46C9Z9Q09VF2JH1RQXF:0",
      "kind": "condition",
      "tier": 0,
      "reads": [
        "fact:agent.class"
      ]
    },
    {
      "id": "fact:action",
      "kind": "fact",
      "tier": 0,
      "reads": [],
      "fact": "action"
    },
    "… 4 more"
  ],
  "warnings": [],
  "approve_on_tier3_only": []
}

Retrieve a rule suggestion

GET/v1/identify/policies/rule_suggestions/{id}

One traffic rule draft with its evidence, backtest and status. Needs the assist on; see the guide.

Parameters

idstringpathRequired
The suggestion's ID (prs_).

Returns

The suggestion.

Errors

export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/identify/policies/rule_suggestions/prs_01M81CRZ6CWWBVP9CVRT78V7Y7" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "identify_rule_suggestion",
  "id": "prs_01M81CRZ6CWWBVP9CVRT78V7Y7",
  "domain": "traffic",
  "status": "open",
  "label": "Declared bots that never reach checkout",
  "rule": {
    "id": "draft-94932507be",
    "label": "Declared bots that never reach checkout",
    "when": [
      {
        "fact": "agent.class",
        "op": "eq",
        "value": "declared_bot"
      }
    ],
    "then": {
      "action": "rate_limit",
      "per": "agent",
      "window_seconds": 60,
      "max": 60
    }
  },
  "action": "rate_limit",
  "description": "If class eq declared_bot, then rate limit",
  "explanation": "This group sent 1200 requests and none reached checkout.",
  "explanation_source": "model",
  "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
  "evidence": {
    "kind": "crawler_load",
    "requests": 1200,
    "share": 0.8,
    "reached_checkout": 0,
    "flagged": 0,
    "rate": 0,
    "baseline_rate": 0,
    "total_requests": 1500,
    "window_from": "2026-10-23T10:28:05.428Z",
    "window_to": "2026-11-22T10:28:05.428Z"
  },
  "backtest": {
    "object": "policy_backtest",
    "available": true,
    "days": 30,
    "from": "2026-10-23T10:28:05.428Z",
    "to": "2026-11-22T10:28:05.428Z",
    "requests": 1500,
    "truncated": false,
    "field_conditions_unscored": false,
    "totals": {
      "allowed": 300,
      "challenged": 0,
      "rejected": 0
    },
    "rules": [
      {
        "rule_id": "draft-94932507be",
        "label": "Declared bots that never reach checkout",
        "outcome": "approve",
        "action": "rate_limit",
        "matched": 1200,
        "decided": 1200,
        "per_week": 280,
        "summary": "Last 30 days: would have rate limited 1,200 requests, about 280 a week"
      }
    ],
    "traffic": {
      "actions": {
        "allow": 300,
        "log_only": 0,
        "rate_limit": 1200,
        "challenge": 0,
        "require_intent": 0,
        "reject": 0
      },
      "changed": {
        "allow→rate_limit": 1200
      },
      "by_class": {
        "declared_bot": {
          "rate_limit": 1200
        },
        "likely_human": {
          "allow": 300
        }
      },
      "reached_checkout": {
        "stopped": 0,
        "visits": 0,
        "flagged": 0
      },
      "unscored": 0,
      "unscored_facts": [],
      "sources": {
        "hosted": 0,
        "middleware": 1500,
        "edge": 0
      },
      "lists_as_of": "now"
    }
  },
  "limited_data": true,
  "policy_version": null,
  "shadow_version": null,
  "published_version": null,
  "dismissed_until": null,
  "created_at": "2026-11-22T10:28:05.428Z",
  "updated_at": "2026-11-22T10:28:05.428Z"
}

List traffic policy versions

GET/v1/identify/policies/versions

Lists a domain's saved traffic policy versions, newest first, and which is active.

Parameters

No parameters.

Returns

The policy versions, newest first.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }' > step.json
export TRAFFIC_VERSION=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/identify/policies/versions" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 200

{
  "object": "list",
  "data": [
    {
      "object": "policy_version",
      "policy_id": "pol_B48657D1A9F063C2215A7F9CEE",
      "version": 2,
      "active": true,
      "note": "shopping agents need a person at checkout",
      "created_by": "key_12B627S86K9AX9KVDDBR1Z3454",
      "created_at": "2026-11-07T19:21:46.429Z",
      "source": "api",
      "domain": "traffic"
    },
    {
      "object": "policy_version",
      "policy_id": "pol_B48657D1A9F063C2215A7F9CEE",
      "version": 1,
      "active": false,
      "note": "shopping agents need a person at checkout",
      "created_by": "key_12B627S86K9AX9KVDDBR1Z3454",
      "created_at": "2026-11-07T19:21:46.428Z",
      "source": "api",
      "domain": "traffic"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

List the records a backtest would change

GET/v1/identify/policies/backtest/{id}/changes

Backtests of traffic policies keep no changed records yet (checkout and agent policies do), so no backtest has an id to read here: this answers 404 resource_missing, or 400 policy_feature_unsupported where the policy has no backtest. The route is here so every policy has the same routes.

Parameters

idstringpathRequired
The backtest's id (pbt_…), from POST …/backtest.
limitintegerquery
Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid.
cursorstringquery
Opaque; pass a response's next_cursor back to get the next page.

Returns

One page of the records that would change.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/identify/policies/backtest/pbt_01M8WMKZJ4EZ1EWXVEN3N4HE9R/changes" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "list",
  "data": [
    {
      "id": "cas_01M81CRZ5CX8S238KB791A7JB0",
      "kind": "checkout_assessment",
      "created_at": "2026-12-01T18:05:02.794Z",
      "value_minor": 124000,
      "currency": "USD",
      "live": "challenge",
      "draft": "reject",
      "live_rule_id": "first-order-over-500",
      "draft_rule_id": "two-risk-signs",
      "label": "disputed",
      "live_result": "true_positive",
      "draft_result": "true_positive"
    }
  ],
  "has_more": false,
  "next_cursor": null,
  "total": 1,
  "capped": false,
  "policy_version": 13
}

List rule suggestions

GET/v1/identify/policies/rule_suggestions

Lists the traffic rule drafts: open and shadowed ones, and the rest from the last 90 days, newest first. Statistics count the evidence and the 30-day backtest; a model writes the label and explanation. Needs the assist on; see the guide.

Parameters

statusenumquery
Only suggestions in this status. One of open, shadowed, published, dismissed, expired.
limitintegerquery
Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid.
cursorstringquery
Opaque; pass a response's next_cursor back to get the next page.

Returns

A page of suggestions.

Errors

export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/identify/policies/rule_suggestions" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "list",
  "data": [
    {
      "object": "identify_rule_suggestion",
      "id": "prs_01M81CRZ6CWWBVP9CVRT78V7Y7",
      "domain": "traffic",
      "status": "open",
      "label": "Declared bots that never reach checkout",
      "rule": {
        "id": "draft-94932507be",
        "label": "Declared bots that never reach checkout",
        "when": [
          {
            "fact": "agent.class",
            "op": "eq",
            "value": "declared_bot"
          }
        ],
        "then": {
          "action": "rate_limit",
          "per": "agent",
          "window_seconds": 60,
          "max": 60
        }
      },
      "action": "rate_limit",
      "description": "If class eq declared_bot, then rate limit",
      "explanation": "This group sent 1200 requests and none reached checkout.",
      "explanation_source": "model",
      "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
      "evidence": {
        "kind": "crawler_load",
        "requests": 1200,
        "share": 0.8,
        "reached_checkout": 0,
        "flagged": 0,
        "rate": 0,
        "baseline_rate": 0,
        "total_requests": 1500,
        "window_from": "2026-10-23T10:28:05.428Z",
        "window_to": "2026-11-22T10:28:05.428Z"
      },
      "backtest": {
        "object": "policy_backtest",
        "available": true,
        "days": 30,
        "from": "2026-10-23T10:28:05.428Z",
        "to": "2026-11-22T10:28:05.428Z",
        "requests": 1500,
        "truncated": false,
        "field_conditions_unscored": false,
        "totals": {
          "allowed": 300,
          "challenged": 0,
          "rejected": 0
        },
        "rules": [
          {
            "rule_id": "draft-94932507be",
            "label": "Declared bots that never reach checkout",
            "outcome": "approve",
            "action": "rate_limit",
            "matched": 1200,
            "decided": 1200,
            "per_week": 280,
            "summary": "Last 30 days: would have rate limited 1,200 requests, about 280 a week"
          }
        ],
        "traffic": {
          "actions": {
            "allow": 300,
            "log_only": 0,
            "rate_limit": 1200,
            "challenge": 0,
            "require_intent": 0,
            "reject": 0
          },
          "changed": {
            "allow→rate_limit": 1200
          },
          "by_class": {
            "declared_bot": {
              "rate_limit": 1200
            },
            "likely_human": {
              "allow": 300
            }
          },
          "reached_checkout": {
            "stopped": 0,
            "visits": 0,
            "flagged": 0
          },
          "unscored": 0,
          "unscored_facts": [],
          "sources": {
            "hosted": 0,
            "middleware": 1500,
            "edge": 0
          },
          "lists_as_of": "now"
        }
      },
      "limited_data": true,
      "policy_version": null,
      "shadow_version": null,
      "published_version": null,
      "dismissed_until": null,
      "created_at": "2026-11-22T10:28:05.428Z",
      "updated_at": "2026-11-22T10:28:05.428Z"
    },
    {
      "object": "identify_rule_suggestion",
      "id": "prs_01M81CRZ6C10SKCDSA0F4DW1JJ",
      "domain": "traffic",
      "status": "open",
      "label": "First-time agent orders",
      "rule": {
        "id": "draft-b12764aa5c",
        "label": "First-time agent orders",
        "when": [
          {
            "fact": "agent.verified",
            "op": "eq",
            "value": false
          }
        ],
        "then": {
          "action": "rate_limit",
          "per": "agent",
          "window_seconds": 60,
          "max": 60
        }
      },
      "action": "rate_limit",
      "description": "If agent_verified eq false, then rate limit",
      "explanation": "This group sent 1500 requests and none reached checkout.",
      "explanation_source": "model",
      "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
      "evidence": {
        "kind": "crawler_load",
        "requests": 1500,
        "share": 1,
        "reached_checkout": 0,
        "flagged": 0,
        "rate": 0,
        "baseline_rate": 0,
        "total_requests": 1500,
        "window_from": "2026-10-23T10:28:05.428Z",
        "window_to": "2026-11-22T10:28:05.428Z"
      },
      "backtest": {
        "object": "policy_backtest",
        "available": true,
        "days": 30,
        "from": "2026-10-23T10:28:05.428Z",
        "to": "2026-11-22T10:28:05.428Z",
        "requests": 1500,
        "truncated": false,
        "field_conditions_unscored": false,
        "totals": {
          "allowed": 0,
          "challenged": 0,
          "rejected": 0
        },
        "rules": [
          {
            "rule_id": "draft-b12764aa5c",
            "label": "First-time agent orders",
            "outcome": "approve",
            "action": "rate_limit",
            "matched": 1500,
            "decided": 1500,
            "per_week": 350,
            "summary": "Last 30 days: would have rate limited 1,500 requests, about 350 a week"
          }
        ],
        "traffic": {
          "actions": {
            "allow": 0,
            "log_only": 0,
            "rate_limit": 1500,
            "challenge": 0,
            "require_intent": 0,
            "reject": 0
          },
          "changed": {
            "allow→rate_limit": 1500
          },
          "by_class": {
            "declared_bot": {
              "rate_limit": 1200
            },
            "likely_human": {
              "rate_limit": 300
            }
          },
          "reached_checkout": {
            "stopped": 0,
            "visits": 0,
            "flagged": 0
          },
          "unscored": 0,
          "unscored_facts": [],
          "sources": {
            "hosted": 0,
            "middleware": 1500,
            "edge": 0
          },
          "lists_as_of": "now"
        }
      },
      "limited_data": true,
      "policy_version": null,
      "shadow_version": null,
      "published_version": null,
      "dismissed_until": null,
      "created_at": "2026-11-22T10:28:05.428Z",
      "updated_at": "2026-11-22T10:28:05.428Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}

Publish a traffic policy

PUT/v1/identify/policies

Validates a traffic policy document, saves it as the next version and makes it active. An invalid document is refused with details for each failing rule. An approval rule may carry auto_approve clauses (Pro and above); each clause gets expires_at 90 days out unless it sets one (at most 365), and a clause where a person is always required is refused with auto_approve_not_allowed.

Parameters

documentobjectRequired
A RiskPolicyDocument (claims_risk) or intent PolicyDocument.
Show child attributes
thresholdsobject
Status cutoffs; must satisfy 0 < verified < partial < 100. They never apply to an asset with signature_invalid, device_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.
notestring
A note for the record.

Returns

The new policy version. See the policy version object.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X PUT "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }'
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 201

{
  "object": "policy_version",
  "policy_id": "pol_B48657D1A9F063C2215A7F9CEE",
  "domain": "traffic",
  "version": 1,
  "active": true,
  "note": "shopping agents need a person at checkout",
  "created_at": "2026-11-17T14:20:00.709Z",
  "document": {
    "rules": [
      {
        "id": "rul_01M7MY21A5PCJC8ZZKGG5EG8A3",
        "legacy_id": "shopping-agent-checkout",
        "when": [
          {
            "fact": "agent.class",
            "op": "eq",
            "value": "signed_agent"
          },
          {
            "fact": "action",
            "op": "eq",
            "value": "checkout"
          }
        ],
        "then": {
          "action": "require_intent",
          "binding": "order"
        }
      }
    ],
    "default": "allow"
  }
}

Reset to the default traffic policy

DELETE/v1/identify/policies

Returns a domain to the built-in default. Saved versions are kept.

Parameters

No parameters.

Returns

The default policy, now active.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "policy",
  "id": null,
  "domain": "traffic",
  "document": {
    "version": 0,
    "rules": [],
    "default": "allow"
  },
  "version": null,
  "is_default": true
}

Simulate a traffic policy

POST/v1/identify/policies/simulate

Evaluates a draft or the active traffic policy against facts you supply and changes nothing. For claims_risk it returns the score, status and factors the claim would get.

Parameters

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentany
Draft to test; omit to use the active policy.
factsobject
The facts the policy evaluates. For claims_risk: claim_type, state, case_type, gps_present, biometric_present and attested. A missing or unrecognized case_type counts as insurance_claim, as it does on attest.
base_signalsobject
claims_risk only — base risk signals to combine before scoring.
orderobject
An order in the cart shape (order_id, integer total in minor units, currency, items); its order.* facts join facts, as on verify.
attimestamp
When the preview starts (default now): business hours and escalation times count from it.

Returns

What the policy would decide. A webhook rule reports would_call_webhook without calling it. A rule with a route adds routing: who gets it now, each step, and the end.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/identify/policies/simulate" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    },
    "facts": {
      "agent.class": "signed_agent",
      "action": "checkout"
    }
  }'

Response 200

{
  "object": "policy_simulation",
  "domain": "traffic",
  "action": "require_intent",
  "then": {
    "action": "require_intent",
    "binding": "order"
  },
  "policy": {
    "id": "pol_6669E93061F0B0EE5F165254BB",
    "version": 0,
    "rule": {
      "id": "shopping-agent-checkout",
      "ref": null,
      "name": null,
      "phase": "assess",
      "action": "challenge",
      "conditions": [
        {
          "fact": "agent.class",
          "op": "eq",
          "value": "signed_agent",
          "actual": "signed_agent"
        },
        {
          "fact": "action",
          "op": "eq",
          "value": "checkout",
          "actual": "checkout"
        }
      ]
    }
  }
}

Shadow a traffic policy version

POST/v1/identify/policies/versions/{version}/shadow

Evaluates a saved version on every verify alongside the active traffic policy, without enforcing it, and records its verdict on each decision. One version per domain can be the shadow.

Parameters

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
versionintegerpathRequired
The version number.

Returns

The version, now running in shadow. See the policy version object.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }' > step.json
export TRAFFIC_VERSION=$(jq -r '.version' step.json)
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -X POST "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_VERSION/shadow" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_VERSION/shadow" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 200

{
  "object": "policy_version",
  "domain": "traffic",
  "version": 5,
  "active": false,
  "shadow": true
}

Stop shadowing a traffic policy version

DELETE/v1/identify/policies/versions/{version}/shadow

Stops evaluating the shadow version. The version stays saved.

Parameters

versionintegerpathRequired
The version number.

Returns

The version, now out of shadow.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }' > step.json
export TRAFFIC_VERSION=$(jq -r '.version' step.json)
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -s -X POST "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_VERSION/shadow" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -X DELETE "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_VERSION/shadow" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "policy_shadow",
  "domain": "traffic",
  "shadow": false
}

Stop the trial run

DELETE/v1/identify/policies/trial

Traffic policies don't offer trial runs (agent, checkout and capture policies do): this answers 400 policy_feature_unsupported. The route is here so every policy has the same routes.

Parameters

No parameters.

Returns

No trial run.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X DELETE "$PROVENANCE_API/v1/identify/policies/trial" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "policy_trial",
  "domain": "traffic",
  "active": false,
  "version": null
}

Promote the trial run

POST/v1/identify/policies/trial/promote

Traffic policies don't offer trial runs (agent, checkout and capture policies do): this answers 400 policy_feature_unsupported. The route is here so every policy has the same routes.

Parameters

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).

Returns

The new live version, with promoted_from_trial. See the policy version object.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/identify/policies/trial/promote" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Response 200

{
  "object": "policy_version",
  "policy_id": "pol_AC2A5612965B31B91188589F91",
  "version": 13,
  "active": true,
  "note": "big orders from new shoppers or unsigned agents",
  "created_by": "key_7FHWBSCG1E8PJV9C3XB7HS0CF4",
  "created_at": "2026-11-08T18:05:02.805Z",
  "trial_ends_at": "2026-11-15T18:05:02.805Z",
  "source": "api",
  "domain": "traffic",
  "promoted_from_trial": true
}

Review a traffic policy version's changes

GET/v1/identify/policies/versions/{version}/diff

Compares a version with the live one (or with against, another version) rule by rule, in plain sentences: each added, removed, changed or moved rule, with what changed in it.

Parameters

versionintegerpathRequired
The version number.
againststringquery
active (the default) or another version number to compare with.

Returns

The changes.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/identify/policies/versions" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }' > step.json
export TRAFFIC_DRAFT=$(jq -r '.version' step.json)
curl "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_DRAFT/diff" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 200

{
  "object": "policy_diff",
  "domain": "traffic",
  "version": 1,
  "against": null,
  "changes": [
    {
      "rule_id": "rul_01M7W7XR87TS1DPW3M4P98VEPT",
      "label": null,
      "change": "added",
      "parts": [],
      "before": null,
      "after": "rul_01M7W7XR87TS1DPW3M4P98VEPT"
    }
  ]
}

Publish a traffic policy version

POST/v1/identify/policies/versions/{version}/publish

Makes a draft the live traffic policy now. With trial_days (1 to 30, Pro and above) it runs silently next to the live version first; promote it from the trial run.

Parameters

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
versionintegerpathRequired
The version number.
trial_daysinteger
Run the draft silently next to the live version for this many days instead of publishing now.

Returns

The live version, or the trial run when trial_days is set.

Errors

export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X PUT "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "shopping agents need a person at checkout",
    "document": {
      "rules": [
        {
          "id": "shopping-agent-checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "eq",
              "value": "signed_agent"
            },
            {
              "fact": "action",
              "op": "eq",
              "value": "checkout"
            }
          ],
          "then": {
            "action": "require_intent",
            "binding": "order"
          }
        }
      ],
      "default": "allow"
    }
  }' > step.json
export TRAFFIC_VERSION=$(jq -r '.version' step.json)
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl -X POST "$PROVENANCE_API/v1/identify/policies/versions/$TRAFFIC_VERSION/publish" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
curl -s -X DELETE "$PROVENANCE_API/v1/identify/policies" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null

Response 200

{
  "object": "policy_version",
  "policy_id": "pol_6669E93061F0B0EE5F165254BB",
  "version": 1,
  "active": true,
  "note": "shopping agents need a person at checkout",
  "created_by": "key_01M7W7XT5ZET00PDK8GQF4HVXX",
  "created_at": "2026-11-20T10:27:09.537Z",
  "source": "api",
  "domain": "traffic"
}

Export traffic policy versions

GET/v1/identify/policies/versions/export

Returns every version with its document, for your own records. Available on the Enterprise plan.

Parameters

No parameters.

Returns

Every version.

Errors

export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl "$PROVENANCE_API/v1/identify/policies/versions/export" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "policy_version_export",
  "domain": "traffic",
  "exported_at": "2026-11-20T10:27:11.942Z",
  "versions": []
}

Backtest traffic policy

POST/v1/identify/policies/backtest

Replays your recorded traffic decisions from the last days through a draft traffic policy (or the active one) and says what would have changed: the policy_backtest totals plus a traffic block with the changed decisions, the visits that went on to an order, and what couldn't be replayed. Pro plan and above. Backtest traffic rules.

Parameters

Idempotency-Keystringheader
Retry a create safely: the same key + request returns the stored response (24 h, per caller).
documentobject
The draft traffic policy (rules, each with when and then, and default); omit to replay the active one.
daysinteger
How many days to replay: 30 by default, and never past the account's decision retention.

Returns

How the document would have decided.

Errors

export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -s -X POST "$PROVENANCE_API/v1/identify/assessments" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request": {
      "method": "POST",
      "url": "https://harborbean.example/checkout",
      "headers": {
        "user-agent": "python-requests/2.32.3"
      }
    }
  }' > /dev/null
curl -X POST "$PROVENANCE_API/v1/identify/policies/backtest" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document": {
      "rules": [
        {
          "id": "challenge-bots",
          "label": "Challenge bots at checkout",
          "when": [
            {
              "fact": "agent.class",
              "op": "in",
              "value": [
                "suspected_bot",
                "declared_bot"
              ]
            }
          ],
          "then": {
            "action": "challenge"
          }
        }
      ],
      "default": "allow"
    },
    "days": 30
  }'

Response 200

{
  "object": "policy_backtest",
  "available": true,
  "days": 30,
  "from": "2026-10-27T04:36:05.640Z",
  "to": "2026-11-26T04:36:05.640Z",
  "requests": 1,
  "truncated": false,
  "field_conditions_unscored": false,
  "totals": {
    "allowed": 0,
    "challenged": 1,
    "rejected": 0
  },
  "rules": [
    {
      "rule_id": "challenge-bots",
      "label": "Challenge bots at checkout",
      "outcome": "ask",
      "action": "challenge",
      "matched": 1,
      "decided": 1,
      "per_week": 0.2,
      "summary": "Last 30 days: would have challenged 1 request, about 1 a month"
    }
  ],
  "traffic": {
    "actions": {
      "allow": 0,
      "log_only": 0,
      "rate_limit": 0,
      "challenge": 1,
      "require_intent": 0,
      "reject": 0
    },
    "changed": {
      "allow→challenge": 1
    },
    "by_class": {
      "declared_bot": {
        "challenge": 1
      }
    },
    "reached_checkout": {
      "stopped": 1,
      "visits": 0,
      "flagged": 0
    },
    "unscored": 0,
    "unscored_facts": [],
    "sources": {
      "hosted": 1,
      "middleware": 0,
      "edge": 0
    },
    "lists_as_of": "now"
  }
}

Refresh rule suggestions

POST/v1/identify/policies/rule_suggestions/refresh

Runs the traffic rule drafts now instead of waiting for the nightly run. Once a day per policy (429 after); each draft shown counts toward the monthly limit. Below the evidence floor nothing is sent to the model (below_floor). Needs the assist on; see the guide.

Parameters

No parameters.

Returns

What the run did, and the open drafts.

Errors

export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/identify/policies/rule_suggestions/refresh" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "rule_suggestion_refresh",
  "domain": "traffic",
  "result": "drafted",
  "created": 2,
  "open": [
    {
      "object": "identify_rule_suggestion",
      "id": "prs_01M81CRZ6CWWBVP9CVRT78V7Y7",
      "domain": "traffic",
      "status": "open",
      "label": "Declared bots that never reach checkout",
      "rule": {
        "id": "draft-94932507be",
        "label": "Declared bots that never reach checkout",
        "when": [
          {
            "fact": "agent.class",
            "op": "eq",
            "value": "declared_bot"
          }
        ],
        "then": {
          "action": "rate_limit",
          "per": "agent",
          "window_seconds": 60,
          "max": 60
        }
      },
      "action": "rate_limit",
      "description": "If class eq declared_bot, then rate limit",
      "explanation": "This group sent 1200 requests and none reached checkout.",
      "explanation_source": "model",
      "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
      "evidence": {
        "kind": "crawler_load",
        "requests": 1200,
        "share": 0.8,
        "reached_checkout": 0,
        "flagged": 0,
        "rate": 0,
        "baseline_rate": 0,
        "total_requests": 1500,
        "window_from": "2026-10-23T10:28:05.428Z",
        "window_to": "2026-11-22T10:28:05.428Z"
      },
      "backtest": {
        "object": "policy_backtest",
        "available": true,
        "days": 30,
        "from": "2026-10-23T10:28:05.428Z",
        "to": "2026-11-22T10:28:05.428Z",
        "requests": 1500,
        "truncated": false,
        "field_conditions_unscored": false,
        "totals": {
          "allowed": 300,
          "challenged": 0,
          "rejected": 0
        },
        "rules": [
          {
            "rule_id": "draft-94932507be",
            "label": "Declared bots that never reach checkout",
            "outcome": "approve",
            "action": "rate_limit",
            "matched": 1200,
            "decided": 1200,
            "per_week": 280,
            "summary": "Last 30 days: would have rate limited 1,200 requests, about 280 a week"
          }
        ],
        "traffic": {
          "actions": {
            "allow": 300,
            "log_only": 0,
            "rate_limit": 1200,
            "challenge": 0,
            "require_intent": 0,
            "reject": 0
          },
          "changed": {
            "allow→rate_limit": 1200
          },
          "by_class": {
            "declared_bot": {
              "rate_limit": 1200
            },
            "likely_human": {
              "allow": 300
            }
          },
          "reached_checkout": {
            "stopped": 0,
            "visits": 0,
            "flagged": 0
          },
          "unscored": 0,
          "unscored_facts": [],
          "sources": {
            "hosted": 0,
            "middleware": 1500,
            "edge": 0
          },
          "lists_as_of": "now"
        }
      },
      "limited_data": true,
      "policy_version": null,
      "shadow_version": null,
      "published_version": null,
      "dismissed_until": null,
      "created_at": "2026-11-22T10:28:05.428Z",
      "updated_at": "2026-11-22T10:28:05.428Z"
    },
    {
      "object": "identify_rule_suggestion",
      "id": "prs_01M81CRZ6C10SKCDSA0F4DW1JJ",
      "domain": "traffic",
      "status": "open",
      "label": "First-time agent orders",
      "rule": {
        "id": "draft-b12764aa5c",
        "label": "First-time agent orders",
        "when": [
          {
            "fact": "agent.verified",
            "op": "eq",
            "value": false
          }
        ],
        "then": {
          "action": "rate_limit",
          "per": "agent",
          "window_seconds": 60,
          "max": 60
        }
      },
      "action": "rate_limit",
      "description": "If agent_verified eq false, then rate limit",
      "explanation": "This group sent 1500 requests and none reached checkout.",
      "explanation_source": "model",
      "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
      "evidence": {
        "kind": "crawler_load",
        "requests": 1500,
        "share": 1,
        "reached_checkout": 0,
        "flagged": 0,
        "rate": 0,
        "baseline_rate": 0,
        "total_requests": 1500,
        "window_from": "2026-10-23T10:28:05.428Z",
        "window_to": "2026-11-22T10:28:05.428Z"
      },
      "backtest": {
        "object": "policy_backtest",
        "available": true,
        "days": 30,
        "from": "2026-10-23T10:28:05.428Z",
        "to": "2026-11-22T10:28:05.428Z",
        "requests": 1500,
        "truncated": false,
        "field_conditions_unscored": false,
        "totals": {
          "allowed": 0,
          "challenged": 0,
          "rejected": 0
        },
        "rules": [
          {
            "rule_id": "draft-b12764aa5c",
            "label": "First-time agent orders",
            "outcome": "approve",
            "action": "rate_limit",
            "matched": 1500,
            "decided": 1500,
            "per_week": 350,
            "summary": "Last 30 days: would have rate limited 1,500 requests, about 350 a week"
          }
        ],
        "traffic": {
          "actions": {
            "allow": 0,
            "log_only": 0,
            "rate_limit": 1500,
            "challenge": 0,
            "require_intent": 0,
            "reject": 0
          },
          "changed": {
            "allow→rate_limit": 1500
          },
          "by_class": {
            "declared_bot": {
              "rate_limit": 1200
            },
            "likely_human": {
              "rate_limit": 300
            }
          },
          "reached_checkout": {
            "stopped": 0,
            "visits": 0,
            "flagged": 0
          },
          "unscored": 0,
          "unscored_facts": [],
          "sources": {
            "hosted": 0,
            "middleware": 1500,
            "edge": 0
          },
          "lists_as_of": "now"
        }
      },
      "limited_data": true,
      "policy_version": null,
      "shadow_version": null,
      "published_version": null,
      "dismissed_until": null,
      "created_at": "2026-11-22T10:28:05.428Z",
      "updated_at": "2026-11-22T10:28:05.428Z"
    }
  ]
}

Try a rule suggestion in shadow mode

POST/v1/identify/policies/rule_suggestions/{id}/shadow

Creates a draft version (the live rules plus this rule) and runs it in shadow; live decisions don't change. The suggestion moves to shadowed. To go live, publish shadow_version with POST /v1/identify/policies/versions/{version}/publish. Needs the assist on; see the guide.

Parameters

idstringpathRequired
The suggestion's ID (prs_).

Returns

The suggestion, shadowed.

Errors

export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/identify/policies/rule_suggestions/prs_01M81CRZ6CWWBVP9CVRT78V7Y7/shadow" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "identify_rule_suggestion",
  "id": "prs_01M81CRZ6CWWBVP9CVRT78V7Y7",
  "domain": "traffic",
  "status": "shadowed",
  "label": "Declared bots that never reach checkout",
  "rule": {
    "id": "draft-94932507be",
    "label": "Declared bots that never reach checkout",
    "when": [
      {
        "fact": "agent.class",
        "op": "eq",
        "value": "declared_bot"
      }
    ],
    "then": {
      "action": "rate_limit",
      "per": "agent",
      "window_seconds": 60,
      "max": 60
    }
  },
  "action": "rate_limit",
  "description": "If class eq declared_bot, then rate limit",
  "explanation": "This group sent 1200 requests and none reached checkout.",
  "explanation_source": "model",
  "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
  "evidence": {
    "kind": "crawler_load",
    "requests": 1200,
    "share": 0.8,
    "reached_checkout": 0,
    "flagged": 0,
    "rate": 0,
    "baseline_rate": 0,
    "total_requests": 1500,
    "window_from": "2026-10-23T10:28:05.428Z",
    "window_to": "2026-11-22T10:28:05.428Z"
  },
  "backtest": {
    "object": "policy_backtest",
    "available": true,
    "days": 30,
    "from": "2026-10-23T10:28:05.428Z",
    "to": "2026-11-22T10:28:05.428Z",
    "requests": 1500,
    "truncated": false,
    "field_conditions_unscored": false,
    "totals": {
      "allowed": 300,
      "challenged": 0,
      "rejected": 0
    },
    "rules": [
      {
        "rule_id": "draft-94932507be",
        "label": "Declared bots that never reach checkout",
        "outcome": "approve",
        "action": "rate_limit",
        "matched": 1200,
        "decided": 1200,
        "per_week": 280,
        "summary": "Last 30 days: would have rate limited 1,200 requests, about 280 a week"
      }
    ],
    "traffic": {
      "actions": {
        "allow": 300,
        "log_only": 0,
        "rate_limit": 1200,
        "challenge": 0,
        "require_intent": 0,
        "reject": 0
      },
      "changed": {
        "allow→rate_limit": 1200
      },
      "by_class": {
        "declared_bot": {
          "rate_limit": 1200
        },
        "likely_human": {
          "allow": 300
        }
      },
      "reached_checkout": {
        "stopped": 0,
        "visits": 0,
        "flagged": 0
      },
      "unscored": 0,
      "unscored_facts": [],
      "sources": {
        "hosted": 0,
        "middleware": 1500,
        "edge": 0
      },
      "lists_as_of": "now"
    }
  },
  "limited_data": true,
  "policy_version": null,
  "shadow_version": 1,
  "published_version": null,
  "dismissed_until": null,
  "created_at": "2026-11-22T10:28:05.428Z",
  "updated_at": "2026-11-22T10:28:05.455Z"
}

Dismiss a rule suggestion

POST/v1/identify/policies/rule_suggestions/{id}/dismiss

Hides the draft for 90 days; a draft with the same conditions isn't suggested again meanwhile. A published suggestion can't be dismissed. Needs the assist on; see the guide.

Parameters

idstringpathRequired
The suggestion's ID (prs_).

Returns

The suggestion, dismissed.

Errors

export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x
curl -X POST "$PROVENANCE_API/v1/identify/policies/rule_suggestions/prs_01M81CRZ6CWWBVP9CVRT78V7Y7/dismiss" \
  -H "Authorization: Bearer $PROVENANCE_KEY"

Response 200

{
  "object": "identify_rule_suggestion",
  "id": "prs_01M81CRZ6CWWBVP9CVRT78V7Y7",
  "domain": "traffic",
  "status": "dismissed",
  "label": "Declared bots that never reach checkout",
  "rule": {
    "id": "draft-94932507be",
    "label": "Declared bots that never reach checkout",
    "when": [
      {
        "fact": "agent.class",
        "op": "eq",
        "value": "declared_bot"
      }
    ],
    "then": {
      "action": "rate_limit",
      "per": "agent",
      "window_seconds": 60,
      "max": 60
    }
  },
  "action": "rate_limit",
  "description": "If class eq declared_bot, then rate limit",
  "explanation": "This group sent 1200 requests and none reached checkout.",
  "explanation_source": "model",
  "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
  "evidence": {
    "kind": "crawler_load",
    "requests": 1200,
    "share": 0.8,
    "reached_checkout": 0,
    "flagged": 0,
    "rate": 0,
    "baseline_rate": 0,
    "total_requests": 1500,
    "window_from": "2026-10-23T10:28:05.591Z",
    "window_to": "2026-11-22T10:28:05.591Z"
  },
  "backtest": {
    "object": "policy_backtest",
    "available": true,
    "days": 30,
    "from": "2026-10-23T10:28:05.591Z",
    "to": "2026-11-22T10:28:05.591Z",
    "requests": 1500,
    "truncated": false,
    "field_conditions_unscored": false,
    "totals": {
      "allowed": 300,
      "challenged": 0,
      "rejected": 0
    },
    "rules": [
      {
        "rule_id": "draft-94932507be",
        "label": "Declared bots that never reach checkout",
        "outcome": "approve",
        "action": "rate_limit",
        "matched": 1200,
        "decided": 1200,
        "per_week": 280,
        "summary": "Last 30 days: would have rate limited 1,200 requests, about 280 a week"
      }
    ],
    "traffic": {
      "actions": {
        "allow": 300,
        "log_only": 0,
        "rate_limit": 1200,
        "challenge": 0,
        "require_intent": 0,
        "reject": 0
      },
      "changed": {
        "allow→rate_limit": 1200
      },
      "by_class": {
        "declared_bot": {
          "rate_limit": 1200
        },
        "likely_human": {
          "allow": 300
        }
      },
      "reached_checkout": {
        "stopped": 0,
        "visits": 0,
        "flagged": 0
      },
      "unscored": 0,
      "unscored_facts": [],
      "sources": {
        "hosted": 0,
        "middleware": 1500,
        "edge": 0
      },
      "lists_as_of": "now"
    }
  },
  "limited_data": true,
  "policy_version": null,
  "shadow_version": null,
  "published_version": null,
  "dismissed_until": "2027-02-20T10:28:05.612Z",
  "created_at": "2026-11-22T10:28:05.591Z",
  "updated_at": "2026-11-22T10:28:05.612Z"
}

Was this page helpful? Send us feedback

LLM? Read llms.txt.