Update Role

HTTP MethodURLRequires Auth

POST

/api/v1/roles.update

Body Parameters

KeyExample ValueDescription

roleId*

646c431fa8c3a3ba32d0e1c4

The role ID that you want to update.

name*

newRole

The updated name of the role.

scope

Subscriptions

The updated scope of the role. The default value is Users.

description

Role description

Updated description for the role.

mandatory2fa

true

Whether the role should have a mandatory 2FA. The default value is false.

Example Call

curl --location 'http://localhost:3000/api/v1/roles.update' \
--header 'X-User-Id: rbAXPnMktTFbNpwtJ' \
--header 'X-Auth-Token: 3K3OqbQcU9H6FiZNEE5lxTTEfXyWxypWRJjvl_2ySOm' \
--header 'Content-Type: application/json' \
--data '{
        "roleId": "646c431fa8c3a3ba32d0e1c4",
        "name": "Test Role",
        "scope": "Users",
        "description": "Testing Role for API",
        "mandatory2fa": false

    }'

Example Response

Success

{
    "role": {
        "_id": "646c431fa8c3a3ba32d0e1c4",
        "name": "update role",
        "scope": "Users",
        "description": "Update Role support tier 1",
        "protected": false,
        "mandatory2fa": false,
        "_updatedAt": "2023-05-23T05:33:33.730Z"
    },
    "success": true
}

Error

Any of the following errors can occur:

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

  • Invalid Role Properties: Occurs when the required payload arguments are not provided when making the request.

{
    "success": false,
    "error": "unauthorized"
}

Change Log

VersionDescription

6.0.0

Last updated

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