Update Role

Post
/api/v1/roles.update
Premium tag

Update a role in the workspace.

Permission required: access-permissions

Changelog

Version Description
6.0.0 Moved to Enterprise plan.
Header parameters
X-User-Id
stringRequired

The authenticated user ID.

ExamplerbAXPnMktTFbNpwtJ
X-Auth-Token
stringRequired

The authenticated user token.

ExampleRScctEHSmLGZGywfIhWyRpyofhKOiMoUIpimhvheU3f
Body parameters
Example 1
{
  "roleId": "646c431fa8c3a3ba32d0e1c4",
  "name": "Test Role",
  "scope": "Users",
  "description": "Testing Role for API",
  "mandatory2fa": false
}
object
roleId
string Required

The role ID that you want to update.

Example646c431fa8c3a3ba32d0e1c4
name
string Required

The updated name of the role.

ExamplenewRole
scope
string

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

ExampleSubscriptions
description
string

Updated description for the role.

ExampleRole description
mandatory2fa
boolean

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

Defaultfalse
Responses
200

OK

Success Example
{
  "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
}
Expand All
object
role
object
_id
string
name
string
scope
string
description
string
protected
boolean
mandatory2fa
boolean
_updatedAt
string
success
boolean
400

Bad Request

Example 1
{
  "success": false,
  "error": "The role properties are invalid. [error-invalid-role-properties]",
  "errorType": "error-invalid-role-properties"
}
Example 2
{
  "success": false,
  "error": "Accessing permissions is not allowed [error-action-not-allowed]",
  "errorType": "error-action-not-allowed"
}
object
success
boolean
error
string
errorType
string
401

Unauthorized

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