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:
| Part | Meaning |
|---|---|
A **Customer** | We’re evaluating a Customer object |
qualifies for senior discount | The outcome if conditions pass |
__age__ | Access the age property |
of **Customer** | From the Customer object |
is greater than or equal to 65 | The 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:
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
- Learn about Core Concepts — selectors, properties, and rules
- Explore Operators — all the ways to compare values
- Try the Playground — experiment freely