Skip to main content
The chat API puts your Darwin agent behind your own interface. The same agent that answers on your website, with the same knowledge, tools, booking flow and rules, answers messages your code sends. Each session is stored as a Darwin conversation.
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:write scope, 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/agent with {"live": true}). If it is off, messages return 409 conflict.

How it works

  1. Create a session for each conversation. One session is one conversation in Darwin.
  2. 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.
  3. 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.
Darwin holds the transcript. You send only the visitor’s newest message; you never send, and can never change, what the agent said.

Create a session

All fields are optional. 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:
A turn can take several seconds while the agent searches and writes. Allow up to 60 seconds before timing out.

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.
A streamed reply does not include the 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.