Chat
7 endpoints under /v1/chat.
List Chats
/v1/chatList the caller's chats within the current organization, newest first.
Org-scoped, so no X-Workspace-ID header is needed and org-spanning
API keys work.
Query parameters
limitintegeroptionaloffsetintegeroptional
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Create Chat
/v1/chatCreate a new chat. Org-scoped (visible across workspace switches).
Headers
X-Organization-IDstringoptional
Request body
titlestringoptional
Failures return the error envelope; branch on error_code.
Get Chat
/v1/chat/{chat_id}Fetch a chat plus its message history.
History is the persisted messages rows only. In-flight events
(deltas, tool calls) come from the streaming endpoint; the persisted
assistant message holds the final text once the run terminates.
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Delete Chat
/v1/chat/{chat_id}Delete a chat. The cascade clears its messages.
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Get Chat Diagnostics
/v1/chat/{chat_id}/diagnosticsReport whether a chat's latest run succeeded semantically, as typed deviations.
Reads persisted messages only (no stream) and inspects the latest
assistant message's message_metadata (status, steps,
tool_calls, cost_usd, duration_ms). Org-scoped; free read.
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Send Message Stream
/v1/chat/{chat_id}/messagesSend a message and receive a streaming SSE response.
Event types (all carry id, chat_id, created_at):
message.thinking — typing indicator before each LLM call
tool.call_started — a tool call begins
tool.call_completed — a tool call ends
message.delta — token-shaped streaming text
message.content_block — a complete content block (text or block)
message.completed — terminal frame; status ∈ {success, error,
cancelled, timeout, cost_limit, max_steps}
Consume until message.completed. UI-only events (panel toggles,
navigation suggestions) are filtered out.
Cost: agent_message reserves credits at request entry; the worker
commits on success and refunds on failure or cancellation.
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
contentstringrequiredfeaturesstring[]optionalmax_stepsintegeroptionalturn_idstringoptional
Failures return the error envelope; branch on error_code.
Send Message Ask
/v1/chat/{chat_id}/messages/askSend a message and block until the agent terminates.
Drains the stream internally and returns the persisted assistant
message once the run reaches message.completed. Prefer the
streaming route for long multi-step runs.
The response carries:
* user_message — the persisted user row.
* assistant_message — the persisted assistant row, or None if the
run ended without one.
* terminal — status from the stream's
message.completed.
* error — error string when terminal is "error" or
"timeout".
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptionalX-Workspace-IDstringoptional
Request body
contentstringrequiredfeaturesstring[]optionalmax_stepsintegeroptionalturn_idstringoptional
Failures return the error envelope; branch on error_code.