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

# Assign Bot Roles API

<Badge icon="arrow-left" color="gray">[Back to API List](/ai-for-service/apis/automation/api-list)</Badge>

To assign a bot role to a set of users in a specific bot.

<Note>
  This API requires JWT generated by an application created only from the Admin Console.
</Note>

| Field             | Value                                                                                                                            |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| **Method**        | POST                                                                                                                             |
| **Endpoint**      | `https://{{host}}/api/public/btroles/assignments/`                                                                               |
| **Content Type**  | `application/json`                                                                                                               |
| **Authorization** | `auth: {{JWT}}` See [How to generate the JWT Token](/ai-for-service/apis/automation/api-introduction/#generating-the-jwt-token). |
| **API Scope**     | App Builder: Not Applicable; Admin Console: Profile Management > Role Management                                                 |

## Path Parameters

| Parameter | Required/Optional | Description                                                                        |
| --------- | ----------------- | ---------------------------------------------------------------------------------- |
| host      | Required          | Environment URL, for example, [https://platform.kore.ai](https://platform.kore.ai) |

## Sample Request

```json theme={null}
curl -X POST 'https://{{host}}/api/public/btroles/assignments/' \
-H 'Content-Type: application/json' \
-H 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
-d '[{
"roleId":"5bee8fv6729d35741e05aba4",
"botId":"{{botId}}",
"addUsers":[""],
"removeUsers":[""],
"addGroups": ["G2"],
"removeGroups":[""]
}]'
```

## Body Parameters

| Parameter                       | Required/Optional | Description                                                            |
| ------------------------------- | ----------------- | ---------------------------------------------------------------------- |
| roleId                          | Required          | The ID of the bot role to assign the users or groups.                  |
| botId                           | Required          | The ID of the bot in which to assign the bot roles.                    |
| addUsers or addOrgUserIds       | Optional          | The list of usernames or org user IDs for whom to assign the bot role. |
| removeUsers or removeOrgUserIds | Optional          | The list of usernames or org user IDs for whom to remove the bot role. |
| addGroups                       | Optional          | The list of group names for whom to assign the bot role.               |
| removeGroups                    | Optional          | The list of group names for whom to remove the bot role.               |

## Sample Response

```json theme={null}
[
    {
        "status": "success "
    }
]
```
