Skip to main content

Update a role

PUT 

<your-unleash-url>/api/admin/roles/:roleId

Update a custom role by role id

Request

Path Parameters

    roleId stringrequired

Bodyrequired

createRoleWithPermissionsSchema

    anyOf
    namestringrequired

    The name of the custom role

    Example: external-contributors
    descriptionstring

    A more detailed description of the custom role and what use it's intended for

    Example: Users with external-contributors role have limited access to most features in Unleash
    typestring

    Custom root roles (type=root-custom) are root roles with a custom set of permissions. Custom project roles (type=custom) contain a specific set of permissions for project resources.

    Possible values: [root-custom, custom]

    Example: root-custom
    permissions object[]

    A list of permissions assigned to this role

  • Array [
  • namestringrequired

    The name of the permission

    Example: CREATE_PROJECT
    environmentstringnullable

    The environments of the permission if the permission is environment specific

    Example: development
  • ]

Responses

roleWithVersionSchema

Schema
    versionintegerrequired

    The version of this schema

    Possible values: >= 1

    Example: 1
    roles objectrequired

    A role holds permissions to allow Unleash to decide what actions a role holder is allowed to perform

    idintegerrequired

    The role id

    Example: 9
    typestringrequired

    A role can either be a global root role (applies to all projects) or a project role

    Example: root
    namestringrequired

    The name of the role

    Example: Editor
    descriptionstring

    A more detailed description of the role and what use it's intended for

    Example: Users with the editor role have access to most features in Unleash but can not manage users and roles in the global scope. Editors will be added as project owners when creating projects and get superuser rights within the context of these projects. Users with the editor role will also get access to most permissions on the default project by default.
    projectstringnullable

    What project the role belongs to

    Example: default

Authorization: Authorization

name: Authorizationtype: apiKeyin: headerdescription: API key needed to access this API
curl -L -X PUT '<your-unleash-url>/api/admin/roles/:roleId' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: <Authorization>' \
-d '{
"name": "external-contributors",
"description": "Users with external-contributors role have limited access to most features in Unleash",
"type": "root-custom",
"permissions": [
{
"name": "CREATE_PROJECT",
"environment": "development"
}
]
}'
Request Collapse all
Base URL
<your-unleash-url>
Auth
Parameters
— pathrequired
Body required
{
  "name": "external-contributors",
  "description": "Users with external-contributors role have limited access to most features in Unleash",
  "type": "root-custom",
  "permissions": [
    {
      "name": "CREATE_PROJECT",
      "environment": "development"
    }
  ]
}
ResponseClear

Click the Send API Request button above and see the response here!