---
title: "End Chat"
method: PATCH
path: "/v1/chats/{chatId}/end-session"
tags: ["Chats"]
---

# End Chat

`PATCH /v1/chats/{chatId}/end-session`

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.

## Path parameters

- `chatId` string, required

## Response `200`

OK

- ChatResponse
  - `chatId` string — Unique identity for a chat
  - `agent` AgentResponse — Agent assigned to handle all calls in this campaign. Contains the agent's ID, name, and current status. All contacts in the campaign's contact list will be called using this agent.
    - `name` string — The display name of the assigned agent.
    - `agentId` string — The unique identifier of the agent within the system.
    - `status` 'Live' | 'Testing' | 'Disabled' — The current operational status of the agent.
  - `createdAt` string, date-time — The timestamp when the call record was created.
  - `status` string — Status of chat
  - `transcript` string — transcript of the conversation in chat
  - `response` ChatMessage[] — Agent response of the last user message
    - `id` string — Unique identity for a chat message
    - `role` 'user' | 'assistant' — Role of the chat message
    - `type` 'message' — Type of the chat message
    - `content` string[] — Chat message content
  - `messages` ChatMessage[] — Agent response of the last user message
    - `id` string — Unique identity for a chat message
    - `role` 'user' | 'assistant' — Role of the chat message
    - `type` 'message' — Type of the chat message
    - `content` string[] — Chat message content
  - `dynamicVariables` JsonNode — 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.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

---

[API](https://skmtc.net/sigmamind/apis/sigmamind-apis.md) · [All operations](https://skmtc.net/sigmamind/apis/sigmamind-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sigmamind/sigmamind-apis/versions/d00f52b5123f/schema)
