Skip to main content

Base URLs

All paths in this reference are relative to the base URL. For example, POST /recommend means POST https://playground.kaireonai.com/api/v1/recommend.

Authentication

Every API request must identify a tenant. There are two ways to do that.

The two API planes

The API is split into a data plane and a control plane:
  • Data plane — exactly POST /recommend, POST /respond, POST /respond/bulk, and POST /capture (a legacy alias of /respond). This is the runtime decisioning loop your own systems call machine-to-machine, and it is what any krn_ API key can reach.
  • Control plane — everything else in this reference: all management CRUD (schemas, offers, categories, channels, creatives, decision flows, decisioning gates, connectors, pipelines, segments, models, reports, settings, API keys, …). Control-plane endpoints are first-party only — they require a browser session, an MCP connection, or an API key minted with the control-plane scope (admin-only to mint; see API Keys).
A key without the required access gets an HTTP 403:
Migration note: as of the control-plane / data-plane split, existing API keys with no explicit scopes are now data-plane-only (recommend/respond). To manage resources programmatically, mint a new key with the control-plane scope.
Pass your key in the X-API-Key header. Every key starts with the krn_ prefix and is bound to the tenant that created it:
Generate API keys in Settings > API Keys. There is no Authorization: Bearer scheme — a Bearer token is rejected with 401. Because the key already identifies the tenant, X-Tenant-Id is optional on API-key requests: when both are sent, the key’s tenant wins and the header is ignored (this prevents tenant spoofing). You may still include X-Tenant-Id for readability.
State-changing requests (POST/PUT/PATCH/DELETE) that use an API key must also send Content-Type: application/json (or an X-Requested-With header). This is the CSRF guard; a state-changing API-key request without either is rejected with 403.
When using the KaireonAI platform UI, requests authenticate via session cookie automatically. The tenant is resolved from the JWT session. No additional headers are needed.
Keep your API key secret. Never expose it in client-side code or public repositories.

Common Headers

Idempotency

Idempotency is enforced only on the outcome-recording endpoints, where a retried delivery must never double-count a reward: Deduplication is enforced by a unique database constraint on the interaction row ((tenantId, idempotencyKey)), not merely by a cache — even two concurrent retries collapse to a single recorded outcome.
Every other mutating endpoint is NOT idempotent by design. The management (control-plane) CRUD endpoints — create / update / delete for schemas, offers, categories, channels, creatives, decision flows, connectors, pipelines, segments, models, settings, and so on — do not honor Idempotency-Key. A retried POST/PUT/PATCH/DELETE on those routes may create a duplicate or re-apply the change. Make retries safe on the caller side (check-then-write, or rely on a natural unique key). Broadening idempotency to more endpoints is on the roadmap, not a current guarantee.

Pagination

List endpoints that support pagination return a cursor-based response. The page rows are in data; the paging state is nested under pagination:
pagination.cursor is the next cursor — pass it back as the cursor query parameter to fetch the following page. It is null on the last page. total is included only when the endpoint runs a count query. Fetch the next page with ?cursor=<pagination.cursor>. Query parameters:

Error Response Format

All errors follow a consistent structure:
Validation errors from Zod schemas return a combined detail string:

Status Codes

Rate Limiting

API requests are rate-limited per tenant on a sliding window basis. The default limit is 1,000 requests per 60-second window. When a request is rate-limited, the response includes these headers: Example 429 response:
When you receive a 429, wait for the number of seconds in the Retry-After header before retrying.

Next Steps

Recommend API

Get personalized next-best-action recommendations for a customer.

Respond API

Record impressions, clicks, conversions, and other outcomes.

API Tutorial

End-to-end walkthrough with advanced features like Decision Flows and computed values.

MCP Server

Use the Recommend and Respond APIs as MCP tools from AI agents.