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.
GET /api/v1/customers//eligibility
Returns a detailed eligibility report for a customer across all active offers. For each offer, evaluates every qualification rule and contact policy, returning pass/fail with reasons.Response
rank (1-based); ineligible offers have rank: null.
Contact policy result objects
When a contact policy blocks an offer, theblockedPolicies array contains objects with:
| Field | Type | Description |
|---|---|---|
policyId | string | Contact policy ID |
policyName | string | Contact policy name |
ruleType | string | frequency_cap, cooldown, or time_window |
blocked | boolean | Whether this policy blocked the offer |
reason | string | Human-readable reason (e.g., "Daily limit reached (5/5)") |
GET /api/v1/customers//profile
Returns a traced decision pipeline for a customer, showing the full evaluation funnel from all offers down to ranked results.Response
Qualification rejection detail types
Thedetail object in qualificationRejections varies by rule type:
| Rule Type | Detail Fields |
|---|---|
segment_required | required (string[]), actual (string[]) |
attribute_condition | attribute, operator, expected, actual |
propensity_threshold | model, minScore, actualScore |
recency_check | attribute, maxDays, actualDays |
Contact policy rejection detail types
| Rule Type | Detail Fields |
|---|---|
frequency_cap | period, max, actual |
cooldown | cooldownHours, hoursSinceLast |
budget_exhausted | budgetField, threshold, actual |
outcome_based | afterOutcome, suppressForDays, daysSince, lastOutcome |
segment_exclusion | excludeSegments (string[]), matchedSegment |
time_window | allowedDays, currentDay, startHour, endHour, currentHour |
mutual_exclusion | offerGroup (string[]), conflictingOfferId |
category_suppression | categoryId, subCategoryId, suppressionDays, daysSince, triggeringOfferId, suppressedUntil |
POST /api/v1/customers//simulate
Runs the Recommend API internally for a customer and returns the full decision result including scores, rankings, and channel assignments. Always includes debug information.Request Body
| Field | Type | Required | Description |
|---|---|---|---|
channel | string | No | Filter by channel |
placement | string | No | Filter by placement |
limit | integer | No | Max results (default: 20) |
flowId | string | No | Decision flow ID or key (alias: decisionFlowKey) |
Response
Error Response
If the internal recommend call fails:GET /api/v1/customers//suppressions
Returns active suppressions for a customer with resolved offer names.Response
| Field | Type | Description |
|---|---|---|
scope | string | Suppression scope (offer, category, global) |
scopeId | string | ID of the scoped entity |
offerName | string or null | Resolved offer name (only when scope is offer) |
policyType | string | Contact policy type that triggered the suppression |
triggerCount | integer | Number of times the suppression was triggered |
expiresAt | string | ISO timestamp when the suppression expires |
isActive | boolean | Whether the suppression is currently active (expiresAt > now) |
GET /api/v1/customers//summaries
Returns interaction summary aggregates for a specific customer, including per-offer breakdowns and rolled-up totals.Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
periodType | string | No | Filter: daily, weekly, monthly, alltime |
periodKey | string | No | Specific period key (e.g., 2026-03-30, 2026-W13) |
offerId | string | No | Filter by specific offer |
channelId | string | No | Filter by specific channel |
Response
DELETE /api/v1/customers/
Deletes all stored data for a customer. Supports GDPR right-to-erasure (DSAR) workflows. Deletes interaction history, interaction summaries, experiment assignments, and impressions in foreign-key-safe order.Response
Error codes
| Code | Reason |
|---|---|
403 | Caller does not have admin role. |
DELETE /api/v1/customers//data
Scoped, GDPR-compliant deletion of customer data with a confirmation safeguard. The route atsrc/app/api/v1/customers/[customerId]/data/route.ts:24-122 requires the caller to set the X-Confirm-Delete header to the same customerId in the path — a missing or mismatched header returns 400 so a stray DELETE call cannot purge data by accident.
Three scopes are supported via the scope query parameter (route.ts:46-50):
| Scope | Tables affected |
|---|---|
interactions | interaction_history, interaction_summary |
traces | decision_traces |
all | interactions + traces + experiment_assignments + impressions (DSAR-style full purge) |
all (route.ts:44).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
customerId | string | Customer identifier to purge. |
Query Parameters
One of
interactions, traces, all. Any other value returns 400.Required headers
| Header | Required | Read at | Purpose |
|---|---|---|---|
X-Confirm-Delete | Yes | route.ts:36 | Must equal the customerId path parameter. Mismatch returns 400. |
X-API-Key | Yes (one of the two) | tenant.ts:97 | API key (krn_…) |
X-Tenant-Id | Yes (one of the two) | tenant.ts:113 | Direct tenant id |
Response
Returned atroute.ts:112-118.
Sum of all per-table counts.
Per-table delete counts. Tables outside the requested scope are absent.
decisionTraces, experimentAssignments, and impressions are wrapped in try/catch — if the table is unavailable the count is reported as 0 rather than failing the request (route.ts:74-97).Status codes
| Code | When | Source |
|---|---|---|
| 200 | Deletion succeeded | route.ts:112 |
| 400 | Missing or mismatched X-Confirm-Delete header | route.ts:37-41 |
| 400 | Invalid scope query value | route.ts:46-50 |
| 401 | Caller is not authenticated | requireRole |
| 403 | Caller is not admin | requireRole(request, "admin") at route.ts:29 |
| 500 | Unexpected error | route.ts:120 |
Audit
Every successful call writes onedelete row to audit_logs with entityType: "customer_data" and the per-table counts in changes (route.ts:101-108). The audit row is fire-and-forget — a failed log write does not roll back the deletion.
Roles
admin only.Role requirements
| Endpoint | Allowed Roles |
|---|---|
GET /customers/{id}/eligibility | admin, editor, viewer |
GET /customers/{id}/profile | admin, editor, viewer |
POST /customers/{id}/simulate | admin, editor, viewer |
GET /customers/{id}/suppressions | admin, editor, viewer |
GET /customers/{id}/summaries | admin, editor, viewer |
DELETE /customers/{id} | admin |
DELETE /customers/{id}/data | admin |