permissions

Set role permissions

Changed on

Atomically replaces all permissions directly assigned to a role. An empty permissions array removes every permission from the role. Permissions that do not exist are created when the caller has permission to create them.

Required Permissions

Your root key must have:

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

When any requested permission slug does not exist, it must also have:

  • rbac.*.create_permission
post/v2/permissions.setRolePermissions

Request

  • Base URL
    https://api.unkey.com
  • URL
    https://api.unkey.com/v2/permissions.setRolePermissions
  • Auth
    HTTP bearer

Request body

OR

Response

Permissions set successfully.

Example response

{
  "meta": {
    "requestId": "req_123"
  },
  "data": [
    {
      "id": "perm_1234567890abcdef",
      "name": "users.read",
      "slug": "users-read",
      "description": "Allows reading user profile information and account details"
    }
  ]
}

Changes

    • breaking

      the request property's maxLength was decreased to 128

    • info

      added the new optional request property

    • info

      added subschema #1 subschema #2 to the request body oneOf list

    • info

      the request property became optional

    • info

      request property deprecated

    • info

      the request property's minLength was decreased from 3 to 1

    • info

      removed the pattern ^[a-zA-Z0-9_-]+$ from the request property

    • info

      endpoint added