Skip to main content

POST /v1/bots/:id/chat

The Chat API sends a message to a bot and receives a response. Sessions are maintained via the X-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:
Streaming response (SSE format):

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.
Good session IDs:
  • Your database user ID: usr_a4f9b2c1
  • A UUID you generate per user: 550e8400-e29b-41d4-a716-446655440000
Bad session IDs:
  • A shared constant: "default"
  • IP address (multiple users share IPs)
  • Timestamp (resets each request)

Memory and context in chat

The Chat API automatically:
  1. Loads conversation history for the given session
  2. Injects persistent memory for this user
  3. Merges the context object you pass
  4. Sends everything to the model
You can override or extend what the agent knows by passing context:

Error handling

Next reads

Execute API

Deploy API

API Overview