Skip to main content
Send a message and get the agent’s reply. The agent is identified by your access token, and the conversation thread is created automatically on the first message — there is no separate “create thread” call. Three ways to receive the reply:
TransportEndpointBest for
RESTPOST /messaging/v1/messagesBackends; one request, one complete reply
Server-sent eventsPOST /messaging/v1/messages/streamLive typing UIs over plain HTTP
WebSocketwss .../messaging/v1/sessionBidirectional chat UIs — see WebSocket

Send a message

cURL

POST /messaging/v1/messages

Request body

text
string
required
The message to send to the agent.
user_id
string
required
Your identifier for the end user. New threads are attributed to this user.
thread_id
string
Continue an existing thread. Omit it to start a new one — the created thread’s id is returned in the response.
image_url
string
Signed image URL for vision input.
agent_variables
object
Per-message values for the agent’s configured context variables.

Response

thread_id
string
The thread the message landed on — newly created when the request omitted thread_id. Pass it back to continue the conversation.
message
object
The agent’s reply: id (the interaction id — used for reruns and traces), text, rendered cards, followup_suggestions, and token counts.

Stream the reply (SSE)

POST /messaging/v1/messages/stream takes the same request body and streams the reply token-by-token over server-sent events.
cURL
Events are JSON objects discriminated on type:
typeWhenPayload
threadFirst event of every streamdata.thread_id — the resolved thread (you can’t read headers mid-stream)
eventWhile the agent worksToken deltas carry the text under data.text
messageTurn completeThe full agent reply — same message object as the REST response
errorSomething failed mid-turndata.message and, when available, a status code
The stream ends with a standalone data: [DONE] terminator.
Example stream

Resuming a dropped stream

event and message frames carry a monotonic seq. If the connection drops, reconnect with the standard Last-Event-ID header set to the last seq you saw — missed events replay without running the turn again:

Rerun an interaction

Regenerate a previous interaction — with the original or edited text — against the agent’s live version. The rerun happens on a new thread branched from the original, so the source conversation is untouched.
cURL

POST /messaging/v1/threads/{threadId}/rerun

Request body

interaction_id
string
required
The interaction to regenerate — the message.id from a previous response.
text
string
required
The message to replay: the original text, or an edited variant.
user_id
string
End user to attribute the rerun to. Omitted, the thread’s original user is kept.
image_url
string
Signed image URL on the replayed message.
version_id
string
Pin the rerun to a specific agent version instead of the live one.
version_tag
string
Pin to a specific version tag (e.g. v3.2).

Response

Same shape as send: thread_id is the new thread the rerun created, and message is the regenerated reply.