Skip to main content
POST

Authorizations

Authorization
string
header
required

A project API key, created in the dashboard.

Headers

Idempotency-Key
string

A unique key that makes the request safe to retry, such as a V4 UUID. 1 to 255 printable ASCII characters.

Required string length: 1 - 255

Body

application/json
agent_id
string
required

ID of the AI agent or chatbot.

Maximum string length: 64
external_user_id
string | null

Your own ID for the user, such as their ID in your system. Can't contain control characters. Pass the same external_user_id in each of a person's conversations with an agent, and Chatling treats them as one user, with the same user_id. Blocking them, their contact, and per-user message limits then apply across those conversations. Each agent has its own users, so the same external_user_id with another agent is a different user. Without it, each conversation is a new user.

Required string length: 1 - 191
contact_id
string | null

ID of one of the agent's contacts to link to the conversation. The contact itself isn't changed. To change it, use Update a contact.

Maximum string length: 64
locale
string | null

The user's locale, such as en-US.

Maximum string length: 85
variables
object | null

AI agents only.

Values for the agent's custom variables, keyed by variable ID from List variables. System variables can't be set, and contact fields are changed with Update a contact. null keeps the default.

Example:
message
string | null

A first user message, answered as in Send a user message.

Maximum string length: 20000
ai
object

For chatbots only.

The AI settings for a chatbot's reply to message. Required with message, and only allowed with it.

Response

The new conversation, its first messages, and any reply error.

object
any
required
id
string
required
Example:

"5f0c1c2e-6c1d-4a8f-9a59-0d4c4f1b2a10"

agent
object
required

The agent this belongs to.

channel
enum<string>
required

Share links count as web. playground is a test from an AI agent's playground or a chatbot's builder preview.

Available options:
web,
api,
whatsapp,
instagram,
messenger,
telegram,
playground
user_id
string | null
required

Identifies the person chatting. It's the same in all their conversations with the agent, including for anonymous widget users who aren't contacts. On the web, it's the widget's ID for the user's browser. Through the API, it's derived from external_user_id, or new for each conversation without one. On WhatsApp, it's the user's phone number. On Instagram and Messenger, it's the user's ID for the account or page, and on Telegram, the chat ID. null for some older conversations.

Example:

"0b6f3c1e-8d2a-4f5b-9c7e-1a2b3c4d5e6f"

external_user_id
string | null
required

The external_user_id the conversation was started with through the API, if any.

status
enum<string>
required
Available options:
open,
resolved,
closed
mode
enum<string>
required

The agent only replies in ai mode. In live mode, the team replies. pending_handoff means the conversation is waiting for a team member to take over.

Available options:
ai,
live,
pending_handoff
ended_at
string<date-time> | null
required

Time at which the user's session ended. Ended conversations can't receive user messages.

read
boolean
required

Whether the team has read the latest user message. Read status is shared by the team.

important
boolean
required
priority
enum<string> | null
required
Available options:
low,
medium,
high,
urgent,
null
labels
object[]
required
topics
object[]
required

Always [] for chatbot conversations.

sentiment
enum<string> | null
required

null until the conversation is analysed, and always for chatbot conversations.

Available options:
positive,
neutral,
negative,
unknown,
null
assignee
object | null
required

The assigned team member.

team
object | null
required

The assigned team.

contact
object | null
required

The contact fields shown in the dashboard. zip is the postal code.

variables
object[]
required

The AI agent's custom variables. System variables aren't included. Always [] for chatbot conversations.

locale
string | null
required
country
string | null
required

The user's country as an ISO 3166-1 alpha-2 code, if known.

reply_window
object | null
required

null on channels without a reply window: web, API, and Telegram. On WhatsApp, Instagram, and Messenger, both times are null until the user writes.

created_at
string<date-time> | null
required
last_message_at
string<date-time> | null
required
messages
object[]
required

The first user message and the replies to it, or [] without message.

reply_error
object | null
required

Set if the user message was saved but the agent couldn't reply. No AI credits are used. Retrying with the same Idempotency-Key returns this response without saving the message again.