Skip to main content

Overview

This tutorial covers everything you need to integrate with KaireonAI’s two core APIs:
  • Recommend API — Get personalized offer recommendations for a customer
  • Respond API — Record customer interactions (impressions, clicks, conversions)

Prerequisites

Before starting, ensure you have:
  • A running KaireonAI instance (local or https://playground.kaireonai.com)
  • At least one active Decision Flow with Offers, channels, and Creatives configured
  • Your tenant ID (found in Settings > General)
  • An API key (generated in Settings > API Explorer)

Authentication

All API requests require two headers:
The Recommend and Respond APIs are the public data plane — any krn_ API key can call them, including default keys minted without scopes. Management endpoints (the control plane) require a first-party session, an MCP connection, or a key minted with the control-plane scope; see API Keys.
API keys are hashed on the server using HMAC-SHA256 with the API_KEY_PEPPER environment variable. Store your API key securely — it cannot be retrieved after creation.

Base URL


Recommend API

The Recommend API is the primary decisioning endpoint. It executes a Decision Flow for a specific customer and returns ranked, personalized offers.

Endpoint

Request Body

Every POST response includes the pipeline funnel counts in meta — there is no separate debug flag to enable them on this endpoint.

Response

Response Fields

Once you receive recommendations, record how customers interact with them using the Respond API.

Respond API

The Respond API records customer interactions with recommendations. KaireonAI feeds this data back into behavioral metrics, contact policies, and experiment analysis.

Endpoint

Request Body

Response

outcome echoes the key you recorded (e.g. click); classification is the outcome type’s sentiment — positive, negative, or neutral. A repeat call with the same idempotency key returns status: "already_recorded".

Common Outcome Types


Advanced Topics

Decision Traces

KaireonAI records a forensic trace of the entire decision process for each POST recommendation (subject to the tenant’s trace sample rate). Retrieve it with the recommendationId from the response:
Decision traces are a control-plane endpoint: a default data-plane-only API key gets 403 here. Use a browser session or a key minted with the control-plane scope (see API Keys).
Trace response:
Decision traces are invaluable for debugging why a specific offer was or was not recommended. Enable tracing in staging environments and at a sample rate in production (configurable in Settings > General).

Experiments

When an A/B experiment is active, KaireonAI automatically assigns customers to control or variant groups. The response surfaces the assignment at the top level via experimentVariant and controlGroup, and each decision reflects the assigned creative:
Track experiment results in Algorithms > Experiments, where KaireonAI calculates:
  • Conversion rate per variant
  • Uplift (percentage improvement over control)
  • Statistical significance (z-test)
  • Confidence interval

Computed Values in Responses

The personalization field in each recommendation contains the evaluated computed values from the Decision Flow’s Compute stage. These values are calculated per customer using:
  • Offer custom fieldsbase_rate, annual_fee, etc.
  • Enriched customer datacustomer.loyalty_score, customer.credit_score
  • Request-time attributesattributes.tier, attributes.device
See Computed Values for formula syntax and configuration details.

Error Handling

Common Error Responses

Error response format:

Rate Limiting

KaireonAI protects the platform with a sliding-window rate limit of 1,000 requests per minute per tenant. Playground tenants are limited to 100 requests per minute. When rate-limited, the API returns:
Rate limits apply per tenant, not per API key. Multiple API keys for the same tenant share the same rate limit window.

What’s Next?

Platform Walkthrough

Follow the end-to-end setup guide with hands-on examples.

Decision Flows

Learn how the decisioning pipeline works under the hood.

Formula Reference

Complete syntax reference for computed value formulas.

Behavioral Metrics

Build dynamic rules from interaction history.

Sample Data

Load demo data to test the APIs with realistic content.

MCP Quickstart

Connect your AI IDE to query and configure KaireonAI.