Skip to main content
Add a session_id to any /chat request and NinjaChat stores the conversation server-side for 7 days. No message arrays to manage, no growing payloads.
First request
Second request — history injected automatically
“You told me your name is Alice and you work in fintech.”
Responses include where the conversation stands:
Sessions are created on first use — you can just start chatting with a new session_id. IDs are 1–64 chars of [a-zA-Z0-9_-], scoped to your API key.

Manage sessions

A support bot in 15 lines

Limits

Message limits

Sessions don’t grow forever, but they don’t just drop old turns either. Once a session passes 60 stored messages, it auto-summarizes in the background: an AI model (infrastructure-only, not billed to you) compresses everything except the most recent 20 messages into a single structured summary message (established facts, character/persona state, open threads, tone preferences), which then replaces those older turns. The session keeps going from summary + last 20 rather than growing unbounded. There’s also a hard emergency ceiling — if a session somehow reaches 100 messages before a pending summarization finishes, it’s truncated to the most recent 50 so a single session can never grow without bound. In normal use, summarization at 60 messages means you’ll rarely see this ceiling.