Keycloak Roles API

Manage realm-level and client-level roles

GitHub OpenAPI
Pull this API's OpenAPI, operations, scores and pricing into your own code or AI agent with a free APIs.io key — sign in with GitHub, Google or LinkedIn. No form to fill in; signing in shares your email address with us (Privacy).
Business capability
Identity & Access Management BC-620.20

Operations 36

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /{realm}/users/{userId}/role-mappings/realm Keycloak Get realm-level role mappings for a user #
POST /{realm}/users/{userId}/role-mappings/realm Keycloak Add realm-level role mappings to a user #
DELETE /{realm}/users/{userId}/role-mappings/realm Keycloak Remove realm-level role mappings from a user #
GET /{realm}/roles Keycloak List realm-level roles #
POST /{realm}/roles Keycloak Create a realm-level role #
GET /{realm}/roles/{roleName} Keycloak Get a realm-level role by name #
PUT /{realm}/roles/{roleName} Keycloak Update a realm-level role #
DELETE /{realm}/roles/{roleName} Keycloak Delete a realm-level role #
GET /admin/realms/{realm}/clients/{client-uuid}/roles List roles of a client · Get all roles for the realm or client #
Ask an LLM
“What roles are defined for a particular client in my realm?”
“Can I search a client's roles by name?”
Tell an agent
List roles for client {client} in realm {realm}.
Find client {client} roles matching {search}.
POST /admin/realms/{realm}/clients/{client-uuid}/roles Create a role on a client · Create a new role for the realm or client #
Ask an LLM
“How do I add a new role to a client?”
“Can a client role be a composite role?”
Tell an agent
Create a role {name} on client {client} in realm {realm}.
Add client role {name} with composite {composite} to {client} in {realm}.
GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name} Get a client role · Get a role by name #
Ask an LLM
“What does a specific role on a client look like?”
“Can I read one client role by name?”
Tell an agent
Get role {role} on client {client} in realm {realm}.
Show the details of client {client} role {role}.
PUT /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name} Update a client role · Update a role by name #
Ask an LLM
“How do I rename or change a role on a client?”
“Can I set composite roles on a client role?”
Tell an agent
Rename client {client} role {role} in realm {realm} to {name}.
Set composite roles {composites} on client {client} role {role}.
DELETE /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name} Delete a client role · Delete a role by name #
Ask an LLM
“How do I remove a role from a client?”
“Can I delete a client role by name?”
Tell an agent destructive · confirm first
Delete role {role} from client {client} in realm {realm}.
Remove the client role {role} on {client}.
GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites List roles a client role inherits · Get composites of the role #
Ask an LLM
“Which roles does a client role inherit?”
“Can I see the composites of a client role?”
Tell an agent
List composites of role {role} on client {client} in realm {realm}.
Show what client {client} role {role} inherits.
POST /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites Add roles to a client role's composites · Add a composite to the role #
Ask an LLM
“How do I make a client role inherit other roles?”
“Can I add roles to a client role's composite list?”
Tell an agent
Add roles to the composites of role {role} on client {client} in realm {realm}.
Make client {client} role {role} inherit more roles.
DELETE /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites Remove roles from a client role's composites · Remove roles from the role's composite #
Ask an LLM
“How do I stop a client role from inheriting certain roles?”
“Can I clear a client role's composite list?”
Tell an agent destructive · confirm first
Remove roles from the composites of role {role} on client {client} in realm {realm}.
Clear the inherited roles of client {client} role {role}.
GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites/clients/{targetClientUuid} Get client-level composites of a client role · Get client-level roles for the client that are in the role's composite #
Ask an LLM
“Which roles from a different client are part of a client role's composite?”
“Are there client-level roles in a client role's composite?”
Tell an agent
Get client-level composites of client role {role} in {client} on realm {realm}.
Show the roles from client {targetClient} that compose client role {role} in realm {realm}.
GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/composites/realm List realm roles inside a client role's composite · Get realm-level roles of the role's composite #
Ask an LLM
“What realm-level roles does a client role include as composites?”
“Which realm roles are bundled into a role that belongs to a client?”
Tell an agent
List the realm-level roles inside the composite of client role {role} on client {client} in realm {realm}.
Show which realm roles are bundled into client {client} role {role} in {realm}.
GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/groups List groups with a client role · Returns a stream of groups that have the specified role name #
Ask an LLM
“Which groups have a particular role on a client?”
“Can I find groups that grant a client role?”
Tell an agent
List groups that have role {role} on client {client} in realm {realm}.
Find groups with client {client} role {role}.
GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/management/permissions Check a client role's management permissions · Return object stating whether role Authorization permissions have been… #
Ask an LLM
“Does a client role have management permissions enabled?”
“Can I read the management permissions of a client role?”
Tell an agent
Get management permissions for role {role} on client {client} in realm {realm}.
Show whether client {client} role {role} has management permissions.
PUT /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/management/permissions Set a client role's management permissions · Return object stating whether role Authorization permissions have been… #
Ask an LLM
“How do I enable management permissions on a client role?”
“Can I set scope permissions on a client role?”
Tell an agent
Set management permissions {permissions} on role {role} of client {client} in {realm}.
Enable management permissions for client {client} role {role}.
GET /admin/realms/{realm}/clients/{client-uuid}/roles/{role-name}/users List users with a client role · Returns a stream of users that have the specified role name #
Ask an LLM
“Which users have a particular role on a client?”
“Can I find users granted a client role?”
Tell an agent
List users with role {role} on client {client} in realm {realm}.
Find users granted client {client} role {role}.
GET /admin/realms/{realm}/roles List realm roles · Get all roles for the realm or client #
Ask an LLM
“What roles exist in my realm?”
“Can I search realm roles by name?”
Tell an agent
List roles in realm {realm}.
Find realm roles matching {search}.
POST /admin/realms/{realm}/roles Create a realm role · Create a new role for the realm or client #
Ask an LLM
“How do I add a new role to the realm?”
“Can a realm role be a composite role?”
Tell an agent
Create a role {name} in realm {realm}.
Add realm role {name} with composite {composite} to {realm}.
GET /admin/realms/{realm}/roles/{role-name} Get a realm role · Get a role by name #
Ask an LLM
“What does a specific realm role look like?”
“Can I read one realm role by name?”
Tell an agent
Get role {role} in realm {realm}.
Show the details of realm role {role}.
PUT /admin/realms/{realm}/roles/{role-name} Update a realm role · Update a role by name #
Ask an LLM
“How do I rename or change a realm role?”
“Can I set composite roles on a realm role?”
Tell an agent
Rename realm role {role} in {realm} to {name}.
Set composite roles {composites} on realm role {role}.
DELETE /admin/realms/{realm}/roles/{role-name} Delete a realm role · Delete a role by name #
Ask an LLM
“How do I remove a role from the realm?”
“Can I delete a realm role by name?”
Tell an agent destructive · confirm first
Delete role {role} from realm {realm}.
Remove the realm role {role}.
GET /admin/realms/{realm}/roles/{role-name}/composites List all composites of a realm role · Get composites of the role #
Ask an LLM
“What roles make up a realm role's composite?”
“Can I see both realm and client roles in a realm role's composite?”
Tell an agent
Get all composites of realm role {role} in realm {realm}.
Show the full composite list of realm role {role} on {realm}.
POST /admin/realms/{realm}/roles/{role-name}/composites Add a composite to a role · Add a composite to the role #
Ask an LLM
“How do I make a role include another role as a composite?”
“Can I add a composite to an existing role?”
Tell an agent
Add a composite to role {role} in realm {realm}.
Make role {role} in {realm} include the composite roles I list.
DELETE /admin/realms/{realm}/roles/{role-name}/composites Remove composites from a role · Remove roles from the role's composite #
Ask an LLM
“How do I take a composite role out of a role?”
“Can I remove composites from an existing role?”
Tell an agent destructive · confirm first
Remove composites from role {role} in realm {realm}.
Take the composite roles off role {role} in {realm}.
GET /admin/realms/{realm}/roles/{role-name}/composites/clients/{targetClientUuid} Get a role's client-level composites for one client · Get client-level roles for the client that are in the role's composite #
Ask an LLM
“Which client-level roles are in a role's composite for one client?”
“What does a role's composite look like for a specific client UUID?”
Tell an agent
Get the client-level composites of role {role} in realm {realm} for client {client}.
Show which roles in {client} are in the composite of {role} in {realm}.
GET /admin/realms/{realm}/roles/{role-name}/composites/realm Get realm composites of a realm role · Get realm-level roles of the role's composite #
Ask an LLM
“Which realm-level roles are in a realm role's composite?”
“Are any realm roles among the composites of a realm role?”
Tell an agent
Get realm-level composites of realm role {role} in realm {realm}.
Show the realm-level composites of realm role {role} on {realm}.
GET /admin/realms/{realm}/roles/{role-name}/groups List groups with a role · Returns a stream of groups that have the specified role name #
Ask an LLM
“Which groups have a given role assigned?”
“Can I see every group that carries a role, not just users?”
Tell an agent
List groups that have role {role} in realm {realm}.
Show {max} groups with role {role} in {realm}, brief {brief}.
GET /admin/realms/{realm}/roles/{role-name}/management/permissions Check a role's management permissions · Return object stating whether role Authorization permissions have been… #
Ask an LLM
“Can I check whether a role has management permissions enabled?”
“What does a role's management permissions object look like?”
Tell an agent
Get the management permissions of role {role} in realm {realm}.
Show whether management permissions are enabled on {role} in {realm}.
PUT /admin/realms/{realm}/roles/{role-name}/management/permissions Set a role's management permissions · Return object stating whether role Authorization permissions have been… #
Ask an LLM
“How do I enable or disable management permissions on a role?”
“Can I set scope permissions for a role's management?”
Tell an agent
Set management permissions on role {role} in realm {realm} to {enabled}.
Enable management permissions on {role} in {realm} for resource {resource} with scope permissions {scope}.
GET /admin/realms/{realm}/roles/{role-name}/users List users with a role · Returns a stream of users that have the specified role name #
Ask an LLM
“Which users have a given role assigned?”
“Can I see every user carrying a role, not just groups?”
Tell an agent
List users that have role {role} in realm {realm}.
Show {max} users with role {role} in {realm}, brief {brief}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/keycloak:keycloak-roles-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

keycloak-roles-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Keycloak Roles API
  version: '1.0'
  description: 'Operations tagged Roles across 2 of this provider''s published API definitions: keycloak-admin-rest-api-openapi.yml, keycloak-openapi.json. Each path carries the servers of the definition it was published in.'
servers:
- url: https://{host}/admin/realms
  description: Keycloak Admin REST API
  variables:
    host:
      default: localhost:8080
      description: Keycloak server host and port
tags:


# --- truncated at 32 KB (42 KB total) ---
# Full source: https://artifacts.apis.io/keycloak/openapi/keycloak-roles-api-openapi.yml