Skip to main content

Create permission

Create a new permission to define specific actions or capabilities in your RBAC system. Permissions can be assigned directly to API keys or included in roles.

Use hierarchical naming patterns like documents.read, admin.users.delete, or billing.invoices.create for clear organization.

Important: Permission names must be unique within the workspace. Once created, permissions are immediately available for assignment.

Required Permissions

Your root key must have the following permission:

  • rbac.*.create_permission
1 min read
post/v2/permissions.createPermission
Request example
Response
post/v2/permissions.createPermission

Authorization

Authorizationstringheaderrequired#

Unkey uses bearer tokens for authentication. Public integrations use root keys, while the dashboard proxy uses short-lived JWTs.
To authenticate, include the token in the Authorization header of each request:

Root keys have specific permissions attached to them, controlling what operations they can perform. Legacy permissions use tuple strings like api.*.create_key; resource permissions use Unkey Resource Names plus actions, like unkey:v1:ws_123:keyspaces/*#create_key.
Security best practices:

  • Keep root keys secure and never expose them in client-side code
  • Use different root keys for different environments
  • Rotate keys periodically, especially after team member departures
  • Create keys with minimal necessary permissions following least privilege principle
  • Monitor key usage with audit logs.

Body

application/json
namestringrequired#

Creates a permission with this human-readable name that describes its purpose.
Names must be unique within your workspace to prevent conflicts during assignment.
Use clear, semantic names that developers can easily understand when building authorization logic.
Consider using hierarchical naming conventions like 'resource.action' for better organization.

Examples: 'users.read', 'billing.write', 'analytics.view', 'admin.manage'

Length: 1–512

slugstringrequired#

Creates a URL-safe identifier for this permission that can be used in APIs and integrations.
Must start with a letter and contain only letters, numbers, periods, underscores, and hyphens.
Slugs are often used in REST endpoints, configuration files, and external integrations.
Should closely match the name but in a format suitable for technical usage.
Must be unique within your workspace to ensure reliable permission lookups.

Keep slugs concise but descriptive for better developer experience.

Length: 1–128Pattern: ^[a-zA-Z0-9_:\-\.\*]+$

descriptionstring#

Provides detailed documentation of what this permission grants access to.
Include information about affected resources, allowed actions, and any important limitations.
This internal documentation helps team members understand permission scope and security implications.
Not visible to end users - designed for development teams and security audits.

Consider documenting:

  • What resources can be accessed
  • What operations are permitted
  • Any conditions or limitations
  • Related permissions that might be needed

Length: max 512

Responses

application/json
Permission created successfully
metaobjectrequired#
Metadata object included in every API response. This provides context about the request and is essential for debugging, audit trails, and support inquiries. The requestId is particularly important when troubleshooting issues with the Unkey support team.
Show child attributes
requestIdstringrequired#
A unique id for this request. Always include this ID when contacting support about a specific API request. This identifier allows Unkey's support team to trace the exact request through logs and diagnostic systems to provide faster assistance.
dataobjectrequired#
Show child attributes
permissionIdstringrequired#

The unique identifier assigned to the newly created permission.
Use this ID to reference the permission in role assignments, key operations, and other API calls.
Always begins with 'perm_' followed by a unique alphanumeric sequence.
Store this ID if you need to manage or reference this permission in future operations.

Length: 3–255Pattern: ^[a-zA-Z0-9_]+$