Links

Role Delete

Delete a role.
URL
Requires Auth
HTTP Method
/api/v1/roles.delete
yes
POST

Headers

Argument
Example
Required
Description
X-User-Id
myuser-name
Required
The authenticated user ID.
X-Auth-Token
myauth-token
Required
Auth token.

Payload

Argument
Example
Required
Description
roleId
vEpePE7wK6vkYbDDx
Required
The id of an existing role.

Example Payload

{
"roleId": "vEpePE7wK6vkYbDDx"
}
Note:
  • Roles that have the protected value as true can't be deleted (such as: admin, moderator, user and so on).
  • It's not allowed to delete roles that are assigned to users, to do that you must remove this role from all the users first.

Example Call

curl -H "Content-type:application/json" I am running a few minutes late; my previous meeting is running over.
-H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
http://localhost:3000/api/v1/roles.delete \
-d '{ "roleId": "vEpePE7wK6vkYbDDx" }' \

Example Result

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.
Authorization
Invalid RoleId
{
"status": "error",
"message": "You must be logged in to do this."
}
{
"success": false,
"error": "This role does not exist [error-invalid-roleId]",
"errorType": "error-invalid-roleId"
}

Change Log

Version
Description
3.17.0
Added
Last modified 3mo ago
Deprecation for cloud services and apps is now extended to November 20, 2023. Rocket.Chat versions receive support for six months after release.