Skip to content

Update a client role

PATCH
/clusters/{cluster_id}/realms/{realm_name}/clients/{client_id}/roles/{role_name}
curl --request PATCH \
  --url http://localhost:8000/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/realms/customer-portal/clients/storefront/roles/admin \
  --header 'API-Key: <API-Key>' \
  --header 'API-Version: 2026-06-01.beta' \
  --header 'Content-Type: application/json' \
  --data '{ "description": "Read and export invoices" }'

Updates the role’s name or description. The role stays on the same client, and renaming it does not affect existing assignments.

Required scope: client-roles:write

cluster_id
required
string format: uuid
realm_name
required

Keycloak realm name (not ID). Must start with a letter; allows letters, digits, and hyphens.

string
>= 1 characters <= 63 characters /^[a-zA-Z][a-zA-Z0-9-]*$/

Example

customer-portal
client_id
required

Reference to a client in the realm: either its OAuth client_id or its internal Keycloak UUID. Both forms resolve to the same client.

string
>= 1 characters <= 255 characters

Example

storefront
role_name
required

Role name.

string
>= 1 characters <= 255 characters /^[A-Za-z0-9._:@-]+$/

Example

admin
API-Version
required
string
Allowed values: 2026-06-01.beta
Media typeapplication/json

Patch request for updating a client role. At least one field should be provided.

object
name
string
>= 1 characters <= 255 characters /^[A-Za-z0-9._:@-]+$/

Example

invoices-reader
description
string
<= 255 characters

Example

Read and export invoices

Example

{
  "description": "Read and export invoices"
}

The request has succeeded.

Media typeapplication/json

Public representation of a role defined on a single client.

object
id

Keycloak identifier of the role.

string
name
required
string
>= 1 characters <= 255 characters /^[A-Za-z0-9._:@-]+$/
description

Human-friendly role description, when available.

string
nullable
composite

Whether this role is composed from other roles.

boolean
client_id
required

OAuth client_id of the client the role belongs to.

string
client_uuid
required

Internal Keycloak UUID of the client the role belongs to.

string

Example

{
  "id": "9a1f0f0e-1b2c-4d3e-8f5a-6b7c8d9e0f11",
  "name": "invoices-read",
  "description": "Read invoices",
  "composite": false,
  "client_id": "storefront",
  "client_uuid": "3f4a1c2e-5b6d-4e7f-8a9b-0c1d2e3f4a5b"
}

Access is unauthorized.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

Access is forbidden.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

The server cannot find the requested resource.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

The request conflicts with the current state of the server.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

Client error

Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri
errors
required
Array<object>
>= 1 items
object
field
required
string
detail
required
string
code
string
value

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com",
  "errors": [
    {
      "field": "example",
      "detail": "example",
      "code": "example",
      "value": "example"
    }
  ]
}

Client error

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}
Retry-After
integer
RateLimit-Limit
integer
RateLimit-Remaining
integer
RateLimit-Reset
integer
X-RateLimit-Limit-Second
integer
X-RateLimit-Remaining-Second
integer
X-RateLimit-Limit-Minute
integer
X-RateLimit-Remaining-Minute
integer
X-RateLimit-Limit-Hour
integer
X-RateLimit-Remaining-Hour
integer
X-RateLimit-Limit-Day
integer
X-RateLimit-Remaining-Day
integer

Server error

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

Server error

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}