Available now

API Integration

Integrate Lumika into your own frontend or backend using a workspace-scoped integration token, streaming responses, and polling-based history sync.

Developer Highlights

What you get out of the box

Streaming response flow

Send a message with SSE and receive partial or final model output in real time.

Deterministic conversation IDs

Reuse your own customer identifier as conversationId for stable thread continuity.

History with message IDs

Use message IDs and the afterId cursor to deduplicate and incrementally fetch updates.

Internal notes excluded

Conversation history endpoint returns only customer/assistant records, never internal notes.

Domain allowlist support

For browser-based clients, optionally restrict requests to configured allowed domains.

Architecture and Security

The mechanics behind the integration

Authentication model

Each API integration account has a unique integration token generated in your workspace.

  • Pass integrationToken as a query parameter on /conversation endpoints.
  • Treat the integration token like a secret and keep it server-side when possible.
  • If allowedDomains are configured, browser requests from other domains are rejected.
  • You can rotate the integration by creating a new account and retiring the old one.

Conversation model

conversationId is your customer/session key and should be stable per user when continuity is needed.

  • Reuse the same conversationId to continue a thread and preserve full history.
  • Omit conversationId on first message to start a fresh conversation id.
  • Use your own user/customer ID as conversationId for deterministic mapping.
  • History and message polling rely on conversationId and afterId cursor.
Best practice: proxy requests through your backend so browser clients never see long-lived secrets.

History payload shape

The history endpoint returns a normalized feed suitable for polling-based chat UIs and API clients.

  • messages[] contains id, actor, type, body, data, createdAt.
  • lastMessageId is a cursor you can pass back via afterId.
  • limit defaults safely and is capped server-side.
  • Internal activity records are filtered out by the backend.
{
  "conversationId": "customer-42",
  "messages": [
    {
      "id": "a12f...",
      "actor": "customer",
      "type": "message",
      "body": "Hey, can I reschedule?",
      "createdAt": "2026-02-09T20:05:13.021Z"
    }
  ],
  "lastMessageId": "a12f..."
}

Quick Start

Get connected step by step

Use these steps for API clients, backend workers, or custom frontends.

01

Create integration and copy token

  • Open Dashboard → Integrations and create an API integration.
  • Copy the generated integration token from the account settings.
  • Decide whether you want strict domain allowlisting for browser requests.
  • Assign a Responder assistant to the API account (required for generated replies).
  • Choose response mode: Auto replies or Manual approval (approved customers only).
02

Send a message via SSE

  • Call /conversation/sse with integrationToken and textContent.
  • Optionally pass conversationId to continue an existing customer thread.
  • Use query parameters (EventSource). Do not send JSON body to this endpoint.
  • Read streamed events and store the returned conversationId/userMessageId.
const params = new URLSearchParams({
  integrationToken: 'YOUR_INTEGRATION_TOKEN',
  textContent: 'Hi, can you help me with billing?',
  conversationId: 'customer-42'
});

const source = new EventSource(
  'https://api.your-domain.com/conversation/sse?' + params.toString()
);

source.onmessage = (event) => {
  const payload = JSON.parse(event.data);
  console.log(payload);
};
03

Poll history for updates and manual replies

  • Call /conversation/history with integrationToken and conversationId.
  • Store lastMessageId and pass it as afterId for incremental polling.
  • Poll every 10-15 seconds (12 seconds is a practical default).
const query = new URLSearchParams({
  integrationToken: 'YOUR_INTEGRATION_TOKEN',
  conversationId: 'customer-42',
  afterId: 'LAST_MESSAGE_ID',
  limit: '100'
});

const res = await fetch('https://api.your-domain.com/conversation/history?' + query.toString());
const history = await res.json();

Endpoints

Endpoint Reference

These endpoints are available for API and Website Widget integrations and support conversation history sync.

SSE/conversation/sse?integrationToken=...&textContent=...&conversationId=...?

Send one message and receive a streamed response. conversationId is optional on first message. Uses GET + query params.

GET/conversation/history?integrationToken=...&conversationId=...&afterId=...&limit=...?

Fetch conversation history and new records using the afterId cursor and message IDs.

Get started

Ready to Build Your API Client?

Create an API integration, send your first SSE request, and wire polling to keep message history in sync.