Skip to content

Quick Start

Let’s build a “senior discount” policy step by step.

Step 1: Define the Rule

We want: customers aged 65 or older qualify for a senior discount.

A **Customer** qualifies for senior discount
if __age__ of **Customer** is greater than or equal to 65.

Let’s break this down:

PartMeaning
A **Customer**We’re evaluating a Customer object
qualifies for senior discountThe outcome if conditions pass
__age__Access the age property
of **Customer**From the Customer object
is greater than or equal to 65The comparison
.End of rule

Step 2: Try It

Interactive Example

Policy Rule
Test Data (JSON)

Try changing the age to 50 and running again — the result should flip to Fail.

Step 3: Add More Conditions

Let’s require that the customer also has an active membership:

A **Customer** qualifies for senior discount
if __age__ of **Customer** is greater than or equal to 65
and __membership__ of **Customer** is equal to "active".

Interactive Example

Policy Rule
Test Data (JSON)

Step 4: Call the API Directly

You can evaluate this policy via a simple HTTP call:

Terminal window
curl -X POST https://api.policy.keloran.dev/run \
-H "Content-Type: application/json" \
-d '{
"rule": "A **Customer** qualifies for senior discount if __age__ of **Customer** is greater than or equal to 65.",
"data": { "Customer": { "age": 70 } }
}'

Next Steps