# createRole

## Overview

Creates a new role with a unique name, optional description, and selected permissions. Automatically includes profile permissions in addition to the user-selected ones.

## Modules Commands Used

- `user-management.createRole` — Creates a new role record with the given permissions

## Exception Handling

| Error Code              | Source     | Description                              |
| ----------------------- | ---------- | ---------------------------------------- |
| ROLE_ALREADY_EXISTS     | createRole | A role with the same name already exists |
| MISSING_REQUIRED_FIELD  | createRole | The role name was not provided           |
| INVALID_PERMISSION      | createRole | A permission key has an invalid format   |
| INSUFFICIENT_PERMISSION | resolver   | The caller lacks the required permission |
