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 every plan, Free too, with 2,500 sessions per workspace a month. Legacy plans keep their own allowance.

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 (Settings → Agent → Status, 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 2,500 chat API sessions each calendar month, on every plan. On Agency, each client workspace has its own 2,500. Messages within a session are not counted. Legacy plans keep their allowance: Origin none, Adapt 500, Evolve 2,500 and Apex 10,000. 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 and requests sent through the chat API use credits like any other. See Plans and credits. Each message is also a heavy request for per-minute rate limits: 30 a minute per key on every plan.

Errors

See Errors for every code.