Skip to main content

Overview

A Qualification Rule is a configurable check that decides whether a customer may receive a particular Offer. Rules are evaluated inside the Filter stage of a Decision Flow. They come in two stages:
StageBehavior
qualificationHard gate — if the rule fails the Offer is dropped from the candidate set.
fitSoft penalty — if the rule fails the Offer’s score is multiplied by a decay factor (0.1 — 1.0) instead of being removed.
Rules are sorted by priority (highest first) and evaluated in order. The first hard-gate failure short-circuits — remaining rules for that Offer are skipped.

Rule Types

Kaireon ships five rule types. Each type has its own config shape and runtime evaluation logic.
Stage: qualification (hard gate)Checks that the customer belongs to all of the segments listed in requiredSegments (AND logic). If the customer is missing any of the required segments, the Offer is dropped.Config JSON
{
  "requiredSegments": ["premium", "high_value"]
}
Runtime behavior
  1. Read requiredSegments from config.
  2. Compare against the customer’s segment list (auto-resolved from enriched customer.segment field, or provided in the Recommend request).
  3. If the customer is in all of the required segments, the rule passes.
  4. If the customer is missing any required segment, the rule fails with a reason like Missing required segments: high_value.
  5. An empty requiredSegments array is treated as a pass (no restriction).

Scopes

Every Qualification Rule has a scope that controls which Offers it applies to. Narrower scopes let you write rules that target specific parts of your catalog without affecting everything else.
ScopescopeId resolves toWhen it applies
global(ignored)Every Offer in the tenant
segmentSegment IDOnly when the customer belongs to the segment
channelChannel IDOnly when the request targets that channel
categoryCategory IDOnly Offers in that Category
subcategorySubCategory IDOnly Offers in that SubCategory
offerOffer IDOnly that specific Offer
placementPlacement IDOnly when the request targets that placement
If a rule’s scope does not match the candidate Offer, the rule is skipped (treated as a pass).
When scopeId is null for a non-global scope, the rule applies to all entities at that scope level. For example, a rule with scope: "category" and scopeId: null applies to every Category.

Stages: Qualification vs Fit

Qualification (hard gate)Fit (soft penalty)
On failureOffer removed from candidate setOffer score multiplied by a decay factor
Typical rule typessegment_required, attribute_condition, metric_conditionpropensity_threshold, recency_check
Multiplier rangeN/A0.1 — 1.0
CombinationFirst failure short-circuitsAll fit multipliers are combined multiplicatively
When multiple fit rules apply to the same Offer, their multipliers are multiplied together. For example, if a propensity rule returns 0.8 and a recency rule returns 0.5, the final multiplier is 0.8 x 0.5 = 0.4.

Evaluation Order

During the Filter stage of a Decision Flow, rules are evaluated as follows:
  1. Load all active Qualification Rules that match the flow’s filter mode (all, selected, or none).
  2. Separate rules into qualification (hard gate) and fit (soft penalty) groups.
  3. Sort each group by priority descending (highest priority first).
  4. For each candidate Offer:
    • Evaluate all qualification rules whose scope matches the candidate. First failure drops the Offer.
    • Evaluate all fit rules whose scope matches the candidate. Accumulate the combined multiplier.
  5. Surviving Offers proceed to the Scoring stage with their fit multiplier applied.

Decision Flow Filter Modes

ModeBehavior
allEvery active Qualification Rule in the tenant is evaluated.
selectedOnly the rules whose IDs are listed in qualificationRuleIds are evaluated.
noneQualification is skipped entirely.
Setting the filter mode to none bypasses all Qualification Rules. Offers may be recommended to ineligible customers. Use with caution.

AND/OR Logic Trees

For advanced scenarios, Kaireon supports recursive AND/OR logic groups via the QualificationLogicGroup structure. This allows you to compose rules into arbitrarily nested boolean expressions.
{
  "operator": "AND",
  "ruleIds": ["rule_segment_premium", "rule_credit_720"],
  "groups": [
    {
      "operator": "OR",
      "ruleIds": ["rule_high_propensity", "rule_recent_login"]
    }
  ]
}
The example above evaluates as:
rule_segment_premium AND rule_credit_720 AND (rule_high_propensity OR rule_recent_login)
Vacuous truth rules:
  • An empty AND group (no ruleIds, no sub-groups) evaluates to true.
  • An empty OR group evaluates to false.
