API reference

Chat

7 endpoints under /v1/chat.

List Chats

get/v1/chat

List 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

  • limitintegeroptional
  • offsetintegeroptional

Headers

  • X-Organization-IDstringoptional

Failures return the error envelope; branch on error_code.

Request
Response

Create Chat

post/v1/chat

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

Request
Response

Get Chat

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

Request
Response

Delete Chat

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

Request
Response

Get Chat Diagnostics

get/v1/chat/{chat_id}/diagnostics

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

Request
Response

Send Message Stream

post/v1/chat/{chat_id}/messages

Send 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-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 Message Ask

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

Send 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-IDstringoptional
  • X-Workspace-IDstringoptional

Request body

  • contentstringrequired
  • featuresstring[]optional
  • max_stepsintegeroptional
  • turn_idstringoptional

Failures return the error envelope; branch on error_code.

Request
Response