POST /v1/bots/:id/chat
The Chat API sends a message to a bot and receives a response. Sessions are maintained via theX-Session-ID header — pass the same ID across multiple calls to preserve conversation context and memory.
This is the primary endpoint for embedding Bothive agents inside your product.
Request
Headers
Request body
Response
Response fields
Streaming (SSE)
For lower time-to-first-token and better UX, enable streaming:JavaScript / TypeScript example
Session management
Always pass a stable, unique
X-Session-ID for each end user. This is how Bothive scopes memory and conversation history. Using the same session ID for multiple users will mix their memories.- Your database user ID:
usr_a4f9b2c1 - A UUID you generate per user:
550e8400-e29b-41d4-a716-446655440000
- A shared constant:
"default" - IP address (multiple users share IPs)
- Timestamp (resets each request)
Memory and context in chat
The Chat API automatically:- Loads conversation history for the given session
- Injects persistent memory for this user
- Merges the
contextobject you pass - Sends everything to the model
context: