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.

Add Permission to a Role

Prev Next
Post
/api/v1/permissions.addRole

Grant a permission to a role.

Permission required: access-permissions.

To modify a setting-level permission, the access-setting-permissions permission is also required.

Changelog

Version Description
8.7.0 Added
Header parameters
X-User-Id
stringRequired

The authenticated user ID.

ExamplerbAXPnMktTFbNpwtJ
X-Auth-Token
stringRequired

The authenticated user token.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
Body parameters
Example
{
  "permissionId": "create-team-channel",
  "role": "user"
}
object
permissionId
string Required

The permission ID.

Examplecreate-team-channel
role
string Required

The role to grant the permission to. For default Rocket.Chat roles, enter the role name, such as admin or user. For custom roles, enter the role ID.

Exampleuser
Responses
200

OK

Success
{
  "success": true
}
object
success
boolean
400

Bad Request

Invalid Parameters
{
  "success": false,
  "error": "must have required property 'role'",
  "errorType": "invalid-params"
}
Permission does not exist
{
  "success": false,
  "error": "Permission does not exist [error-invalid-permission]",
  "errorType": "error-invalid-permission",
  "details": {
    "method": "authorization:addPermissionToRole",
    "action": "Adding_permission"
  }
}
Invalid Role
{
  "success": false,
  "error": "Role does not exist [error-invalid-role]",
  "errorType": "error-invalid-role",
  "details": {
    "method": "authorization:addPermissionToRole",
    "action": "Adding_permission"
  }
}
Expand All
object
success
boolean
error
string
errorType
string
details
object
method
string
action
string
401

Unauthorized

Authorization Error
{
  "status": "error",
  "message": "You must be logged in to do this."
}
object
status
string
message
string
403

Forbidden

Permission Error
{
  "success": false,
  "error": "User does not have the permissions required for this action [error-unauthorized]"
}
object
success
boolean
error
string