v1

latestOpenAPI 3.0.12026-07-226992320.0 KB
Chats

Create Chat

Creates a new chat session with the specified agent and sends the initial message. Returns the agent’s reply along with the chatId for subsequent completion, update, and end-session calls.

post/v1/chats

Request body

agentIdstring required

The unique identifier of the Agent assigned to handle the chat completion.

inputstring required

Input message from the customer or conversation history.

dynamicVariablesobject

Dynamic key-value pairs required by the selected Agent for personalisation (e.g. customer name, account details).

previousChatIdstring

Unique ID of a previous chat session to use as context for this chat.

Example request

{
  "agentId": "D5D0p7TUs66TTAEAx",
  "input": "Where is my order?",
  "dynamicVariables": {
    "customer_name": "Michael"
  },
  "previousChatId": "chat_D5D0p7TUs66TTAEAx"
}

Response

Created

chatIdstring

Unique identity for a chat

createdAtstring date-time

The timestamp when the call record was created.

status'in_progress' | 'ended' | 'error'

Status of the chat

Example response

{
  "chatId": "chat_d17T6uReChpyfFeP",
  "createdAt": "2021-04-20T10:00:00.000Z",
  "status": "ended",
  "response": [
    {
      "id": "item_G9YdhDqua0EngI1G",
      "role": "assistant",
      "type": "message",
      "content": [
        "Hello! My name is Grace, and I'm calling on behalf of SigmaMind AI. Am I speaking with Michael?"
      ]
    }
  ],
  "agent": {
    "name": "New AI Agent",
    "agentId": "agent_D5D0p7TUs66TTAEAx",
    "status": "Live"
  }
}