Keycloak Roles (by ID) API

The Roles (by ID) API from Keycloak — 5 operation(s) for roles (by id).

GitHub OpenAPI

Operations 10

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 /admin/realms/{realm}/roles-by-id/{role-id} Get a role's representation · Get a specific role's representation #
Ask an LLM
“What does a specific role in my realm look like?”
“Can I fetch a role's attributes by its ID?”
Tell an agent
Get role {role_id} in realm {realm}.
Show the representation of role {role_id} in {realm}.
PUT /admin/realms/{realm}/roles-by-id/{role-id} Update a role's attributes · Update the role #
Ask an LLM
“How do I rename a role or change its description?”
“Can I make a role a composite role through its attributes?”
Tell an agent
Rename role {role_id} in realm {realm} to {name}.
Set the description of role {role_id} in {realm} to {description}.
DELETE /admin/realms/{realm}/roles-by-id/{role-id} Delete a role · Delete the role #
Ask an LLM
“How do I remove a role I no longer need?”
“Can I delete a role by its ID?”
Tell an agent destructive · confirm first
Delete role {role_id} from realm {realm}.
Remove the {role_id} role in {realm}.
GET /admin/realms/{realm}/roles-by-id/{role-id}/composites List a role's child roles · Get role's children Returns a set of role's children provided the role is a… #
Ask an LLM
“Which roles are children of a given role?”
“Can I search a role's composites by name?”
Tell an agent
List the child roles of role {role_id} in realm {realm}.
Find composites of role {role_id} in {realm} matching {search}.
POST /admin/realms/{realm}/roles-by-id/{role-id}/composites Make a role a composite role · Make the role a composite role by associating some child roles #
Ask an LLM
“How do I make a role a composite role?”
“Can I add child roles to an existing role?”
Tell an agent
Make role {role_id} in realm {realm} a composite role.
Turn {role_id} in {realm} into a composite role.
DELETE /admin/realms/{realm}/roles-by-id/{role-id}/composites Remove child roles from a composite · Remove a set of roles from the role's composite #
Ask an LLM
“How do I take child roles out of a composite role?”
“Can I remove several roles from a composite at once?”
Tell an agent destructive · confirm first
Remove the child roles from composite role {role_id} in realm {realm}.
Detach the composites of role {role_id} in {realm}.
GET /admin/realms/{realm}/roles-by-id/{role-id}/composites/clients/{clientUuid} List client-level roles in a composite · Get client-level roles for the client that are in the role's composite #
Ask an LLM
“Which client-level roles are in a composite role?”
“Can I see the client roles a composite role includes?”
Tell an agent
List client-level roles for client {clientUuid} in composite role {role_id} of realm {realm}.
Show the client roles of {clientUuid} that role {role_id} in {realm} inherits.
GET /admin/realms/{realm}/roles-by-id/{role-id}/composites/realm List realm-level roles in a composite · Get realm-level roles that are in the role's composite #
Ask an LLM
“Which realm-level roles are in a composite role?”
“Can I see the realm roles a composite role includes?”
Tell an agent
List realm-level roles in composite role {role_id} of realm {realm}.
Show the realm roles inherited by role {role_id} in {realm}.
GET /admin/realms/{realm}/roles-by-id/{role-id}/management/permissions Check a role's management permissions · Return object stating whether role Authorization permissions have been… #
Ask an LLM
“Does a role have management permissions enabled?”
“Can I check the management permissions of a role?”
Tell an agent
Check the management permissions of role {role_id} in realm {realm}.
Show whether role {role_id} in {realm} has management permissions enabled.
PUT /admin/realms/{realm}/roles-by-id/{role-id}/management/permissions Enable or disable a role's management permissions · Return object stating whether role Authorization permissions have been… #
Ask an LLM
“How do I enable management permissions for a role?”
“Can I change the scope permissions of a role's management permissions?”
Tell an agent
Set management permissions of role {role_id} in realm {realm} to {enabled}.
Set scope permissions {scopePermissions} on role {role_id} in {realm}.

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-by-id-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-by-id-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Keycloak Admin REST Roles (by ID) API
  description: This is a REST API reference for the Keycloak Admin REST API.
  version: '1.0'
