Skip to main content

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.

POST /api/v1/decision-flows/ensure-base

Ensures a default “Base NBA Flow” exists for the tenant. If one already exists, returns its ID without creating a new one. Useful during onboarding or when the tenant needs a guaranteed starting flow.

Auto-created node order

The base flow ships with the following nodes (defined in lib/decision-flows/base-flow.ts:buildBaseFlowConfig):
PhaseNodeDefault config
1 (Narrow)inventoryscope: "all", includeStatuses: ["active"]
1 (Narrow)match_creativesplacementMatchMode: "exact", requireCreative: false
1 (Narrow)enrichoptional schema lookup with lookupKey: "customer_id"
1 (Narrow)qualifymode: "all"
1 (Narrow)contact_policymode: "all"
1 (Narrow)extension_pointpre_score hook (unconfigured)
2 (Score)scoremethod: "priority_weighted"
2 (Score)extension_pointscore_override hook (unconfigured)
2 (Score)rankmethod: "diversity", maxCandidates: 5
3 (Output)extension_pointpost_rank hook (unconfigured)
3 (Output)responseresponseFormat: "standard"
The match_creatives node with placementMatchMode: "exact" is a no-op when the request does not specify a placement (single-placement placement field or multi-placement placements: [...] body). When the request does specify a placement, the node filters candidates to creatives whose placementId matches, providing per-placement creative-pool isolation. requireCreative: false keeps offers that have no creative for the requested channel surfacing as fallback candidates so tenants who haven’t yet bound creatives to placements aren’t broken by the upgrade.

Response (200 — already exists)

{
  "flowId": "df_001",
  "created": false
}

Response (201 — newly created)

{
  "flowId": "df_002",
  "created": true
}

Roles

admin, editor

GET /api/v1/decision-flows//assembly-log

Returns the auto-assembly history for a decision flow. Each log entry records when the platform automatically rebuilt the flow’s pipeline in response to entity changes (new offers, updated rules, etc.).

Path Parameters

ParameterTypeDescription
idstringDecision flow ID

Response

{
  "decisionFlowId": "df_001",
  "autoAssembly": true,
  "entries": [
    {
      "timestamp": "2026-03-30T10:00:00Z",
      "trigger": "offer_created",
      "entityId": "off_005",
      "entityName": "Holiday Savings Promo",
      "pipelineVersion": 12,
      "nodesAdded": 2,
      "nodesRemoved": 0,
      "durationMs": 45
    },
    {
      "timestamp": "2026-03-29T15:30:00Z",
      "trigger": "qualification_rule_updated",
      "entityId": "qr_003",
      "entityName": "Min Credit Score",
      "pipelineVersion": 11,
      "nodesAdded": 0,
      "nodesRemoved": 0,
      "durationMs": 32
    }
  ],
  "count": 2
}

Response Fields

FieldTypeDescription
autoAssemblybooleanWhether auto-assembly is enabled for this flow
entriesarrayAssembly log entries (newest first)
countintegerTotal number of log entries

Error Codes

CodeReason
404Decision flow not found

Roles

any authenticated See also: Decision Flows