API reference

Chat

7 endpoints under /v1/chat.

List the caller's chats within the current organization, newest first.

get/v1/chat

Org-scoped, so no X-Workspace-ID header is needed and org-spanning API keys work.

Requiresagent:read

Query parameters

  • limitintegeroptional
  • offsetintegeroptional

Headers

  • X-Organization-IDstringoptional

Failures return the error envelope; branch on error_code.

Request
Response

Create a new chat.

post/v1/chat

Org-scoped (visible across workspace switches).

Requiresagent:invoke

Headers

  • X-Organization-IDstringoptional

Request body

  • titlestringoptional

Failures return the error envelope; branch on error_code.

Request
Response

Fetch a chat plus its message history.

get/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.

Request
Response

Delete a chat.

delete/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.

Request
Response

Report whether a chat's latest run succeeded semantically, as typed deviations.

get/v1/chat/{chat_id}/diagnostics

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.

Requiresagent:read

Path parameters

  • chat_idstring (uuid)required

Headers

  • X-Organization-IDstringoptional

Failures return the error envelope; branch on error_code.

Request
Response

Send a message and receive a streaming SSE response.

post/v1/chat/{chat_id}/messages

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.

Requiresagent:invoke

Path parameters

  • chat_idstring (uuid)required

Headers

  • X-Organization-IDstringoptional
  • X-Workspace-IDstringoptional

Request body

  • contentstringrequired
  • featuresstring[]optional
  • max_stepsintegeroptional
  • turn_idstringoptional

Failures return the error envelope; branch on error_code.

Request
Response

Send a message and block until the agent terminates.

post/v1/chat/{chat_id}/messages/ask

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".

Requiresagent:invoke

Path parameters

  • chat_idstring (uuid)required

Headers

  • X-Organization-IDstringoptional
  • X-Workspace-IDstringoptional

Request body

  • contentstringrequired
  • featuresstring[]optional
  • max_stepsintegeroptional
  • turn_idstringoptional

Failures return the error envelope; branch on error_code.

Request
Response