Skip to main content
POST
/
api
/
v2
/
agents
/
{agentId}
/
chat
Chat with an agent
curl --request POST \
  --url https://www.chatbase.co/api/v2/api/v2/agents/{agentId}/chat \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "message": "Hello, how can you help me?",
  "conversationId": "<string>",
  "stream": true,
  "userId": "<string>"
}
'
"<string>"

Authorizations

Authorization
string
header
required

API key from your account settings

Path Parameters

agentId
string
required

The agent ID

Minimum string length: 1
Example:

"5QHA6VB-DIAbBhxwqxfdi"

Body

application/json
message
string
required

The user message to send to the agent

Minimum string length: 1
Example:

"Hello, how can you help me?"

conversationId
string

Optional conversation ID to continue an existing conversation. If omitted, a new conversation will be started.

stream
boolean
default:true

Whether to stream the response as Server-Sent Events (SSE). Defaults to true.

userId
string

Optional user ID to associate with a new conversation. Only applied when creating a new conversation (no conversationId). Once set, a conversation's userId is immutable — this field is ignored for existing conversations. Must contain only URL-safe characters (letters, digits, hyphens, underscores, dots).

Maximum string length: 128

Response

Successful response

Streaming text response