> ## Documentation Index
> Fetch the complete documentation index at: https://developers.logicgate.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Risk Cloud API: Update Users and Permission Sets on Role

> Add or remove users and permission sets on a role with the Roles API.

Updating users and permission sets on a role is a common task in Risk Cloud, and the Roles API
supports it directly.

## Prerequisites

* Obtain your [API Access Token](https://developers.logicgate.ai/guides/api-usage/authentication.md) or pull the Risk Cloud Postman
  Collection (see the [Postman guide](https://developers.logicgate.ai/guides/quick-start/postman.md)) to get started.
* Required user role: `Admin`.

## Update Role endpoint request

```
PATCH /api/v1/roles/with-permission-sets/{role}
```

| Path parameter | Required | Description |
| - | - | - |
| `role` | Yes | The role ID you want to update. |

### Case 1: Update users on role

Request body properties for adding or removing users:

```json theme={null}
{
    "usersToAdd": [
        {
            "status": "Active",
            "id": "<user ID>"
        }
    ],
    "usersToRemove": [
        {
            "status": "Active",
            "id": "<user ID>"
        }
    ],
    "name": "<role name>"
}
```

### Case 2: Update permission sets on role

Request body properties for adding or removing permission sets:

```json theme={null}
{
    "permissionSetsToAdd": [
        {
            "id": "<permission set ID>"
        }
    ],
    "permissionSetsToRemove": [
        {
            "id": "<permission set ID>"
        }
    ],
    "name": "<role name>"
}
```

> [!TIP]
>
> **Combining cases**
>
> You can combine the properties from both request bodies above in a single request if you need to
> add or remove users and permission sets at the same time.

## Update Role endpoint response

Returns a `Role` object:

```json theme={null}
{
    "id": "<role id>",
    "active": true,
    "created": "<created date time in epoch millis>",
    "updated": "<updated date time in epoch millis>",
    "name": "<role name>",
    "locked": false,
    "superAdmin": false,
    "defaultRoleForNewUsers": false,
    "autoprovisioned": false,
    "externalId": "<role external ID>",
    "stepPermissionSets": [],
    "moduleEntitlements": [],
    "users": [],
    "userCount": 0,
    "moduleCount": 0
}
```

`stepPermissionSets` and `users` are returned empty; `moduleEntitlements` is populated in the
response.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.