SDK reference · Python SDK
prov.mandate.policies.simulate_risk
prov.mandate.policies.simulate_risk in Python SDK.
Signature
prov.mandate.policies.simulate_risk(**body: Any = …) -> AnyParameters
**bodyAny
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, integertotalin minor units,currency,items); itsorder.*facts joinfacts, as on verify. attimestamp- When the preview starts (default now): business hours and escalation times count from it.
Returns
Any 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
- authentication_required
- invalid_json
- parameter_invalid
- parameter_missing
- policy_account_required
- policy_invalid
- rate_limit_exceeded
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();import os
import httpx
api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/attest/risk_policies/simulate", headers={"Authorization": "Bearer prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x"}, json={
"document": {
"thresholds": {
"verified": 20,
"partial": 60
}
},
"facts": {
"claim_type": "auto",
"gps_present": False,
"biometric_present": True,
"attested": True
},
"base_signals": {
"gps_absent": True
}
}).json()