> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trellis.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete Message

> Delete a message and all subsequent messages in the chat

Permanently delete a message and every message that follows it in the conversation. This action cannot be undone.

<Warning>
  Deletion is cascading. The target message **and all messages after it** are removed to keep the conversation context consistent. Use this carefully — there is no way to recover deleted messages.
</Warning>

<ParamField header="Authorization" type="string" required>
  Bearer token obtained from the authenticate endpoint.
</ParamField>

<ParamField path="chat_id" type="string" required>
  Unique identifier of the chat containing the message.
</ParamField>

<ParamField path="message_id" type="string" required>
  Unique identifier of the message to delete.
</ParamField>

## Response

Returns `204 No Content` on success — no response body.

<RequestExample>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X DELETE "https://api.trellis.sh/v1/chats/chat_abc123/messages/msg_xyz789" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import requests

  response = requests.delete(
      "https://api.trellis.sh/v1/chats/chat_abc123/messages/msg_xyz789",
      headers={"Authorization": "Bearer YOUR_TOKEN"}
  )
  # 204 No Content on success
  assert response.status_code == 204
  ```

  ```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch(
    "https://api.trellis.sh/v1/chats/chat_abc123/messages/msg_xyz789",
    {
      method: "DELETE",
      headers: { Authorization: "Bearer YOUR_TOKEN" },
    }
  );
  // 204 No Content on success
  ```
</RequestExample>

<ResponseExample>
  ```text 204 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  (No Content)
  ```

  ```json 404 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Message not found"
  }
  ```

  ```json 403 theme={"theme":{"light":"github-light","dark":"github-dark"}}
  {
    "detail": "Access denied"
  }
  ```
</ResponseExample>
