Chat
7 endpoints under /v1/chat.
List the caller's chats within the current organization, newest first.
/v1/chatOrg-scoped, so no X-Workspace-ID header is needed and org-spanning API keys work.
Requiresagent:read
Query parameters
limitintegeroptionaloffsetintegeroptional
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Create a new chat.
/v1/chatOrg-scoped (visible across workspace switches).
Requiresagent:invoke
Headers
X-Organization-IDstringoptional
Request body
titlestringoptional
Failures return the error envelope; branch on error_code.
Fetch a chat plus its message history.
/v1/chat/{chat_id}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.
Requiresagent:read
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Delete a chat.
/v1/chat/{chat_id}The cascade clears its messages.
Requiresagent:invoke
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Report whether a chat's latest run succeeded semantically, as typed deviations.
/v1/chat/{chat_id}/diagnosticsReads 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.
Requiresagent:read
Path parameters
chat_idstring (uuid)required
Headers
X-Organization-IDstringoptional
Failures return the error envelope; branch on error_code.
Send a message and receive a streaming SSE response.
/v1/chat/{chat_id}/messagesEvent 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.
Requiresagent:invoke
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 a message and block until the agent terminates.
/v1/chat/{chat_id}/messages/askDrains 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".
Requiresagent:invoke
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.