Skip to main content

Overview

This guide shows you how to call the KaireonAI APIs from JavaScript (Node.js / browser) and Python. Both examples cover the two core endpoints:
  • Recommend — get personalized next-best-action offers for a customer
  • Respond — record outcomes (impressions, clicks, conversions) to close the feedback loop

Prerequisites

Every request sends your two auth headers plus a JSON content type:
For API-key requests, Content-Type: application/json is what satisfies the server’s CSRF check — the X-Requested-With header is only needed for browser/cookie-authenticated (same-origin) calls.

JavaScript

Install dependencies

No SDK package is needed — the built-in fetch API works in Node 18+ and all modern browsers. If you prefer a library:

Recommend API

Response shape:

Respond API

After the customer sees or interacts with an offer, record the outcome:
Response shape (201 Created):

Error handling

Wrap calls in a try/catch and handle common status codes:

Python

Install dependencies

Recommend API

Respond API

Error handling


Next steps

  • API Tutorial — deep dive into request/response formats, decision traces, and experiments
  • Computed Values — personalize offers with dynamic formulas
  • Sample Data — load sample offers and customers into your instance