Replace the permissions of a role
/roles/{id}/permissionsMakes the ids you send the role's permissions and returns them; [] clears them. An unknown id returns 422 exists on ids.N. With a personal token the permissions you add and the permissions you take away must all be ones you hold yourself, and super admin needs a super admin caller, else 403 missing_permission; permissions that stay are not checked. A service identity is refused only for super admin and super-admin-level permissions. A global role returns 403 forbidden. Adding super admin to a role a SCIM group maps makes the role unassignable by SCIM, and the next SCIM sync takes it from the group's members. Emits role.updated with permissions as the changed field when it changed; sends no email. Also accepts the deprecated {permissions} body until 2027-06-30 (Deprecation, Sunset; not on a missing-scope 403), with dry run and idempotency. Sending the old ids undoes it.
Path parameters
The role's id, a whole number from 1 to 2147483647. An unknown role, another organisation's role and a service role return 404.
Query parameters
Validate and run the call without committing it, returning what the real call would return with
meta.dry_runset.
Headers
Makes a retry safe. Send a new UUID for each new request and reuse it only to retry that request; the first response is replayed for 24 hours.
Request body
application/json, required · RolePermissionReplace
Every permission the role should grant, distinct ids. Send an empty list to clear them.
{
"ids": [
12,
18
]
}Responses
{
"data": [
{
"id": 1,
"key": "string",
"label": "string"
}
]
}Authorization failed. error.code is forbidden when the role is global and so read-only, missing_permission when the caller may not grant, take away or delete what the call touches, with the permissions in details, or one of missing_scope, scope_disabled, org_disabled, ip_blocked, user_disabled.
The request can't be processed (HTTP 422): validation_failed with one ErrorDetail per
problem, or a code documented on the operation.
Examples
curl -X PUT https://your-org-domain/kong/core/api/v2/roles/{id}/permissions\
-H "Authorization: Bearer $HELM_API_KEY"\
-H "Content-Type: application/json"\
-d '{
"ids": [
12,
18
]
}'