Clear Room History

Cleans up a room, removing messages from the provided time range.

HTTP MethodURLRequires Auth

POST

/api/v1/rooms.cleanHistory

Body Parameter

KeyExample ValueDescription

roomId*

ByehQjC44FwMeiLbX

The room ID.

latest*

2016-09-30T13:42:25.304Z

The end of time range of messages.

oldest*

2016-05-30T13:42:25.304Z

The start of the time range of messages.

inclusive

true

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

excludePinned

true

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

filesOnly

true

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

users

["vynmera", "ggazzo"]

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

limit

10

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

ignoreDiscussion

true

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

ignoreThreads

true

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

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type: application/json" \
     http://localhost:3000/api/v1/rooms.cleanHistory \
     -d '{ 
          "roomId": "roomId", 
          "latest": "2016-12-09T13:42:25.304Z", 
          "oldest": "2016-08-30T13:42:25.304Z" }'

Example Response

{
   "success": true
}

Change Log

VersionDescription

0.64.0

Added

0.67.0

Added fields limit, excludePinned, filesOnly and users

Last updated

Rocket.Chat versions receive support for six months after release.