| Transport | Endpoint | Best for |
|---|---|---|
| REST | POST /messaging/v1/messages | Backends; one request, one complete reply |
| Server-sent events | POST /messaging/v1/messages/stream | Live typing UIs over plain HTTP |
| WebSocket | wss .../messaging/v1/session | Bidirectional chat UIs — see WebSocket |
Send a message
cURL
POST /messaging/v1/messages
Request body
The message to send to the agent.
Your identifier for the end user. New threads are attributed to this user.
Continue an existing thread. Omit it to start a new one — the created
thread’s id is returned in the response.
Signed image URL for vision input.
Per-message values for the agent’s configured context variables.
Response
The thread the message landed on — newly created when the request omitted
thread_id. Pass it back to continue the conversation.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
type:
type | When | Payload |
|---|---|---|
thread | First event of every stream | data.thread_id — the resolved thread (you can’t read headers mid-stream) |
event | While the agent works | Token deltas carry the text under data.text |
message | Turn complete | The full agent reply — same message object as the REST response |
error | Something failed mid-turn | data.message and, when available, a status code |
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
The interaction to regenerate — the
message.id from a previous response.The message to replay: the original text, or an edited variant.
End user to attribute the rerun to. Omitted, the thread’s original user is
kept.
Signed image URL on the replayed message.
Pin the rerun to a specific agent version instead of the live one.
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.