Settle a small claim without a handler when the policy is active, the claim is recent, and documents are verified.
A **claim** is auto_approved
if the __amount__ of the **claim** is less than or equal to 1000
and the __days_since_incident__ of the **claim** is less than or equal to 30
and the __documents_verified__ of the **claim** is equal to true
and the __status__ of the **policy** is equal to "active"
and the __claims_last_12_months__ of the **policy** is less than 2.
Change the policy or the input and evaluate it here — no account needed.
Policy
Input
{
"properties": {
"claim": {
"properties": {
"amount": {
"type": "number"
},
"days_since_incident": {
"type": "number"
},
"documents_verified": {
"type": "boolean"
}
},
"required": [
"amount",
"days_since_incident",
"documents_verified"
],
"type": "object"
},
"policy": {
"properties": {
"status": {
"type": "string"
},
"claims_last_12_months": {
"type": "number"
}
},
"required": [
"status",
"claims_last_12_months"
],
"type": "object"
}
},
"required": [
"claim",
"policy"
],
"title": "Claim Model",
"type": "object"
}Small verified claim
Expect pass{
"claim": {
"amount": 320,
"days_since_incident": 6,
"documents_verified": true
},
"policy": {
"status": "active",
"claims_last_12_months": 0
}
}Documents missing
Expect fail{
"claim": {
"amount": 320,
"days_since_incident": 6,
"documents_verified": false
},
"policy": {
"status": "active",
"claims_last_12_months": 0
}
}Execute this policy from your app using one of the official SDKs.
import { ExecutionClient } from "@policies2/sdk";
const client = new ExecutionClient({
apiKey: process.env.POLICY_API_KEY!,
transport: { kind: "rest", baseUrl: "https://api.policy2.net" },
});
const result = await client.executePolicy({
id: "your-policy-id", // replace with your published policy ID
reference: "base",
data: {
"claim": {
"amount": 320,
"days_since_incident": 6,
"documents_verified": true
},
"policy": {
"status": "active",
"claims_last_12_months": 0
}
},
});
if (result.result) {
console.log("policy matched");
} else {
console.log("policy did not match");
}Ready to version this policy and wire it into a flow?
Open in editor