Send a chat message
const url = 'http://localhost:11044/api/v1/chat';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"message":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”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
A user message for the open chat session; the body of POST /chat. The reply arrives on the SSE stream
object
The user’s message text, sent to the assistant as their turn
Example generated
{ "message": "example"}Responses
Section titled “Responses”Message accepted
object
No active SSE stream — open /stream first
A refusal from the chat surface: the word error and the reason, written to be shown
object
What was refused and why, such as no open stream, no active session, or an unknown command
Always error. A client may branch on it rather than on the status code
Example
error
