canonical: https://jentic.com/apis/keycloak.org/keycloak

# Keycloak Admin REST API

Jentic publishes the only available OpenAPI specification for Keycloak Admin REST API, keeping it validated and agent-ready. The Keycloak Admin REST API is the management surface for Keycloak's open-source identity and access management server. The 387 endpoints cover the full admin surface: realms, clients, client scopes, role mappings, users, groups, organisations, identity providers, authentication flows, key management, components, protocol mappers, attack detection, and client initial-access tokens. Most endpoints sit under /admin/realms/{realm} and accept JSON bodies that map to Keycloak's representation classes. Although this spec does not declare a security scheme, every Keycloak admin call in practice requires a bearer access token issued by Keycloak's own OIDC endpoints.

## For AI agents

Administer realms, clients, users, groups, organisations, identity providers, authentication flows, keys, and protocol mappers across the full 387-endpoint Keycloak admin surface.

## Scope

Does not handle end-user login UX, token issuance, or social sign-in flows - use for Keycloak server-side administration of realms, users, clients, and policies only.

## Capabilities

- Create, read, update, and delete realms and inspect realm-level admin events
- Manage clients, client scopes, protocol mappers, and per-client role mappings
- Manage users, groups, and organisations along with their membership and role mappings
- Configure identity providers and the authentication flow tree for each realm
- Read and rotate keys and components used by the realm
- Inspect and reset brute-force attack-detection state per user or per realm

## Use cases

### Multi-Tenant Realm Provisioning

Create a fresh realm per tenant when onboarding a new customer, including the clients, default groups, and identity providers each tenant needs. The /admin/realms endpoints support full CRUD and the per-realm subtrees (clients, groups, identity providers) configure everything else. Provisioning a tenant becomes a deterministic script rather than a manual checklist.

Example prompt: POST /admin/realms with the realm representation, then POST clients, identity providers, and groups under /admin/realms/{realm}

### Identity Federation Configuration

Wire up SAML or OIDC identity providers per realm by calling the /identity-provider endpoints under /admin/realms/{realm}. The same set of endpoints supports listing, reading, updating, and removing providers, plus mapping their incoming claims onto Keycloak attributes. This makes federation changes auditable through code review rather than admin-console clicks.

Example prompt: POST /admin/realms/{realm}/identity-provider/instances with the new SAML or OIDC provider representation

### Compliance and Admin-Event Auditing

Pull the realm admin event stream periodically to feed a SIEM or audit pipeline. The /admin-events endpoint returns a paginated list of administrative actions taken inside the realm, and the related delete endpoint clears the audit buffer when needed. Combined with user role-mapping reads, this builds a complete picture of who has what access and how it changed.

Example prompt: GET /admin/realms/{realm}/admin-events with a date filter, paginate through the result, and forward the events to the SIEM

### AI Agent Keycloak Operations

An AI agent that helps an identity team manage Keycloak uses Jentic to find the correct admin operation for each request - list a realm's clients, unlock a user, configure a new identity provider - without manually walking a 387-endpoint spec. Jentic injects the bearer token per call and returns a focused operation schema for the agent to fill in.

Example prompt: Through Jentic, search for 'list keycloak clients', load GET /admin/realms/{realm}/clients, and execute it for the supplied realm

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | /admin/realms | List all realms |
| POST | /admin/realms | Create a new realm |
| GET | /admin/realms/{realm} | Read a realm by name |
| PUT | /admin/realms/{realm} | Update a realm |
| DELETE | /admin/realms/{realm} | Delete a realm |
| GET | /admin/realms/{realm}/admin-events | Read realm admin events |
| DELETE | /admin/realms/{realm}/attack-detection/brute-force/users/{userId} | Clear brute-force lockout for a user |
| GET | /admin/realms/{realm}/authentication/authenticator-providers | List authenticator providers |

## Key resources

