latestOpenAPI 3.1.02026-08-194237902.5 MB

563848e0ecc0

Role

Add and remove role permissions in one call

Modifies the permission set of the role identified by roleId by adding and/or removing permissions in a single request. This is not a single atomic operation: the implementation reads the role's current permissions, merges the requested add/remove changes, and then writes the result back as a separate step (no transaction or rollback); concurrent calls for the same role may race, and one call's changes can be silently overwritten by another (tracked in CP-36406). Use this instead of separate add/remove calls when you need to both grant and revoke permissions in one operation; to only add permissions use POST /roles/{roleId}/permissions. Requires the tenant-id header (returns 400 if absent or blank). The request body accepts two optional arrays of permission ID strings: add (permissions to grant) and remove (permissions to revoke). Permissions in remove that are not currently assigned are silently ignored. If both add and remove include the same ID, the permission is added (remove is applied before add). Returns 200 with the complete, updated list of all permissions assigned to the role after the operation. Note: if the role does not exist, the current implementation returns 500 rather than 404 (tracked in CP-36405).

patch/roles/{roleId}/permissions/bulk

Path parameters

roleIdstring required

Headers

tenant-idstring

Request body

addstring[]

IDs of permissions to add to the role. Omit or leave empty if only removing.

removestring[]

IDs of permissions to remove from the role. Omit or leave empty if only adding.

Example request

{
  "add": [
    "2c5ea4c0-4067-4c5f-9dd1-3f4a0d2c5b09"
  ],
  "remove": [
    "9e21c453-9f18-4e6b-8a2f-6d4c1b9e0a77"
  ]
}

Response

Permissions updated successfully

idstring

Server-assigned unique identifier for the permission.

resourcestring

Name of the resource this permission governs (e.g. 'user', 'roster'). Mirrors the resource value supplied when the permission was created or last replaced.

actionstring

Name of the action this permission grants on the resource (e.g. 'read', 'create'). Mirrors the action value supplied when the permission was created or last replaced.

descriptionstring

Human-readable explanation of what the permission allows. Optional; may be null if it was not supplied at creation.

createdAtstring date-time
updatedAtstring date-time

Example response

[
  {
    "id": "perm-123-456-789",
    "resource": "user",
    "action": "read",
    "description": "Allows reading user profiles",
    "createdAt": "2022-03-10T12:15:50-04:00",
    "updatedAt": "2022-03-10T12:15:50-04:00"
  }
]