Keycloak Role Mapper API

The Role Mapper API from Keycloak — 12 operation(s) for role mapper.

Operations 18

GET /admin/realms/{realm}/groups/{group-id}/role-mappings Get role mappings #
GET /admin/realms/{realm}/groups/{group-id}/role-mappings/realm Get realm-level role mappings #
POST /admin/realms/{realm}/groups/{group-id}/role-mappings/realm Add realm-level role mappings to the user #
DELETE /admin/realms/{realm}/groups/{group-id}/role-mappings/realm Delete realm-level role mappings #
GET /admin/realms/{realm}/groups/{group-id}/role-mappings/realm/available Get realm-level roles that can be mapped #
GET /admin/realms/{realm}/groups/{group-id}/role-mappings/realm/composite Get effective realm-level role mappings This will recurse all composite roles… #
GET /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings Get role mappings #
GET /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm Get realm-level role mappings #
POST /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm Add realm-level role mappings to the user #
DELETE /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm Delete realm-level role mappings #
GET /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm/available Get realm-level roles that can be mapped #
GET /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm/composite Get effective realm-level role mappings This will recurse all composite roles… #
GET /admin/realms/{realm}/users/{user-id}/role-mappings Get role mappings #
GET /admin/realms/{realm}/users/{user-id}/role-mappings/realm Get realm-level role mappings #
POST /admin/realms/{realm}/users/{user-id}/role-mappings/realm Add realm-level role mappings to the user #
DELETE /admin/realms/{realm}/users/{user-id}/role-mappings/realm Delete realm-level role mappings #
GET /admin/realms/{realm}/users/{user-id}/role-mappings/realm/available Get realm-level roles that can be mapped #
GET /admin/realms/{realm}/users/{user-id}/role-mappings/realm/composite Get effective realm-level role mappings This will recurse all composite roles… #

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-role-mapper-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. See our Privacy Policy and Terms.

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

OpenAPI Specification

keycloak-role-mapper-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Keycloak Admin REST Role Mapper API
  description: This is a REST API reference for the Keycloak Admin REST API.
  version: '1.0'
tags:
- name: Role Mapper
paths:
  /admin/realms/{realm}/groups/{group-id}/role-mappings:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get role mappings
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MappingsRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmGroupsByGroupIdRoleMappings
      x-operation-id-source: derived
  /admin/realms/{realm}/groups/{group-id}/role-mappings/realm:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get realm-level role mappings
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmGroupsByGroupIdRoleMappingsRealm
      x-operation-id-source: derived
    post:
      tags:
      - Role Mapper
      summary: Add realm-level role mappings to the user
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      operationId: postAdminRealmsByRealmGroupsByGroupIdRoleMappingsRealm
      x-operation-id-source: derived
    delete:
      tags:
      - Role Mapper
      summary: Delete realm-level role mappings
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      operationId: deleteAdminRealmsByRealmGroupsByGroupIdRoleMappingsRealm
      x-operation-id-source: derived
  /admin/realms/{realm}/groups/{group-id}/role-mappings/realm/available:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get realm-level roles that can be mapped
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmGroupsByGroupIdRoleMappingsRealmAvailable
      x-operation-id-source: derived
  /admin/realms/{realm}/groups/{group-id}/role-mappings/realm/composite:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get effective realm-level role mappings This will recurse all composite roles…
      parameters:
      - name: briefRepresentation
        in: query
        description: if false, return roles with their attributes
        schema:
          default: true
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmGroupsByGroupIdRoleMappingsRealmComposite
      x-operation-id-source: derived
  /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: org-id
      in: path
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get role mappings
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MappingsRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmOrganizationsByOrgIdGroupsByGroupIdRoleMappings
      x-operation-id-source: derived
  /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: org-id
      in: path
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get realm-level role mappings
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmOrganizationsByOrgIdGroupsByGroupIdRoleMappingsRealm
      x-operation-id-source: derived
    post:
      tags:
      - Role Mapper
      summary: Add realm-level role mappings to the user
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      operationId: postAdminRealmsByRealmOrganizationsByOrgIdGroupsByGroupIdRoleMappingsRealm
      x-operation-id-source: derived
    delete:
      tags:
      - Role Mapper
      summary: Delete realm-level role mappings
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      operationId: deleteAdminRealmsByRealmOrganizationsByOrgIdGroupsByGroupIdRoleMappingsRealm
      x-operation-id-source: derived
  /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm/available:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: org-id
      in: path
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get realm-level roles that can be mapped
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmOrganizationsByOrgIdGroupsByGroupIdRoleMappingsRealmAvailable
      x-operation-id-source: derived
  /admin/realms/{realm}/organizations/{org-id}/groups/{group-id}/role-mappings/realm/composite:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: org-id
      in: path
      required: true
      schema:
        type: string
    - name: group-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get effective realm-level role mappings This will recurse all composite roles…
      parameters:
      - name: briefRepresentation
        in: query
        description: if false, return roles with their attributes
        schema:
          default: true
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmOrganizationsByOrgIdGroupsByGroupIdRoleMappingsRealmComposite
      x-operation-id-source: derived
  /admin/realms/{realm}/users/{user-id}/role-mappings:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: user-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get role mappings
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MappingsRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmUsersByUserIdRoleMappings
      x-operation-id-source: derived
  /admin/realms/{realm}/users/{user-id}/role-mappings/realm:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: user-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get realm-level role mappings
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmUsersByUserIdRoleMappingsRealm
      x-operation-id-source: derived
    post:
      tags:
      - Role Mapper
      summary: Add realm-level role mappings to the user
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      operationId: postAdminRealmsByRealmUsersByUserIdRoleMappingsRealm
      x-operation-id-source: derived
    delete:
      tags:
      - Role Mapper
      summary: Delete realm-level role mappings
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/RoleRepresentation'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not Found
        '500':
          description: Internal Server Error
      operationId: deleteAdminRealmsByRealmUsersByUserIdRoleMappingsRealm
      x-operation-id-source: derived
  /admin/realms/{realm}/users/{user-id}/role-mappings/realm/available:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: user-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get realm-level roles that can be mapped
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmUsersByUserIdRoleMappingsRealmAvailable
      x-operation-id-source: derived
  /admin/realms/{realm}/users/{user-id}/role-mappings/realm/composite:
    parameters:
    - name: realm
      in: path
      description: realm name (not id!)
      required: true
      schema:
        type: string
    - name: user-id
      in: path
      required: true
      schema:
        type: string
    get:
      tags:
      - Role Mapper
      summary: Get effective realm-level role mappings This will recurse all composite roles…
      parameters:
      - name: briefRepresentation
        in: query
        description: if false, return roles with their attributes
        schema:
          default: true
          type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleRepresentation'
        '403':
          description: Forbidden
      operationId: getAdminRealmsByRealmUsersByUserIdRoleMappingsRealmComposite
      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
    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
    MappingsRepresentation:
      type: object
      properties:
        realmMappings:
          type: array
          items:
            $ref: '#/components/schemas/RoleRepresentation'
        clientMappings:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/ClientMappingsRepresentation'
    ClientMappingsRepresentation:
      type: object
      properties:
        id:
          type: string
        client:
          type: string
        mappings:
          type: array
          items:
            $ref: '#/components/schemas/RoleRepresentation'