v1

latestOpenAPI 3.0.12026-07-226992320.0 KB
Chats

End Chat

Ends an in_progress chat session by chatId, marking it as completed. No further messages can be submitted after a session is ended. Returns the final session record.

patch/v1/chats/{chatId}/end-session

Path parameters

chatIdstring required

Unique identifier of the chat session to end.

Response

OK

chatIdstring

Unique identity for a chat

createdAtstring date-time

The timestamp when the call record was created.

statusstring

Status of chat

transcriptstring

transcript of the conversation in chat

dynamicVariablesJsonNode

Dynamic key-value pairs that were passed to the agent at call start for personalisation. Keys correspond to variable names defined in the agent's configuration (e.g., 'customer_name', 'account_id'). Null or empty if no dynamic variables were provided when the call was created.

Example response

{
  "chatId": "chat-d17T6uReChpyfFeP",
  "agent": {
    "name": "New AI Agent",
    "agentId": "agent_D5D0p7TUs66TTAEAx",
    "status": "Live"
  },
  "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?"
      ]
    }
  ],
  "messages": [
    {
      "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?"
      ]
    }
  ],
  "dynamicVariables": {
    "customer_name": "Michael",
    "account_id": "ACC-001"
  }
}