---
title: "Bulk-delete the message history of a chat from the MAM archive"
method: DELETE
path: "/v2/apps/{appId}/chats/{chatId}/messages"
tags: ["Chats"]
---

# Bulk-delete the message history of a chat from the MAM archive

`DELETE /v2/apps/{appId}/chats/{chatId}/messages`

## Request

- Base URL: `https://api.chat.ethora.com`
- URL: `https://api.chat.ethora.com/v2/apps/{appId}/chats/{chatId}/messages`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer

**Auth**: Tenant Actor

Removes every `mod_mam` row attached to a single chat room. Generic —
same scope as the GET sibling: works for any chat type. The chat row
itself is **not** deleted (callers that want the conversation gone
entirely also call `DELETE /v2/apps/{appId}/chats` with the chat's
`name`). Used by the admin AI Widget Conversations cleanup flow but
generally useful for any "clear transcript" operation.

Idempotent — calling on an already-empty chat returns
`{ deletedCount: 0 }`.

Installs without the `MAM_MYSQL_*` env vars get `mamUnavailable: true`
and a no-op response so the UI can render a "history not deletable on
this deployment" hint rather than fail.

## Path parameters

- `appId` string, required
- `chatId` string, required

## Response `200`

```
{
  deletedCount: number,
  chat: { _id: string, name: string, type: string },
  mamUnavailable: boolean
}
```

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Chat not found, or not in the requested app. ``` { error: string, code: 'CHAT_NOT_FOUND' } ```
- `422`: Validation error (missing chatId, etc.). ``` { error: string, code: 'VALIDATION_ERROR' } ```
- `500`: Internal Server Error
- `502`: MySQL delete failed (network / auth / etc.). ``` { error: string, code: 'MAM_DELETE_FAILED' } ```

---

[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)