tags:
- name: Roles (by ID)
paths:
  /admin/realms/{realm}/roles-by-id/{role-id}:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    get:
      tags:
      - Roles (by ID)
      summary: Get a specific role's representation
      parameters:
      - name: role-id
        in: path
        description: id of role
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmRolesByIdByRoleId
      x-operation-id-source: derived
    put:
      tags:
      - Roles (by ID)
      summary: Update the role
      parameters:
      - name: role-id
        in: path
        description: id of role
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
      operationId: putAdminRealmsByRealmRolesByIdByRoleId
      x-operation-id-source: derived
    delete:
      tags:
      - Roles (by ID)
      summary: Delete the role
      parameters:
      - name: role-id
        in: path
        description: id of role
        required: true
        schema:
          type: string
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
      operationId: deleteAdminRealmsByRealmRolesByIdByRoleId
      x-operation-id-source: derived
  /admin/realms/{realm}/roles-by-id/{role-id}/composites:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    get:
      tags:
      - Roles (by ID)
      summary: Get role's children Returns a set of role's children provided the role is a…
      parameters:
      - name: role-id
        in: path
        required: true
        schema:
          type: string
      - name: first
        in: query
        schema:
          format: int32
          type: integer
      - name: max
        in: query
        schema:
          format: int32
          type: integer
      - name: search
        in: query
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmRolesByIdByRoleIdComposites
      x-operation-id-source: derived
    post:
      tags:
      - Roles (by ID)
      summary: Make the role a composite role by associating some child roles
      parameters:
      - name: role-id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '403':
          description: Forbidden
      operationId: postAdminRealmsByRealmRolesByIdByRoleIdComposites
      x-operation-id-source: derived
    delete:
      tags:
      - Roles (by ID)
      summary: Remove a set of roles from the role's composite
      parameters:
      - name: role-id
        in: path
        description: Role id
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '403':
          description: Forbidden
      operationId: deleteAdminRealmsByRealmRolesByIdByRoleIdComposites
      x-operation-id-source: derived
  /admin/realms/{realm}/roles-by-id/{role-id}/composites/clients/{clientUuid}:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    get:
      tags:
      - Roles (by ID)
      summary: Get client-level roles for the client that are in the role's composite
      parameters:
      - name: clientUuid
        in: path
        required: true
        schema:
          type: string
      - name: role-id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
        '404':
          description: Not Found
      operationId: getAdminRealmsByRealmRolesByIdByRoleIdCompositesClientsByClientUuid
      x-operation-id-source: derived
  /admin/realms/{realm}/roles-by-id/{role-id}/composites/realm:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    get:
      tags:
      - Roles (by ID)
      summary: Get realm-level roles that are in the role's composite
      parameters:
      - name: role-id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmRolesByIdByRoleIdCompositesRealm
      x-operation-id-source: derived
  /admin/realms/{realm}/roles-by-id/{role-id}/management/permissions:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    get:
      tags:
      - Roles (by ID)
      summary: Return object stating whether role Authorization permissions have been…
      parameters:
      - name: role-id
        in: path
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagementPermissionReference'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmRolesByIdByRoleIdManagementPermissions
      x-operation-id-source: derived
    put:
      tags:
      - Roles (by ID)
      summary: Return object stating whether role Authorization permissions have been…
      parameters:
      - name: role-id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagementPermissionReference'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagementPermissionReference'
        '403':
          description: Forbidden
      operationId: putAdminRealmsByRealmRolesByIdByRoleIdManagementPermissions
      x-operation-id-source: derived
components:
  schemas:
    RoleRepresentation:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        scopeParamRequired:
          type: boolean
          deprecated: true
        composite:
          type: boolean
        composites:
          $ref: '#/components/schemas/Composites'
        clientRole:
          type: boolean
        containerId:
          type: string
        attributes:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
    ManagementPermissionReference:
      type: object
      properties:
        enabled:
          type: boolean
        resource:
          type: string
        scopePermissions:
          type: object
          additionalProperties:
            type: string
    Composites:
      type: object
      properties:
        realm:
          uniqueItems: true
          type: array
          items:
            type: string
        client:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        application:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          deprecated: true