Chat

Sessions

Use session_id to maintain conversation context across multiple requests. The chatbot remembers prior messages within the same session, enabling natural multi-turn conversations.

How it works

Pass the same session_id string on every request that belongs to the same conversation. The backend looks up prior messages stored against that (session_id, chatbot) pair and includes them as context for the model.

Choosing session IDs

Session IDs can be any string — use whatever uniquely identifies the user/conversation in your own system. Common choices:

  • Your application’s internal user id.
  • A UUID you generate per chat session and persist alongside your user record.
  • A composite like user-{id}-session-{n} if you want one user to have multiple parallel conversations.

We don’t validate the format. Two requests with the same session_id + same API key resolve to the same conversation.

Multi-turn example

Two-turn conversation
# First message
curl -X POST https://services.chatmount.co/v1/chat \
  -H "Authorization: Bearer cm_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "What services do you offer?",
    "session_id": "user-123-session-abc"
  }'

# Follow-up (same session_id — bot remembers context)
curl -X POST https://services.chatmount.co/v1/chat \
  -H "Authorization: Bearer cm_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Tell me more about the first one",
    "session_id": "user-123-session-abc"
  }'

Related