SDK reference · Node SDK

prov.mandate.policies.simulateRisk

prov.mandate.policies.simulateRisk in Node SDK. Dry-run a claims_risk policy, returns a score/status/factors preview over the given claim facts (+ optional base risk signals) instead of a verify evaluation.

Signature

prov.mandate.policies.simulateRisk(params: { document?: RiskPolicyDocument; facts: Record<string, string | number | boolean | null>; baseSignals?: Record<string, boolean>; }): Promise<RiskSimulation>

Parameters

params{ document?: RiskPolicyDocument; facts: Record<string, string | number | boolean | null>; baseSignals?: Record<string, boolean>; }Required

Request fields

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

Promise<RiskSimulation> 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.

HTTP operation

POST /v1/attest/risk_policies/simulate: Simulate a risk policy

Errors

Example

const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/risk_policies/simulate`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x", "Content-Type": "application/json" },
  body: JSON.stringify({
    "document": {
      "thresholds": {
        "verified": 20,
        "partial": 60
      }
    },
    "facts": {
      "claim_type": "auto",
      "gps_present": false,
      "biometric_present": true,
      "attested": true
    },
    "base_signals": {
      "gps_absent": true
    }
  }),
})).json();

Was this page helpful? Send us feedback

LLM? Read llms.txt.