{ "meta": { "requestId": "req_2c9a0jf23l4k567" }, "error": { "detail": "The requested role could not be found", "status": 404, "title": "Not Found", "type": "https://unkey.com/docs/api-reference/errors-v2/unkey/data/role_not_found" }}
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
Here’s an example of a request that would trigger this error:
Copy
Ask AI
# Attempting to add a permission to a non-existent rolecurl -X POST https://api.unkey.com/v1/roles.addPermission \ -H "Content-Type: application/json" \ -H "Authorization: Bearer unkey_YOUR_API_KEY" \ -d '{ "roleId": "role_nonexistent", "permissionId": "perm_123abc" }'