Skip to main content

delete-role

Remove a role from your Unkey workspace using the CLI. Delete unused roles and automatically unlink them from all associated API keys.
1 min read

Remove a role from your workspace. This also removes the role from all assigned API keys.

Important: This operation cannot be undone and immediately affects all API keys that had this role assigned. All keys with this role will lose the associated permissions, and access to resources protected by this role's permissions will be denied.

Required permissions:

  • rbac.*.delete_role
Note

See the API reference for the full HTTP endpoint documentation.

Usage#

Flags#

--rolestringrequired#

The role ID or name to permanently delete. Must be 1-128 characters and either a valid role ID that begins with role_ or a role name that exists within your workspace.

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#

Output#

Default output shows the request ID:

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