Chat API
Send a message to a chatbot and stream the reply.
POST
/api/v1/public/chatBearer API keySend a turn to a chatbot and stream the reply as Server-Sent Events.
This is the same pipeline the widget and the playground use: knowledge is retrieved, the model streams a reply, and the conversation and its token usage are recorded against your workspace on the api channel.
Request
Request body
{
"chatbotId": "b3f1c0de-0000-4000-8000-000000000000",
"messages": [
{ "role": "user", "content": "Do you ship to the EU?" }
]
}Send the whole visible transcript on each turn, not just the newest message: the platform stores what it receives and passes the history to the model. Only the latest user message is recorded as a new message.
Response
200 OK with Content-Type: text/event-stream. Each line is a data: frame holding one JSON event. The stream always ends with a done event.
Stream
data: {"type":"tool-result","id":"conversation","result":{"conversationId":"…"}}
data: {"type":"start","id":"gen_…","model":"…"}
data: {"type":"sources","sources":[{"id":"…","title":"Shipping policy","snippet":"…"}]}
data: {"type":"text-delta","delta":"Yes — EU orders "}
data: {"type":"text-delta","delta":"ship in 2–4 days."}
data: {"type":"usage","usage":{"inputTokens":412,"outputTokens":38}}
data: {"type":"done","finishReason":"stop"}Event types
Cancelling
Abort the HTTP request to stop generation. The server notices the disconnect, stops the model, and records the conversation up to that point.
Failure modes
See errors for the envelope, and examples for working clients.