Need help with your APIs? I offer API discovery, governance & evangelism services. Explore services →
API Evangelist API Evangelist
Discovery
Learnings
Guidance
Toolbox
Alignment
API Evangelist LLC

Keycloak Roles API

Manage realm-level and client-level roles

Keycloak Roles API is one of 6 APIs that Keycloak publishes on the APIs.io network, described by a machine-readable OpenAPI specification.

This API exposes 3 JSON Schema definitions.

Tagged areas include Roles. The published artifact set on APIs.io includes an OpenAPI specification, API documentation, an API reference, a JSON-LD context, and 3 JSON Schemas.

This API exposes 8 operations across 3 paths, and defines 1 schema. It is described by OpenAPI 3.0.3, at version 26.0.0.

Requests are made against a single base URL, https://{host}/admin/realms.

8 operations 3 paths 1 schemas 2 DELETE3 GET2 POST1 PUT

Metadata

The identity and technical contract details declared by the specification.

Specification
OpenAPI 3.0.3
API Version
26.0.0
Server
https://{host}/admin/realms
Authentication
HTTP Bearer
Contact
License
Resource Areas
1

Authentication & Security 1

Keycloak Roles API declares 1 security scheme for authenticating requests. It accepts HTTP bearer tokens (JWT) (bearerAuth). By default, every request must be authenticated.

  • bearerAuth — Access token obtained from the Keycloak token endpoint. Use the master realm admin credentials or a service account with appropriate realm-management roles.

Paths & Operations 8

Across 3 paths, the API surfaces 8 operations — 2 DELETE, 3 GET, 2 POST, 1 PUT. Each is listed below with its method, path, parameters, and response codes.

Roles 8

Manage realm-level and client-level roles

GET
/{realm}/users/{userId}/role-mappings/realm
Keycloak Get realm-level role mappings for a user
getUserRealmRoleMappings 2 params → 200
POST
/{realm}/users/{userId}/role-mappings/realm
Keycloak Add realm-level role mappings to a user
addUserRealmRoleMappings 2 params body → 204
DELETE
/{realm}/users/{userId}/role-mappings/realm
Keycloak Remove realm-level role mappings from a user
deleteUserRealmRoleMappings 2 params body → 204
GET
/{realm}/roles
Keycloak List realm-level roles
getRoles 5 params → 200
POST
/{realm}/roles
Keycloak Create a realm-level role
createRole 1 param body → 201
GET
/{realm}/roles/{roleName}
Keycloak Get a realm-level role by name
getRole 2 params → 200404
PUT
/{realm}/roles/{roleName}
Keycloak Update a realm-level role
updateRole 2 params body → 204
DELETE
/{realm}/roles/{roleName}
Keycloak Delete a realm-level role
deleteRole 2 params → 204

Schemas 1

The contract defines 1 schema that model the data the API accepts and returns. The most detailed is RoleRepresentation (8 properties). Each schema is shown below with its type and property counts.

RoleRepresentation
object
Representation of a role in Keycloak
8 properties

Specification

The full machine-readable OpenAPI contract behind this narrative.

Source

keycloak-roles-api-openapi.yml Raw ↑

Other APIs Keycloak publishes across the network.

Keycloak Clients API
Keycloak Groups API
Keycloak Identity Providers API
Keycloak Realms API
Keycloak Users API