> ## 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.

# role_not_found

> The requested role was not found in Unkey. Verify the role ID is correct and the role has not been deleted from your workspace RBAC config.

<Danger>err:unkey:data:role\_not\_found</Danger>

```json Example theme={"theme":"kanagawa-wave"}
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "error": {
    "detail": "The requested role could not be found",
    "status": 404,
    "title": "Not Found",
    "type": "https://unkey.com/docs/errors/unkey/data/role_not_found"
  }
}
```

## What Happened?

This error occurs when you're trying to perform an operation on a role that doesn't exist in the Unkey system. Roles in Unkey are collections of permissions that can be assigned to users or API keys.

Common scenarios that trigger this error:

* Using an incorrect role ID or name
* Referencing a role that has been deleted
* Trying to assign a role that doesn't exist in the current workspace
* Typos in role names when using name-based lookups

## How To Fix

Verify that you're using the correct role ID or name and that the role still exists in your workspace:

1. List all roles in your workspace to find the correct ID
2. Check if the role has been deleted and recreate it if necessary
3. Verify you're working in the correct workspace

Here's how to list all roles in your workspace:

```bash theme={"theme":"kanagawa-wave"}
curl -X POST https://api.unkey.com/v2/permissions.listRoles \
  -H "Authorization: Bearer unkey_YOUR_API_KEY"
```

If you need to create a new role, use the appropriate API endpoint:

```bash theme={"theme":"kanagawa-wave"}
curl -X POST https://api.unkey.com/v2/permissions.createRole \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer unkey_YOUR_API_KEY" \
  -d '{
    "name": "API Reader",
    "description": "Can read API information"
  }'
```

## Common Mistakes

* **Incorrect identifiers**: Using wrong role IDs or names
* **Deleted roles**: Referencing roles that have been removed
* **Case sensitivity**: Role names might be case-sensitive
* **Workspace boundaries**: Trying to use roles from another workspace

## Related Errors

* [err:unkey:data:permission\_not\_found](./permission_not_found) - When the requested permission doesn't exist
* [err:unkey:data:api\_not\_found](./api_not_found) - When the requested API doesn't exist
* [err:unkey:authorization:insufficient\_permissions](../authorization/insufficient_permissions) - When you don't have permission to perform operations on roles
