---
title: "Update a role"
method: PUT
path: "/api/admin/roles/{roleId}"
tags: ["Users"]
---

# Update a role

`PUT /api/admin/roles/{roleId}`

**Enterprise feature**

Update a custom role by role id

## Path parameters

- `roleId` string, required

## Request body

- union — A write model for the custom role and permissions to allow Unleash to decide what actions a role holder is allowed to perform
  - object
    - `name` string, required — The name of the custom role
    - `description` string — A more detailed description of the custom role and what use it's intended for
    - `type` 'root-custom' | 'custom' — [Custom root roles](https://docs.getunleash.io/concepts/rbac#custom-root-roles) (type=root-custom) are root roles with a custom set of permissions. [Custom project roles](https://docs.getunleash.io/concepts/rbac#custom-project-roles) (type=custom) contain a specific set of permissions for project resources.
    - `permissions` object[] — A list of permissions assigned to this role
      - `name` string, required — The name of the permission
      - `environment` string, nullable — The environments of the permission if the permission is environment specific
  - object
    - `name` string, required — The name of the custom role
    - `description` string — A more detailed description of the custom role and what use it's intended for
    - `type` 'custom' — [Custom project roles](https://docs.getunleash.io/concepts/rbac#custom-project-roles) contain a specific set of permissions for project resources.
    - `permissions` object[] — A list of permissions assigned to this role
      - `id` number, required — The id of the permission
      - `name` string — The name of the permission
      - `environment` string, nullable — The environments of the permission if the permission is environment specific

## Response `200`

roleWithVersionSchema

- RoleWithVersionSchema — A single user role received after creation or update of a role
  - `version` integer, required — The version of this schema
  - `roles` RoleSchema, required — A role holds permissions to allow Unleash to decide what actions a role holder is allowed to perform
    - `id` integer, required — The role id
    - `type` string, required — A role can either be a global root role (applies to all projects) or a project role
    - `name` string, required — The name of the role
    - `description` string — A more detailed description of the role and what use it's intended for
    - `project` string, nullable — What project the role belongs to

## Other responses

- `400` — The request data does not match what we expect.
- `401` — Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`.
- `403` — The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation
- `404` — The requested resource was not found.
- `409` — The provided resource can not be created or updated because it would conflict with the current state of the resource or with an already existing resource, respectively.

---

[API](https://skmtc.net/unleash/apis/unleash-api-3.md) · [All operations](https://skmtc.net/unleash/apis/unleash-api-3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/unleash/unleash-api-3/versions/b2c3116e633e/schema)
