The chat API is included on the paid plans: Adapt, Evolve and Apex. On the free Origin plan, these endpoints return
403 with the code feature_disabled; upgrade under Billing in Darwin to use it.Before you start
- An API key with the
chat:writescope, used from your server. Never call the chat API from a browser or mobile app with a secret key. - The chat switched on for the workspace (Agent Studio, or
PATCH /v1/agentwith{"live": true}). If it is off, messages return409conflict.
How it works
- Create a session for each conversation. One session is one conversation in Darwin.
- Send each visitor message to the session. Darwin adds it to the transcript it keeps, runs the agent and answers with its reply and any
actions. - Show the reply in your interface, and act on what the agent did: show a booking link, or tell your team a person was asked for.
Create a session
The
201 response is the session:
conversation is the id to use with GET /v1/conversations/{id}.
Send a message
text is the person’s message, 1 to 4,000 characters. The reply:
Actions
Stream the reply
Send"stream": true to receive the reply as it is written, as server-sent events (Content-Type: text/event-stream). The stream is the Vercel AI SDK UI message stream, version 1: each event is a data: line with a JSON chunk, and the stream ends with data: [DONE]. Chunks with "type": "text-delta" carry the next piece of text in delta.
actions summary; tool calls arrive as their own chunks. If you need the actions, use the JSON reply, or read the session afterwards.
Read a session
GET /v1/chat/sessions/{id} returns the session with its whole transcript, as in the create response, and a status:
Monthly allowance
Each workspace can start a number of chat API sessions each calendar month. Messages within a session are not counted.
When the allowance is used, creating a session returns
429 quota_exceeded, with Retry-After set to the start of the next month. Sessions already open keep working. Meetings booked through the chat API count toward your plan’s bookings like any other meeting. See Plans.
Each message is also a heavy request for per-minute rate limits: 10 a minute per key on Adapt, 30 on Evolve and 60 on Apex.
Errors
See Errors for every code.