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

# get-role

> Retrieve details about a specific role using the Unkey CLI including its name, description, and list of assigned permissions for RBAC review.

Retrieve details about a specific role including its assigned permissions.

Use this to verify role configuration, check which permissions are currently assigned, or retrieve metadata for access review. Accepts either a role ID (starting with `role_`) or a role name.

**Required permissions:**

* `rbac.*.read_role` (to read roles in any workspace)

<Note>
  See the [API reference](/api-reference/permissions/get-role) for the full HTTP endpoint documentation.
</Note>

## Usage

```bash theme={"theme":"kanagawa-wave"}
unkey api permissions get-role [flags]
```

## Flags

<ParamField body="--role" type="string" required>
  Role ID (starting with `role_`) or role name to retrieve. Must be 3-255 characters and contain only letters, numbers, dots, hyphens, underscores, colons, and asterisks. Returns complete role information including all assigned permissions.
</ParamField>

## Global Flags

| Flag         | Type   | Description                                              |
| ------------ | ------ | -------------------------------------------------------- |
| `--root-key` | string | Override root key (`$UNKEY_ROOT_KEY`)                    |
| `--api-url`  | string | Override API base URL (default: `https://api.unkey.com`) |
| `--config`   | string | Path to config file (default: `~/.unkey/config.toml`)    |
| `--output`   | string | Output format. Use `json` for raw JSON                   |

## Examples

<CodeGroup>
  ```bash By role ID theme={"theme":"kanagawa-wave"}
  unkey api permissions get-role --role=role_1234567890abcdef
  ```

  ```bash By role name theme={"theme":"kanagawa-wave"}
  unkey api permissions get-role --role=my-role-name
  ```

  ```bash JSON output for scripting theme={"theme":"kanagawa-wave"}
  unkey api permissions get-role --role=role_1234567890abcdef --output=json
  ```

  ```bash Extract permissions from a role theme={"theme":"kanagawa-wave"}
  unkey api permissions get-role --role=support.readonly --output=json | jq '.data.permissions[].name'
  ```
</CodeGroup>

## Output

Default output shows the request ID with latency, followed by the role details:

```text theme={"theme":"kanagawa-wave"}
req_2c9a0jf23l4k567 (took 45ms)

{
  "id": "role_1234567890abcdef",
  "name": "support.readonly",
  "description": "Provides read-only access for customer support representatives",
  "permissions": [
    {
      "id": "perm_abc123",
      "name": "tickets.read"
    }
  ]
}
```

With `--output=json`, the full response envelope is returned:

```json theme={"theme":"kanagawa-wave"}
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "data": {
    "id": "role_1234567890abcdef",
    "name": "support.readonly",
    "description": "Provides read-only access for customer support representatives",
    "permissions": [
      {
        "id": "perm_abc123",
        "name": "tickets.read"
      }
    ]
  }
}
```
