Skip to main content

set-role-permissions

Replace all permissions directly assigned to a role
1 min read

Atomically replace all permissions directly assigned to a role. An empty permissions array removes every permission from the role. Permissions that don't exist are created when the caller has permission to create them.

Required permissions:

  • rbac.*.add_permission_to_role
  • rbac.*.remove_permission_from_role

Creating a missing permission also requires rbac.*.create_permission.

Usage#

Flags#

--role-idstringrequired#

The ID or slug of the role whose directly assigned permissions will be replaced.

--permissionsstring[]required#

The complete set of permission slugs to assign directly to the role. Separate multiple values with commas. Missing permissions are created when authorized. Pass an empty value to clear all direct permissions.

Global Flags#

FlagTypeDescription
--root-keystringOverride root key ($UNKEY_ROOT_KEY)
--api-urlstringOverride API base URL (default: https://api.unkey.com)
--configstringPath to config file (default: ~/.unkey/config.toml)
--outputstringOutput format. Use json for raw JSON
--bodystringSend this JSON string as the request body. You cannot combine it with request-building flags.

Examples#

Note

See Roles and permissions for RBAC concepts and examples.