Create Chat

Beta

Creates a new chat with optional SMS delivery via transport field. Requires at least one of: assistantId/assistant, sessionId, or previousChatId. Note: sessionId and previousChatId are mutually exclusive. Transport field enables SMS delivery with two modes: (1) New conversation - provide transport.phoneNumberId and transport.customer to create a new session, (2) Existing conversation - provide sessionId to use existing session data. Cannot specify both sessionId and transport fields together. The transport.useLLMGeneratedMessageForOutbound flag controls whether input is processed by LLM (true, default) or forwarded directly as SMS (false).

Headers

AuthorizationstringRequired

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
inputstring or list of objectsRequired
This is the input text for the chat. Can be a string or an array of chat messages. This field is REQUIRED for chat creation.
assistantIdstringOptional

This is the assistant that will be used for the chat. To use an existing assistant, use assistantId instead.

assistantobjectOptional

This is the assistant that will be used for the chat. To use an existing assistant, use assistantId instead.

assistantOverridesobjectOptional

These are the variable values that will be used to replace template variables in the assistant messages. Only variable substitution is supported in chat contexts - other assistant properties cannot be overridden.

squadIdstringOptional

This is the squad that will be used for the chat. To use a transient squad, use squad instead.

squadobjectOptional

This is the squad that will be used for the chat. To use an existing squad, use squadId instead.

namestringOptional<=40 characters
This is the name of the chat. This is just for your own reference.
sessionIdstringOptional
This is the ID of the session that will be used for the chat. Mutually exclusive with previousChatId.
streambooleanOptionalDefaults to false
This is a flag that determines whether the response should be streamed. When true, the response will be sent as chunks of text.
previousChatIdstringOptional
This is the ID of the chat that will be used as context for the new chat. The messages from the previous chat will be used as context. Mutually exclusive with sessionId.
transportobjectOptional

This is used to send the chat through a transport like SMS. If transport.phoneNumberId and transport.customer are provided, creates a new session. If sessionId is provided without transport fields, uses existing session data. Cannot specify both sessionId and transport fields (phoneNumberId/customer) together.

Response

Chat response - either non-streaming chat or streaming
Chatobject
OR
CreateChatStreamResponseobject