Chat

Stream a chat message

POST
/api/v1/chat/stream

Send a message to an agent and receive the turn as server-sent events: data: lines of JSON, session first and done last, with a : ping comment line after 10 seconds without an event — skip lines that start with :. The request body is the same as send. The event types are listed in the Chat API; a stream that ends with error has no response.

apiKey
headerAuthorizationBearer <token>

An API key, sk-syn- and 32 characters. On SynapseOrch Cloud an owner or admin makes it under Settings → Developer; on a self-hosted install, under Settings → API Keys.

application/json
  1. body

A message for an agent.

message*string

The message. @[path] vault mentions are read in, as in Chat.

Length1 <= length <= 100000
agent?|

The agent's id, or its exact name in any case. Omitted, the workspace's first agent answers; an unknown agent is a 404.

session_id?|

Carries a conversation on: send the session_id an earlier turn returned. Omitted, a new conversation starts. SynapseOrch Cloud makes every session id itself, so an id it did not make is a 404, and one that belongs to another agent is a 409.

images?array<string>

Self-hosted only: base64 data-URI images for a model that can see them — PNG, JPEG, GIF or WebP, at most 5, each up to 5 MB and 20 MB in all. SynapseOrch Cloud refuses images with a 422.

Response Body

A stream of server-sent events.

response?stringtext/event-stream
curl -X POST "https://api.synapseorch.com/api/v1/chat/stream" \  -H "Authorization: Bearer sk-syn-..." \  -H "Content-Type: application/json" \  -d '{    "message": "Research quantum computing trends",    "agent": "Research Agent",    "session_id": "stream-test"  }'
data: {"type": "session", "session_id": "stream-test", "agent_id": "agent_1726412345678", "agent_name": "Research Agent"}data: {"type": "thinking", "message": "Analyzing your request..."}data: {"type": "tool_execution", "tool_name": "scrape_url", "args": {"url": "https://arxiv.org/..."}}data: {"type": "tool_result", "tool_name": "scrape_url", "preview": "Quantum computing in 2024..."}data: {"type": "response", "content": "Here are the key trends in quantum computing...", "intent": "chat", "session_id": "stream-test"}data: {"type": "done"}