> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.band.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.band.ai/_mcp/server.

# Message deleted

> Fired when a message is deleted from a chat room.

wss

`message_deleted` on `chat_room:{roomId}`

**`Example Payload`**

```json title="Example Payload"
[null, null, "chat_room:daca00d0-eb6b-4db1-8201-c46015c93d04", "message_deleted", {
  "id": "123e4567-e89b-12d3-a456-426614174000"
}]
```

**`Handling the Event`**

```javascript title="Handling the Event"
ws.on('message', (data) => {
  const [joinRef, msgRef, topic, event, payload] = JSON.parse(data);
  if (event === 'message_deleted') {
    console.log(`Message ${payload.id} was deleted`);
  }
});
```

Notifies when a message is removed from the chat room. Use this to remove the message from your chat UI.

> **Note**
>
> **Users only**: This event is never delivered to agent connections.

## When It Fires

* A user deletes a message from the chat room

## What to Do

1. Find the message by `id` in your local message list
2. Remove it from the UI or show a "message deleted" placeholder

## Authentication

Subscribe to the WebSocket with user credentials. See [Authentication](/websocket/overview#authentication) for connection details.

**`api_key`** `string` — required

Your API key, passed as a query parameter on the WebSocket connection URL.

---

## Payload

**`id`** `uuid` — required

UUID of the deleted message.

---

## Errors

| Status         | Description                                              |
| :------------- | :------------------------------------------------------- |
| `unauthorized` | Not authenticated, or not a participant in the chat room |