Skip to content

Send a chat message

POST
/api/v1/chat
curl --request POST \
--url http://localhost:11044/api/v1/chat \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "message": "example" }'

Sends a user message to the assistant. The response is delivered via the SSE stream (GET /stream), not in the POST response body. An SSE stream must be open before sending messages.

The user’s turn: message is echoed to every stream the caller has open and then sent to the assistant. The answer is not in the response; it arrives on the SSE stream, which must already be open or the request is refused with 409. A message sent while a turn is still running is answered by a side session rather than queued behind it

Media typeapplication/json

A user message for the open chat session; the body of POST /chat. The reply arrives on the SSE stream

object
message
required

The user’s message text, sent to the assistant as their turn

string

Example generated

{
"message": "example"
}

Message accepted

Media type*/*
object
key
additional properties
string

No active SSE stream — open /stream first

Media type*/*

A refusal from the chat surface: the word error and the reason, written to be shown

object
message
required

What was refused and why, such as no open stream, no active session, or an unknown command

string
status
required

Always error. A client may branch on it rather than on the status code

string

Example

error