The evaluator walks the tree recursively: each group collects boolean results from its ruleIds (via the qualification engine) and its nested groups, then applies the group’s operator (AND = every result must be true; OR = at least one must be true).

Field Reference

All fields accepted by the POST /api/v1/qualification-rules endpoint:
FieldTypeRequiredDefaultDescription
namestringYesUnique display name for the rule.
descriptionstringNo""Free-text description.
statusenumNo"active"One of draft, active, paused, archived. Only active rules are evaluated at decision time.
scopeenumNo"global"One of global, segment, channel, category, subcategory, offer, placement.
scopeIdstring | nullNonullThe ID of the entity the scope targets (e.g., a Category ID when scope is category). Null means “all entities at this scope level.”
ruleTypeenumYesOne of segment_required, attribute_condition, propensity_threshold, recency_check, metric_condition, offer_attribute.
configobjectNo{}Rule-type-specific configuration (see each rule type tab above).
priorityintegerNo500—100. Higher-priority rules are evaluated first.
stageenumNo"qualification"One of qualification (hard gate) or fit (soft penalty).

Worked Example

Customer C-4821 requests a decision for the “Gold Card Upgrade” Offer. Three Qualification Rules are active.

Rule definitions

#NameTypeScopeConfig
1Premium Segment Gatesegment_requiredglobal{ "requiredSegments": ["premium"] }
2Min Credit Scoreattribute_conditioncategory:credit-cards{ "attribute": "customer.credit_score", "operator": "gte", "value": 720 }
3Impression Capmetric_conditionglobal{ "metricId": "monthly_impressions", "operator": "gt", "threshold": 10, "dimensionMapping": { "offerId": "$candidate.offerId" } }

Pass scenario (credit_score = 745)

Customer context:
  • Segments: ["premium", "high_value"]
  • customer.credit_score: 745
  • monthly_impressions metric value: 8
RuleCheckResult
1 — Premium Segment Gate"premium" in segments?Pass
2 — Min Credit Score745 >= 720?Pass
3 — Impression Cap8 > 10? false — condition not triggeredPass
The Offer survives and proceeds to scoring. Debug trace (abbreviated):
{
  "totalCandidates": 12,
  "afterQualification": 9,
  "qualificationReasons": []
}
No entries in qualificationReasons for this Offer because all three rules passed.

Fail scenario (credit_score = 680)

Same customer but with customer.credit_score = 680.
RuleCheckResult
1 — Premium Segment Gate"premium" in segments?Pass
2 — Min Credit Score680 >= 720?Fail
Rule 2 fails. The engine short-circuits — Rule 3 is not evaluated. The Offer is dropped. Debug trace (abbreviated):
{
  "totalCandidates": 12,
  "afterQualification": 8,
  "qualificationReasons": [
    {
      "offerId": "offer_gold_card_upgrade",
      "creativeId": "",
      "reason": "Attribute \"customer.credit_score\" gte 720 failed (actual: 680)",
      "policyId": "qr_min_credit_score"
    }
  ]
}

API Quick Reference

Create a Qualification Rule

POST /api/v1/qualification-rules
{
  "name": "Premium Segment Gate",
  "ruleType": "segment_required",
  "scope": "global",
  "stage": "qualification",
  "priority": 80,
  "config": {
    "requiredSegments": ["premium"]
  }
}
Response: 201 Created with the full rule object including id, createdAt, and updatedAt.

List Qualification Rules

GET /api/v1/qualification-rules
Returns a paginated list sorted by priority (descending), then by creation date (descending). Supports cursor-based pagination via cursor and limit query parameters.

Update a Qualification Rule

PUT /api/v1/qualification-rules
Send the rule id plus any fields to update. Only provided fields are changed.

Delete a Qualification Rule

DELETE /api/v1/qualification-rules?id={ruleId}
Soft-deletes the rule (retains the record with a deletedAt timestamp). Returns { "deleted": true, "warnings": [...] }. If the rule is referenced by any Decision Flow’s draftConfig, the response includes a warnings array listing affected flows (ghost reference check). For complete request/response schemas, see the API Reference.

Contact Policies

Frequency caps and cooldown rules that limit how often a customer is contacted.

Decision Flows

Orchestrate Qualification Rules, scoring, and ranking into a complete decision pipeline.

Behavioral Metrics

Define the metrics used by metric_condition rules.

Composable Pipeline

The v2 pipeline includes a dedicated qualify node for inline qualification.