Documentation Index
Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt
Use this file to discover all available pages before exploring further.
See also: Qualification Rules concept and configuration for what this API powers, when to call it, and how it is configured.
See the Qualification Rules feature page for UI guidance and conceptual overview.
Base path
List qualification rules
Query parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
limit | No | integer | Maximum results per page. Default 25. |
cursor | No | string | Cursor for keyset pagination. |
includeDeleted | No | boolean | Include soft-deleted records. Default false. |
stage | No | enum | Filter by Decisioning Gates stage: eligibility, fit, match, ranking. Filters rows whose classified stage matches. Returns 400 if the value is not one of those four. |
decisioningStage field — the classified stage (one of eligibility, fit, match, ranking) — so the UI can render the three-section layout without re-running the classifier client-side. Legacy stage values (qualification → eligibility, applicability → fit, suitability → match) are mapped automatically.
Response 200
Create a qualification rule
admin role.
Request body
| Field | Required | Type | Description |
|---|---|---|---|
name | Yes | string (1-255) | Unique rule name. |
description | No | string | Rule description. |
status | No | enum | draft, active (default), paused, archived. |
scope | No | enum | global (default), segment, channel, category, subcategory, offer, creative, placement. |
scopeId | No | string | null | ID of the scoped entity (required when scope is not global). |
ruleType | Yes | enum | One of: segment_required, attribute_condition, propensity_threshold, recency_check, metric_condition. The config schema is validated as a discriminated union — see the per-rule-type schemas below. |
config | Yes | object | Rule-type-specific configuration. Schema depends on ruleType (see table below). |
priority | No | integer (0-100) | Evaluation priority (higher = evaluated first). Default 50. |
stage | No | enum | Decisioning Gates stage: eligibility (default), fit, match, ranking. Legacy qualification is auto-mapped to eligibility on read. |
scopes | No | array | Array of scope assignments. Each item: { scope: "global"|"segment"|"channel"|"category"|"subcategory"|"offer"|"creative"|"placement", scopeId: "entity-UUID" | null }. When provided, overrides the legacy scope/scopeId fields and persists multiple assignments via the qualification_rule_scopes join table. A rule can have multiple scope assignments simultaneously. |
Rule types and config schemas
EachruleType validates against a typed config schema at the API boundary — misspelled or missing required fields are rejected with 400.
| Type | Description | Config schema |
|---|---|---|
segment_required | Customer must be in the named segment. | { "segmentId": "<segment-id>" } — segmentId required (string, non-empty). |
attribute_condition | Customer attribute must match a condition. | { "attribute": "<path>", "operator": "<op>", "value": <any> } — operator ∈ eq, neq, lt, lte, gt, gte, in, contains, exists, not_exists. value may be omitted for exists/not_exists. |
propensity_threshold | Model score must exceed a threshold. | { "threshold": <0..1>, "modelId": "<optional-model-id>" } — threshold required (number in [0, 1]). |
recency_check | Days-since-last-activity attribute must be within a window. | { "attribute": "<path>", "withinDays": <positive-int> } — both required. |
metric_condition | A behavioral metric must meet a numeric condition. | { "metricId": "<metric-id>", "operator": "<op>", "value": <number> } — operator ∈ eq, neq, lt, lte, gt, gte. |
Example request
Response 201
Returns the created qualification rule object.
Validation
All fields are validated via Zod schemas (CreateQualificationRuleSchema is a discriminated union on ruleType):
name: 1-255 characters, must be unique per tenant.ruleType: Must be one of the five enum values;configis then validated against the typed schema for that variant.scope: Must be one of the eight enum values (global,segment,channel,category,subcategory,offer,creative,placement).priority: Integer, 0-100.stage: Must beeligibility,fit,match, orranking.
Error codes
| Code | Reason |
|---|---|
400 | Validation error (missing name or ruleType, invalid scope/priority). |
409 | A qualification rule with that name already exists. |
415 | Content-Type is not application/json. |
Update a qualification rule
admin role.
Request body
All fields from the create schema are accepted as optional, plus:| Field | Required | Type | Description |
|---|---|---|---|
id | Yes | string | The rule ID to update. |
Example request
Response 200
Returns the updated qualification rule object.
Delete a qualification rule
draftConfig.
Query parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
id | Yes | string | Rule ID to delete. |
Response 200
This endpoint uses soft-delete — the record is not physically removed from the database. It is excluded from GET results by default. To include soft-deleted records, pass
?includeDeleted=true on the GET request.Unlike most DELETE endpoints that return
204, this endpoint returns 200 with a body so it can communicate ghost-reference warnings. The API checks all Decision Flows in the tenant for references to this rule ID in their draftConfig.stages.filter.qualificationRuleIds array.Error codes
| Code | Reason |
|---|---|
400 | Missing id query parameter, or soft-delete failed. |
Role requirements
| Method | Minimum role |
|---|---|
| GET | viewer |
| POST | admin |
| PUT | admin |
| DELETE | admin |
Soft-delete and audit
Qualification rules use soft-delete with audit snapshots. When a rule is deleted:- The
deletedAttimestamp is set (record is retained). - An audit snapshot is captured with the full state before deletion.
- Ghost reference warnings are returned if the rule is still referenced by any Decision Flow.
auditedUpdate, incrementing the rowVersion on each change. This provides a full change history for compliance and debugging.
To include soft-deleted rules in GET responses, add ?includeDeleted=true to the query string.
Multi-scope rules are evaluated differently: global-scoped rules are evaluated in the Decision Flow’s Qualify node, while entity-scoped rules (offer, category, channel, creative) are automatically evaluated per-candidate during the recommend pipeline.
Qualification Rules
Learn more about configuring qualification rules in the platform UI.