---
title: "Clear Room History"
slug: "clear-room-history"
updated: 2026-06-01T06:32:04Z
published: 2026-06-01T06:32:04Z
stale: true
---

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

# Clear Room History

Post/api/v1/rooms.cleanHistory

Cleans up a room by removing messages from the provided time range. For details, see the [Prune messages from a room](https://docs.rocket.chat/docs/room-actions#prune-messages-from-a-room) section.

Permission required: `clean-channel-history`

### Changelog

| Version | Description |
| --- | --- |
| 0.64.0 | Added |
| 0.67.0 | Added fields `limit`, `excludePinned`, `filesOnly` and `users` |

Header parametersX-Auth-TokenstringRequired

The `authToken` of the authenticated user.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
X-User-IdstringRequired

The `userId` of the authenticated user.

ExamplerbAXPnMktTFbNpwtJ

Body parameters<select class='api-response-data' aria-label='Media type'><option value='18f9c83f-76f7-42f8-adee-152d4d790fa5'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='8a247092-9dfa-48fd-aa35-72edfab1e50c'>Example</option>
</select>Example

```json
{
  "roomId": "roomId",
  "latest": "2016-12-09T13:42:25.304Z",
  "oldest": "2016-08-30T13:42:25.304Z"
}
```

object  roomIdstring    Required

The room ID.

lateststring    Required

The end of time range of messages.

oldeststring    Required

The start of the time range of messages.

inclusiveboolean    

Whether messages which land on the latest and oldest dates should be included. By default, the value is false.

excludePinnedboolean    

Whether pinned messages should be deleted. By default, the value is false.

filesOnlyboolean    

Whether to only delete files and keep messages intact. By default, the value is false.

users Array of string   

Specific set of users whose content to delete. By default, the value is [], that is, everyone.

string    
limitinteger    

The amount of messages to prune. By default, the value is 0 (all).

ignoreDiscussionboolean    

Determines if messages from discussions should be pruned. By default, the value is true.

ignoreThreadsboolean    

Determines if messages from threads should be pruned. By default, the value is true.

Responses200

OK

<select class='api-response-data' aria-label='Media type'><option value='aba31641-5d55-483e-8e0d-84a75ab1783b'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='d04f1e69-50c1-4b5e-ad01-74252120d039'>Success</option>
</select>Success

```json
{
  "success": true
}
```

object  successboolean    

401

Unauthorized

<select class='api-response-data' aria-label='Media type'><option value='32704e8f-6681-44b1-b432-2fb931004307'>application/json</option>
</select><select class='select-example' aria-label='Media type'><option value='26a25511-2b6a-493e-9f05-4af11585478b'>Authorization Error</option>
</select>Authorization Error

```json
{
  "status": "error",
  "message": "You must be logged in to do this."
}
```

object  statusstring    
messagestring
