Chat Message Delete

Chat Message Delete

URLRequires AuthHTTP Method

/api/v1/chat.delete

yes

POST

Payload

ArgumentExampleRequiredDescription

roomId

ByehQjC44FwMeiLbX

Required

The room id of where the message is to delete.

msgId

7aDSXtjMA3KPLxLjt

Required

The message id to delete.

asUser

true

Optional Default: false

Whether the message should be deleted as the user who sent it.

Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
     -H "X-User-Id: aobEdbYhXfu5hkeqG" \
     -H "Content-type:application/json" \
     http://localhost:3000/api/v1/chat.delete \
     -d '{ "roomId": "ByehQjC44FwMeiLbX", "msgId": "7aDSXtjMA3KPLxLjt", "asUser": true }'

Example Result

Success

{
    "_id": "jEnjsxuoDJamGjbH2",
    "ts": "1696533809813",
    "message": {
        "_id": "jEnjsxuoDJamGjbH2",
        "rid": "6GFJ3tbmHiyHbahmC",
        "u": {
            "_id": "5fRTXMt7DMJbpPJfh",
            "username": "test.funke",
            "name": "TestFunke"
        }
    },
    "success": true
}

Errors

The following errors can occur upon the endpoint.

  • Authorization: Requires an authentication token for the request to be made.

  • Room Id does not match: Occurs when the room id provided does not match where the message is from

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

Change Log

VersionDescription

0.48.0

Added

Last updated

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