# POST /api/roles

Authentication (security requirement alternatives):

```json
[
  {
    "bearer": []
  }
]
```

- bearer: http (bearer), header JWT. Enter JWT token

Request body: application/json (required)

Type: object

Schema: [CreateRoleDTO](https://sourcey-gauzy.pages.dev/api-reference/models/createroledto/index.md)

- `tenant` (optional)
  Type: object

- `tenantId` (optional)
  Type: string

- `name` (required)
  Type: string

Responses:

- 201: 

- 401: Unauthorized

- 403: Forbidden

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/roles' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant": {},
  "tenantId": "string",
  "name": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "tenant": {},
  "tenantId": "string",
  "name": "string"
}`;

const response = await fetch('http://localhost:3000/api/roles', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "tenant": {},
  "tenantId": "string",
  "name": "string"
}'''

response = requests.post(
    'http://localhost:3000/api/roles',
    data=body.encode('utf-8'),
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