- **Realms** — Manage realms and their admin-event stream
- **Clients and Client Scopes** — Manage clients, client scopes, and protocol mappers
- **Users, Groups, and Organisations** — Manage users, groups, organisations, and role mappings
- **Identity Providers** — Configure SAML and OIDC identity providers per realm
- **Authentication and Keys** — Read authentication flows, authenticator providers, and key components
- **Attack Detection** — Inspect and reset brute-force lockout state per user or realm-wide

## Why Jentic

- **Setup:** Wiring this Keycloak Admin REST API by hand means supplying admin credentials, holding the bearer, and finding the right route among hundreds of realm, user, and client paths yourself. Through Jentic you install once, import the Keycloak Admin REST API from the API Directory, store the admin credential once, and your agent calls it.
- **Permission scoping:** Keycloak puts the realm in the URL path (/admin/realms/{realm}/...), so a rule can pin your agent to one realm: it can read that realm's config and admin events and nothing else. You choose the operations it may call, so destructive ones like deleting the realm or clearing brute-force records are not included unless you add them.
- **Credential handling:** Your Keycloak admin credentials are stored once, encrypted, by your own Jentic One instance and injected at execution time. Jentic exchanges them at the OIDC token endpoint, so client_secret values never enter the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'unlock a Keycloak user' or 'list clients in a realm', and Jentic returns the matching admin operation with its schema so the agent calls the right endpoint without walking the full surface.

## Related APIs

- **Auth0** — Auth0 is a managed identity platform with similar realm, user, and role concepts but no self-hosted option.
- **Okta** — Okta is a managed enterprise identity provider covering users, groups, applications, and policies.
- **Akeyless** — Akeyless stores the client_secret values that Keycloak clients use to authenticate.

## FAQ

### Why is there no official OpenAPI spec for Keycloak Admin REST API?

Keycloak does not publish a curated OpenAPI specification for its admin API as part of its release artefacts. Jentic generates and maintains this spec so that AI agents and developers can call Keycloak Admin REST API via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Keycloak Admin REST API use?

Bearer access tokens issued by Keycloak's own OIDC token endpoint. Although the OpenAPI spec does not declare the security scheme explicitly, every admin call requires the Authorization header. Through Jentic the client_id, client_secret, and admin credentials live in the encrypted vault and Jentic mints the bearer per call.

### Can I list every client in a realm with the Keycloak Admin REST API?

Yes. GET /admin/realms/{realm}/clients returns the clients configured in the realm. Use GET /admin/realms/{realm}/clients/{id} to drill into a single client and its protocol mappers, role mappings, and client scopes.

### What are the rate limits for the Keycloak Admin REST API?

Keycloak does not enforce a fixed numeric rate limit out of the box - throughput is bounded by the JVM and database behind your deployment. For high-volume admin tooling, batch reads and avoid hot-looping on /admin/realms/{realm}/admin-events.

### How do I create a new realm through Jentic?

Search Jentic for 'create a keycloak realm' to find POST /admin/realms, load its schema, and execute it with the realm representation. The Jentic flow is pip install jentic, then client.search, client.load, and client.execute.

### Does this spec cover organisations and identity providers?

Yes. The /admin/realms/{realm}/organizations endpoints manage organisations within a realm, and /admin/realms/{realm}/identity-provider/instances manages SAML and OIDC identity providers. Both are part of the 387-endpoint surface.

### How do I clear a brute-force lockout via the API?

DELETE /admin/realms/{realm}/attack-detection/brute-force/users/{userId} resets brute-force state for one user. The realm-wide endpoint at the same root clears the entire bucket for all users in the realm.

### Can I limit what my agent is allowed to do with the Keycloak Admin REST API?

Yes. Because Jentic One is self-hosted, you set the rules that decide which Keycloak operations and credentials your agent may use. Keycloak puts the realm in the URL path (/admin/realms/{realm}/...), so a rule can pin the agent to a single realm, letting it read that realm's configuration and admin events while touching nothing else. You also pick the exact operations it may call, so destructive ones like DELETE /admin/realms/{realm} or clearing brute-force records under /attack-detection are excluded unless you add them.
