Skip to main content
Sending a message is asynchronous. POST /sessions/\{id}/messages returns 202 Accepted immediately — the agent runs in the background. To get the result, either poll GET /sessions/\{id} (with optional long-polling via wait=true) or include a webhook field in your request to receive a callback when the turn completes. See Webhooks for details.

POST /sessions/{session_id}/messages

Send a message to a session. The agent processes it in the background and the endpoint returns immediately.

Path parameters

session_id
string
required
The session UUID.

Request body

content
string | null
default:"null"
The text content of the message.
role
string
default:"user"
Message role. One of "system", "user", "assistant", or "tool".
user_params
object | null
default:"null"
Arbitrary key-value parameters passed through to the agent on the ChatMessage object. Useful for per-request context such as user identity or feature flags.
webhook
WebhookSpec | null
default:"null"
Webhook configuration to receive the turn result via HTTP callback instead of polling. See Webhooks for the full spec.
MessageRequest inherits from ChatMessage, so additional fields are also accepted: tool_calls, tool_call_id, name, and base64_image.
The minimal request body to send a user message:
{ "content": "hello" }

Response

202 Accepted — returns a MessageResponse and a Location header pointing to the session. Headers: Location: /sessions/\{session_id}
{ "session_id": "550e8400-e29b-41d4-a716-446655440000", "status": "running" }
session_id
string
required
The session UUID.
status
string
required
Always "running" immediately after a message is accepted.

Errors

CodeCondition
404Session not found.
409The session is already processing a message.

GET /sessions/{session_id}/messages

Retrieve the full conversation history managed by the agent for this session.

Path parameters

session_id
string
required
The session UUID.

Response

200 OK — returns a list of ChatMessage objects in chronological order.
[
  { "role": "user", "content": "hello" },
  { "role": "assistant", "content": "hi there" }
]
role
string
required
Message role: "user", "assistant", "system", or "tool".
content
string | null
required
Text content of the message.

Errors

CodeCondition
404Session not found.