Delete Role

HTTP MethodURLRequires Auth

POST

/api/v1/roles.delete

  • Permission required: access-permissions

  • Roles that have the protected value as true can't be deleted (such as: admin, moderator, user and so on).

  • You cannot delete roles that are assigned to users. To do that, you must first remove this role from all the users.

Body Parameters

KeyExample ValueDescription

roleId*

vEpePE7wK6vkYbDDx

The ID of an existing role.

Example Call

curl --location 'http://http://localhost:3000/api/v1/roles.delete' \
--header 'X-Auth-Token: x65a7F7aZZtW_H2hTgKEsp_RFxUkLPI6j0G5GNqvoyF' \
--header 'X-User-Id: CkCPNcvsvCDfmWLqC' \
--header 'Content-Type: text/plain' \
--data '{
    "roleId": "6579adcf2dd9f9d9514f6"
}'

Example Response

Success

{
    "success": true
}

Error

Any of the following errors can occur on the endpoint.

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

  • Invalid RoleId: This occurs when the roleId does not exist on your workspace.

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

Change Log

VersionDescription

3.17.0

Added

Last updated

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