---
title: "Remove a BotInstance from one chat (v2)"
method: POST
path: "/v2/agents/{idOrAddress}/bot-instances/{botInstanceId}/leave-chat"
tags: ["Agents"]
---

# Remove a BotInstance from one chat (v2)

`POST /v2/agents/{idOrAddress}/bot-instances/{botInstanceId}/leave-chat`

## Request

- Base URL: `https://api.chat.ethora.com`
- URL: `https://api.chat.ethora.com/v2/agents/{idOrAddress}/bot-instances/{botInstanceId}/leave-chat`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

Takes the bot out of one room without stopping it or deleting the
BotInstance: the AI service leaves the room, the bot's room
affiliation is removed so it does not rejoin on reconnect, and it is
dropped from the room's member list.

The AI service step is best-effort: when it fails the rest still runs
and `aiServiceOk: false` comes back with the reason.

Owner only. Supports `User JWT` and `B2B Server JWT`.

## Path parameters

- `idOrAddress` string, required
- `botInstanceId` string, required

## Request body

- object
  - `chatJid` string, required: Full room JID, `<appId>_<chatId>@conference.<xmpp host>`.

## Response `200`

```
{
  ok: true,
  aiServiceOk: boolean,
  aiServiceError: string|null,
  botInstance: { id: string, xmppUsername: string, joinedRooms: string[], status: 'on'|'off' }
}
```

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: ``` { error: 'Forbidden', code: 'FORBIDDEN' } ```
- `404`: `AGENT_NOT_FOUND`, or `BOT_INSTANCE_NOT_FOUND` (no such BotInstance for this agent).
- `422`: ``` { error: string, code: 'VALIDATION_ERROR' } ```
- `500`: Internal Server Error

---

[API](https://skmtc.dev/ethora/apis/platform-api.md) · [All operations](https://skmtc.dev/ethora/apis/platform-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ethora/apis/platform-api/revisions/01b6e64378ee?raw)
