Endpoints on this page are [User+Key]. API-key chat operations require
query:rag. Use external_subject_id to isolate API-served end users; signed-in user requests do not accept that field.Endpoints
List chats
GET /chats
string
required
Tenant whose chats to list.
string
Restrict results to one knowledge base. Required when the API key itself is knowledge-base-restricted.
string
Restrict an API-key request to one external end user’s chats.
boolean
Filter query chats from regular chats.
Create a chat
POST /chats
Creates an empty chat or, when message is present, creates the chat and processes its first turn.
string
required
Client-generated UUID for the chat.
string
required
Tenant that owns the chat.
string
required
Knowledge base that grounds the conversation.
string
required
Supported model identifier. Use
/chats/models to discover choices.string
Optional title. Long titles are truncated to 255 characters.
string
Optional initial user message.
string
quick or deep. Defaults to deep.boolean
Enable web search for the initial turn.
string
External end-user identifier for API-key-authenticated ownership, memory, and connected apps.
string[]
Connected apps available to the turn.
string[]
Skills to load for this turn.
string[]
Agents available for delegation on this turn.
string[]
Up to 20 artifacts to add as context.
For an externally owned chat, API-key calls to owner-checked routes must pass
external_subject_id in the query string unless the endpoint schema places it in the request body. This includes title or access changes, deletion, todo reads, message listing, stop, message deletion, MCP configuration, and session termination./swagger for their exact shapes.
List supported models
GET /chats/models
Returns supported model IDs and display metadata.
Update a title
PATCH /chats/:id
string
External owner for API-key-authenticated chats.
string
New chat title.
Set access level
PATCH /chats/:id/access
string
Required for an API-key call when the chat has an external owner.
string
required
One of
private, org, or public.Delete a chat
DELETE /chats/:id
Deletes the chat and its conversation data. API-key calls for external subjects should include external_subject_id in the query string.
Get todo state
GET /chats/:id/todo
Pass external_subject_id in the query for an API-key call to an externally owned chat.
Returns the current persistent todo list for the chat, or null when no todo state exists.
List messages
GET /chats/:id/messages
number
Number of messages to return, from 1 to 200.
number
Zero-based pagination offset.
string
External owner for an API-key-authenticated chat.
Send a message
POST /chats/:id/messages
string
required
User message, up to 32,000 characters.
string
required
Supported model identifier.
string
quick or deep. Defaults to deep.boolean
Enable web search for this turn.
string
External owner for API-key authentication. It must resolve to the chat owner.
string[]
Skills to load for this turn.
string[]
Additional delegates for this turn.
string[]
Connected apps available in Deep mode.
string[]
Artifacts to attach as context.
user_message, assistant_message, and usage with token and credit information.
Stream a message
POST /chats/:id/messages/stream
Accepts the same body as the non-streaming endpoint and returns text/event-stream.
SSE events
SSE data contains JSON. Heartbeats can also use the SSE event nameping.
Treat a
final_response with isComplete: true as canonical complete answer content. If your client receives partial events, accumulate their content until completion. Finalize the UI on done and always handle error.
One active stream
Each chat supports one active stream. Starting another stream on the same chat replaces the current one. A client disconnect or explicit stop preserves partial output that has already been generated.Stop a stream
POST /chats/:id/stop
Pass external_subject_id in the query for an API-key call to an externally owned chat.
Returns { "stopped": true } when an active stream was aborted, or false when no stream was active.
Delete one message
DELETE /chats/:id/messages/:messageId
Pass external_subject_id in the query for an API-key call to an externally owned chat.
Deletes a message only when it belongs to the chat in the path.
Configure MCP servers
GET /chats/:id/mcp-servers lists organization servers and annotates which are enabled for the chat.
PATCH /chats/:id/mcp-servers replaces the enabled list:
For either route, pass external_subject_id in the query for an API-key call to an externally owned chat.
Terminate a session
POST /chats/:id/terminate
Ends an agent session while preserving its messages for audit. Later standalone agent-runtime calls using that chat return a conflict. The optional body accepts termination_reason up to 500 characters.
Prompt and follow-up utilities
Improve a prompt
POST /chats/improve-prompt accepts knowledge_base_id, query, and an optional supported category. It returns an improved prompt, analysis, and techniques applied. This operation uses credits.
Generate follow-up questions
POST /chats/follow-up-questions accepts knowledge_base_id and chat_id and returns suggestions based on the conversation. The chat must belong to that knowledge base.
Fast query utilities
Quick grounded answer
POST /chats/fast-query performs one knowledge-base retrieval pass and produces an answer. Its main fields are knowledge_base_id, content, model, optional chat_id, chunk_count (1–50), external_subject_id, websearch_enable, and connector_slugs.
Raw retrieval chunks
POST /chats/fast-raw-query returns grouped retrieval chunks without answer generation. POST /chats/raw-query is a compatibility alias. Prefer fast-raw-query for new integrations.
Next steps
Chat lifecycle
Understand persistence, compaction, stopping, and recovery.
Chat & streaming
Implement an SSE client.
Shared chats
Read shared transcripts safely.
Chat modes
Choose between Quick and Deep mode.