# Delete message

Permanently remove a channel message in your community by its message ID.

- Endpoint: `DELETE https://api.returning.ai/v1/messages/{messageId}`
- Section: Community / Messaging
- Authentication: `Authorization: Bearer <API_KEY>` (Community API key)
- Permission: `deleteMessage` (Shown in the dashboard as "Delete Messages" on community API keys.)
- Retries: After a timeout or 503, check the channel and retry with the same message ID if the message is still present.
- Guide: hand-written
- Verified: live, 2026-11-21
- Last updated: 21 Nov 2026
- Web page: https://docs.returning.ai/api-reference/messaging/delete-message

## When to use this

- Remove a channel message after a moderation decision in your own system.
- Remove an ordinary message your integration posted to a community channel.

**Instead:** Use [Get messages](https://docs.returning.ai/api-reference/messaging/get-messages.md) to find the message ID or read the latest messages in a channel.

## Authentication

- Header: `Authorization: Bearer <API_KEY>`
- Permission: `deleteMessage`

Use a Community API key with `deleteMessage` (Delete Messages). Keep the key on your server.

A missing key returns `401` with `Invalid token`. An invalid key returns `401` with `Invalid API key`. A community key missing Delete Messages permission returns `401` with `Your API key does not have permission to access this action`. The permission error contains only `message`.

## Behaviour

The key can delete ordinary messages from channels in its community, including messages written by other members. A direct message or a message outside the key's community returns `404`. A broadcast or a forum topic's main post in the key's community returns `409`. Send the message ID in the path and leave the request body empty.

## Request

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `messageId` | `string` | Yes | The message's `id` from Get messages. (24 hex characters) |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Authorization` | `string` | Yes | Community API key with `deleteMessage`. (`Bearer <API_KEY>`) |

### Example request

```bash
curl --request DELETE \
  --url https://api.returning.ai/v1/messages/66f000000000000000000a21 \
  --header 'Authorization: Bearer <API_KEY>'
```

## Response

A `200` confirms that the message was removed. Returning.AI also attempts to reverse rewards earned from the message and its reactions. Some of that work runs after the response. If you receive `partial: true`, the message was removed and an associated action failed. Ask support to check the side effects using the returned `messageId`.

### Response fields

| Field | Type | Presence | Description |
| --- | --- | --- | --- |
| `status` | `string` | always | `success` when the message was removed. |
| `message` | `string` | always | Human-readable confirmation. |
| `messageId` | `string` | always | The deleted message ID, in lowercase. (`^[a-fA-F0-9]{24}$`) |
| `partial` | `boolean` | conditional | Present as `true` if the message was deleted and an associated action failed before the response. |

### Example response (200)

```json
{
  "status": "success",
  "message": "Message deleted",
  "messageId": "66f000000000000000000a21"
}
```

## Errors

### Fix the request

| Status | Code | What to do |
| --- | --- | --- |
| 400 | - | Copy the 24-character message `id` from Get messages. |
| 401 | - | Use a valid community API key with Delete Messages permission. A missing key, invalid key and missing permission all return `401`. |

### Fix the data

| Status | Code | What to do |
| --- | --- | --- |
| 404 | - | Check the ID and community. If you already confirmed the original deletion, stop retrying. |

### Retry with backoff

| Status | Code | What to do |
| --- | --- | --- |
| 500 | - | Retry with backoff when authentication is available again. |
| 503 | - | Check whether the message is still visible and retry with the same ID if needed. |

### Do not retry

| Status | Code | What to do |
| --- | --- | --- |
| 409 | - | Use the community's moderation controls for a broadcast or a forum topic's main post. |

**Retries:** A repeat delete returns `404` once the message is gone. After a timeout or `503`, read the channel to check the outcome before trying the same ID again. A `404` on its own can also mean the message is outside your community, so check the ID and channel if you have no earlier confirmation. Retrying a deleted message does not rerun its reward reversals.

## Next step

- [Get messages](https://docs.returning.ai/api-reference/messaging/get-messages.md): `GET /v1/messages`. Read the channel to confirm the message is gone.
