## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://docs.cognigy.com/llms.txt)

Use this file to discover all available pages before exploring further.

### Assign a Global Role

**POST**  
`/v2.0/users/{userId}/addroletouser`

#### Example Usage

**cURL**  
```bash
curl --request POST \
  --url https://api-trial.cognigy.ai/new/v2.0/users/{userId}/addroletouser \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '{}'
```

**Python**  
```python
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/users/{userId}/addroletouser"

payload = {}
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

**JavaScript (Fetch)**  
```javascript
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({})
};

fetch('https://api-trial.cognigy.ai/new/v2.0/users/{userId}/addroletouser', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

#### Common Response Status Codes

- **204**: User-role was added to the user.
- **400**: Bad Request - Validation failed. Missing payload.
- **401**: Unauthorized - Invalid API Key.
- **403**: Forbidden - Insufficient permissions.
- **404**: Not Found - The specified resource does not exist.
- **500**: Internal Server Error - An unexpected error occurred.

### Authorizations

#### Required Headers
- **X-API-Key** (string): Supply the API Key in the HTTP Header.

### Body Parameters

**application/json**

#### Role options
- `admin`
- `apiKeys`
- `base_role`
- `basicSupportUser`
- `fullSupportUser`
- `liveAgentAdmin`
- `liveAgentAgent`
- `liveAgentSupervisor`
- `odata`
- `projectAssigner`
- `projectManager`
- `userManager`
- `userDetailsViewer`
- `voiceGatewayUser`
- `opsCenterUser`

### Path Parameters

- **userId** (string): The Id of the User, required, string length: `24`, pattern: `^[a-z0-9]{24}$`.

### Response
- **204**: User-role was added to the user.
