---
title: "Start or end live chat"
method: POST
path: "/livechat-state"
tags: ["Chatbot Operations"]
---

# Start or end live chat

`POST /livechat-state`

## Request

- Base URL: `https://api.chat-data.com/api/v2`
- URL: `https://api.chat-data.com/api/v2/livechat-state`
- Auth: HTTP bearer

Toggle or set the state of a live chat session for a specific conversation. Your plan must include live chat, and live chat must be enabled in the chatbot's settings.

## Request body

- object
  - `chatbotId` string, required: The unique identifier of the chatbot.
  - `conversationId` string, required: The unique identifier of the conversation.
  - `end` boolean: If provided, `true` ends the live chat session and `false` reopens it. If omitted, the current state is toggled.

## Response `200`

Successful response.

- object
  - `status` 'success', required
  - `liveChatEnded` boolean, required: Whether the live chat session has ended after this request.

## Other responses

- `400`: The state could not be changed. For example: `chatbotId` or `conversationId` is missing, the plan does not include live chat, live chat is not enabled for the chatbot, or the conversation does not exist.
- `401`: Authentication failed: the `Authorization` header is missing or not in the `Bearer <key>` format, the API key does not exist, its workspace is unavailable or has no owner, or the workspace's plan does not include API access. `message` says which.
- `403`: The API key cannot access the requested chatbot. A chatbot-scoped key used with another chatbot's ID gets `Access denied to this chatbot`. A workspace key gets `Chatbot <id> was not found in this API key's workspace. It may have been deleted or moved to another workspace.` when the chatbot does not exist or belongs to another workspace.
- `429`: The workspace sent more than 600 API requests in the last minute. Wait the number of seconds given in the `Retry-After` header (and in `message`) before retrying.

---

[API](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide.md) · [All operations](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide/llms.txt) · [OpenAPI document](https://skmtc.dev/chat-data/apis/chat-data-api-schema-guide/revisions/72871007f7f0?raw)
