Keycloak
Administer Keycloak realms: users, bulk import, groups, roles, clients and sessions. Typical uses: create accounts from an HR file, give or remove roles, log a user out.
keycloak pingkeycloak infokeycloak realm_createkeycloak realm_createkeycloak realmskeycloak realm_getkeycloak realm_deletekeycloak group_createkeycloak group_createkeycloak user_createkeycloak import_userskeycloak import_userskeycloak userskeycloak userskeycloak user_getkeycloak user_updatekeycloak user_password_resetkeycloak user_password_resetkeycloak groupskeycloak groupskeycloak group_add_userkeycloak group_memberskeycloak group_memberskeycloak user_groupskeycloak group_remove_userkeycloak client_createkeycloak clientskeycloak client_getkeycloak role_createkeycloak role_createkeycloak roleskeycloak role_grantkeycloak user_roleskeycloak user_roleskeycloak role_revokekeycloak roleskeycloak role_grantkeycloak role_revokekeycloak sessionskeycloak logoutkeycloak requestkeycloak requestkeycloak user_deletekeycloak group_deletekeycloak client_delete

keycloak ping <config>


Description

    Test the URL, the credentials and the rights on the realm of the configuration. Returns {ok, realm}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
keycloak ping "{\"url\": \"http://127.0.0.1:8080\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}"
mentdb
{"ok": true, "realm": "master"}

keycloak info <config>


Description

    The server (an administrator of the realm master): {version, server_time, uptime_seconds, java_version, java_vendor, os, used_memory_mb, features}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
keycloak info "{\"url\": \"http://127.0.0.1:8080\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}"
mentdb
{"version": "26.8.2", "server_time": "Tue Nov 17 20:00:33 RET 2026", "uptime_seconds": 699, "java_version": "21.0.13", "java_vendor": "Eclipse Adoptium", "os": "Mac OS X 14.4", "used_memory_mb": 100, "features": ["PASSKEYS", "IMPERSONATION", "DEVICE_FLOW", "LOGIN_FAILURES_V2", "CIBA", "AUTHORIZATION", "HOSTNAME_V2", "PAR", "PERSISTENT_USER_SESSIONS", "ADMIN_API", "USER_EVENT_METRICS", "WEB_AUTHN", "STEP_UP_AUTHENTICATION", "JWT_AUTHORIZATION_GRANT", "SCIM_API", "DPOP", "ADMIN_FINE_GRAINED_AUTHZ_V2", "ADMIN_V2", "WORKFLOWS", "KERBEROS", "LOGIN_V2", "STEP_UP_AUTHENTICATION_SAML", "TWITTER_BROKER", "ROLLING_UPDATES_V2", "RECOVERY_CODES", "UPDATE_EMAIL", "IDENTITY_BROKERING_API_V1", "CLIENT_SECRET_ROTATION", "LOG_MDC", "HTTP_CLIENT", "KUBERNETES_SERVICE_ACCOUNTS", "ACCOUNT_API", "ORGANIZATION", "CLIENT_AUTH_FEDERATED", "CLIENT_POLICIES", "OPENTELEMETRY", "TOKEN_EXCHANGE_STANDARD_V2", "ACCOUNT_V3"]}

keycloak realm_create <config> <realm>


Description

    Create a realm (enabled). Returns {created}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    realm:   The name of the realm - String - required
admin
keycloak realm_create "{\"url\": \"http://127.0.0.1:8080\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "acme"
mentdb
{"created": "acme"}

keycloak realm_create <config> <realm> <options_json>


Description

    Create a realm with settings: any field of the realm representation (displayName, registrationAllowed, loginWithEmailAllowed, passwordPolicy, accessTokenLifespan, smtpServer...)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    realm:   The name of the realm - String - required
    options_json:   The options - String - required
admin
keycloak realm_create "{\"url\": \"http://127.0.0.1:8080\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "partners" "{\"displayName\": \"Partners\", \"passwordPolicy\": \"length(10)\", \"loginWithEmailAllowed\": true}"
mentdb
{"created": "partners"}

keycloak realms <config>


Description

    The realms the account can see: rows {id, realm, enabled, display_name}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
keycloak realms "{\"url\": \"http://127.0.0.1:8080\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}"
mentdb
[{"id": "6f4f213a-9943-4c1e-9899-5f84959b74ba", "realm": "master", "enabled": true, "display_name": "Keycloak"}, {"id": "a3e427d2-aea0-49e6-9589-352bea5e5204", "realm": "acme", "enabled": true, "display_name": null}, {"id": "ece48988-04de-4977-999f-f51d22398dfc", "realm": "partners", "enabled": true, "display_name": "Partners"}]

keycloak realm_get <config> <realm>


Description

    The whole representation of a realm (all its settings); null when it does not exist

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    realm:   The name of the realm - String - required
admin
keycloak realm_get "{\"url\": \"http://127.0.0.1:8080\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "nothing"
mentdb
null

keycloak realm_delete <config> <realm>


Description

    Delete a realm with its users, groups and clients (master is refused). Returns {deleted: 1}, or 0 when it does not exist

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    realm:   The name of the realm - String - required
admin
keycloak realm_delete "{\"url\": \"http://127.0.0.1:8080\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "partners"
mentdb
{"deleted": 1}

keycloak group_create <config> <name>


Description

    Create a top-level group. Returns {id, name, path}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    name:   The name of the group (without /) - String - required
admin
keycloak group_create "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "staff"
mentdb
{"id": "e827f098-4bb1-4f9b-b290-12cd9c4b6d9e", "name": "staff", "path": "/staff"}

keycloak group_create <config> <name> <options_json>


Description

    Create a group with options: parent (the parent group: id, path or name), attributes ({"name": ["value"]})

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    name:   The name of the group (without /) - String - required
    options_json:   The options - String - required
admin
keycloak group_create "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "sales" "{\"parent\": \"/staff\", \"attributes\": {\"cost_center\": [\"CC-42\"]}}"
mentdb
{"id": "0701ce67-66b2-44c8-a92d-d0357083ba34", "name": "sales", "path": "/staff/sales"}

keycloak user_create <config> <user_json>


Description

    Create a user from a JSON object: username (required), email, first_name, last_name, enabled (true), email_verified, attributes, groups (paths), required_actions, password and temporary (true: the user must change it at the first login). Returns {id, username}; the password is never echoed

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user_json:   The user as a JSON object - String - required
admin
keycloak user_create "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "{\"username\": \"zoe\", \"email\": \"zoe@example.com\", \"first_name\": \"Zoé\", \"last_name\": \"Martin\", \"groups\": [\"/staff/sales\"], \"password\": \"Welcome-2026!\", \"temporary\": true}"
mentdb
{"id": "a2bd67c3-95a2-4719-afd5-1a6f418e7f3d", "username": "zoe"}

keycloak import_users <config> <rows_json>


Description

    Create users from MQL rows (same fields as keycloak user_create), one request per row. An existing username is skipped. Returns {created, skipped, errors: [{row, username, error}]}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    rows_json:   The users as a JSON array of objects - String - required
admin
keycloak import_users "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "[{\"username\": \"marc\", \"email\": \"marc@example.com\", \"first_name\": \"Marc\", \"last_name\": \"Dupont\"}, {\"username\": \"zoe\"}, {\"email\": \"nobody@example.com\"}]"
mentdb
{"created": 1, "skipped": 1, "errors": [{"row": 3, "username": null, "error": "the field 'username' is required"}]}

keycloak import_users <config> <rows_json> <options_json>


Description

    Import with options: skip_existing (true; false: an existing username is an error), temporary (true: the default of the rows with a password), max_errors (1000: the import stops beyond)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    rows_json:   The users as a JSON array of objects - String - required
    options_json:   The options - String - required
admin
keycloak import_users "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "[{\"username\": \"ana\", \"email\": \"ana@example.com\", \"first_name\": \"Ana\", \"last_name\": \"Silva\", \"password\": \"Ana-2026-pass\"}, {\"username\": \"leo\", \"email\": \"leo@example.com\", \"first_name\": \"Léo\", \"last_name\": \"Hoarau\", \"enabled\": false}]" "{\"temporary\": false}"
mentdb
{"created": 2, "skipped": 0, "errors": []}

keycloak users <config>


Description

    The users of the realm as rows {id, username, email, first_name, last_name, enabled, email_verified, created} (100 at most)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
keycloak users "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}"
mentdb
[{"id": "9a9bdab3-f3fb-4c51-9f51-e39037f9f2f7", "username": "ana", "email": "ana@example.com", "first_name": "Ana", "last_name": "Silva", "enabled": true, "email_verified": false, "created": "2026-11-17T16:00:33.553Z"}, {"id": "9e687aca-9872-46eb-b3e3-7479da9848cb", "username": "leo", "email": "leo@example.com", "first_name": "Léo", "last_name": "Hoarau", "enabled": false, "email_verified": false, "created": "2026-11-17T16:00:33.571Z"}, {"id": "febbf573-9372-4d2e-9891-fd5aa0984103", "username": "marc", "email": "marc@example.com", "first_name": "Marc", "last_name": "Dupont", "enabled": true, "email_verified": false, "created": "2026-11-17T16:00:33.546Z"}, {"id": "a2bd67c3-95a2-4719-afd5-1a6f418e7f3d", "username": "zoe", "email": "zoe@example.com", "first_name": "Zoé", "last_name": "Martin", "enabled": true, "email_verified": false, "created": "2026-11-17T16:00:33.523Z"}]

keycloak users <config> <filter_json>


Description

    Search the users: search (a part of the username, email, first or last name), username, email, first_name, last_name, exact (true: whole values), enabled, limit (100, 100000 at most), offset, full (true: the whole Keycloak representation)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    filter_json:   The filter as a JSON object - String - required
admin
keycloak users "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "{\"search\": \"mar\", \"limit\": 10}"
mentdb
[{"id": "febbf573-9372-4d2e-9891-fd5aa0984103", "username": "marc", "email": "marc@example.com", "first_name": "Marc", "last_name": "Dupont", "enabled": true, "email_verified": false, "created": "2026-11-17T16:00:33.546Z"}, {"id": "a2bd67c3-95a2-4719-afd5-1a6f418e7f3d", "username": "zoe", "email": "zoe@example.com", "first_name": "Zoé", "last_name": "Martin", "enabled": true, "email_verified": false, "created": "2026-11-17T16:00:33.523Z"}]
the disabled users (fixed result: real Keycloak 26.8.2)
admin
keycloak users "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "{\"enabled\": false}"
mentdb
[{"id": "9e687aca-9872-46eb-b3e3-7479da9848cb", "username": "leo", "email": "leo@example.com", "first_name": "Léo", "last_name": "Hoarau", "enabled": false, "email_verified": false, "created": "2026-11-17T16:00:33.571Z"}]

keycloak user_get <config> <user>


Description

    The whole representation of a user (attributes, required actions, rights of the caller); null when it does not exist

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak user_get "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "zoe"
mentdb
{"id": "a2bd67c3-95a2-4719-afd5-1a6f418e7f3d", "username": "zoe", "firstName": "Zoé", "lastName": "Martin", "email": "zoe@example.com", "emailVerified": false, "enabled": true, "createdTimestamp": 1794931233523, "totp": false, "disableableCredentialTypes": [], "requiredActions": ["UPDATE_PASSWORD"], "notBefore": 0, "access": {"manageGroupMembership": true, "delegate": false, "resetPassword": true, "view": true, "mapRoles": true, "impersonate": true, "manage": true}}
no such user (fixed result: real Keycloak 26.8.2)
admin
keycloak user_get "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "nobody"
mentdb
null

keycloak user_update <config> <user> <changes_json>


Description

    Change fields of a user (the other fields stay; in attributes, a null value removes the attribute). A password in the changes resets it (temporary: true by default). Returns {updated}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    changes_json:   The fields to change as a JSON object - String - required
admin
keycloak user_update "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "marc" "{\"last_name\": \"Dupont-Rivière\", \"email_verified\": true}"
mentdb
{"updated": "febbf573-9372-4d2e-9891-fd5aa0984103"}
disable a user (fixed result: real Keycloak 26.8.2)
admin
keycloak user_update "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "leo" "{\"enabled\": false}"
mentdb
{"updated": "9e687aca-9872-46eb-b3e3-7479da9848cb"}

keycloak user_password_reset <config> <user> <password>


Description

    Set a new temporary password (the user changes it at the next login). Returns {id, temporary}; the password is never echoed

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    password:   The new password - String - required
admin
keycloak user_password_reset "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "marc" "Reset-2026-x"
mentdb
{"id": "febbf573-9372-4d2e-9891-fd5aa0984103", "temporary": true}

keycloak user_password_reset <config> <user> <password> <options_json>


Description

    Set a new password with options: temporary (true)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    password:   The new password - String - required
    options_json:   The options - String - required
admin
keycloak user_password_reset "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "ana" "Ana-Final-2026" "{\"temporary\": false}"
mentdb
{"id": "9a9bdab3-f3fb-4c51-9f51-e39037f9f2f7", "temporary": false}

keycloak groups <config>


Description

    Every group with its sub-groups, flattened: rows {id, name, path, parent_id} (10000 at most)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
keycloak groups "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}"
mentdb
[{"id": "e827f098-4bb1-4f9b-b290-12cd9c4b6d9e", "name": "staff", "path": "/staff", "parent_id": null}, {"id": "0701ce67-66b2-44c8-a92d-d0357083ba34", "name": "sales", "path": "/staff/sales", "parent_id": "e827f098-4bb1-4f9b-b290-12cd9c4b6d9e"}]

keycloak groups <config> <options_json>


Description

    The groups with options: search (a part of the name), limit (10000)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    options_json:   The options - String - required
admin
keycloak groups "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "{\"search\": \"sal\"}"
mentdb
[{"id": "e827f098-4bb1-4f9b-b290-12cd9c4b6d9e", "name": "staff", "path": "/staff", "parent_id": null}, {"id": "0701ce67-66b2-44c8-a92d-d0357083ba34", "name": "sales", "path": "/staff/sales", "parent_id": "e827f098-4bb1-4f9b-b290-12cd9c4b6d9e"}]

keycloak group_add_user <config> <group> <user>


Description

    Add a user to a group. Returns {added, user, group}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    group:   The group: its id (UUID), its path (/staff/sales) or the name of a top-level group - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak group_add_user "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "/staff/sales" "marc"
mentdb
{"added": true, "user": "febbf573-9372-4d2e-9891-fd5aa0984103", "group": "/staff/sales"}

keycloak group_members <config> <group>


Description

    The direct members of a group as user rows (1000 at most)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    group:   The group: its id (UUID), its path (/staff/sales) or the name of a top-level group - String - required
admin
keycloak group_members "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "/staff/sales"
mentdb
[{"id": "febbf573-9372-4d2e-9891-fd5aa0984103", "username": "marc", "email": "marc@example.com", "first_name": "Marc", "last_name": "Dupont-Rivière", "enabled": true, "email_verified": true, "created": "2026-11-17T16:00:33.546Z"}, {"id": "a2bd67c3-95a2-4719-afd5-1a6f418e7f3d", "username": "zoe", "email": "zoe@example.com", "first_name": "Zoé", "last_name": "Martin", "enabled": true, "email_verified": false, "created": "2026-11-17T16:00:33.523Z"}]

keycloak group_members <config> <group> <options_json>


Description

    The members with options: limit (1000, 100000 at most)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    group:   The group: its id (UUID), its path (/staff/sales) or the name of a top-level group - String - required
    options_json:   The options - String - required
admin
keycloak group_members "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "/staff/sales" "{\"limit\": 1}"
mentdb
[{"id": "febbf573-9372-4d2e-9891-fd5aa0984103", "username": "marc", "email": "marc@example.com", "first_name": "Marc", "last_name": "Dupont-Rivière", "enabled": true, "email_verified": true, "created": "2026-11-17T16:00:33.546Z"}]

keycloak user_groups <config> <user>


Description

    The groups of a user: rows {id, name, path}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak user_groups "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "marc"
mentdb
[{"id": "0701ce67-66b2-44c8-a92d-d0357083ba34", "name": "sales", "path": "/staff/sales"}]

keycloak group_remove_user <config> <group> <user>


Description

    Remove a user from a group. Returns {removed, user, group}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    group:   The group: its id (UUID), its path (/staff/sales) or the name of a top-level group - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak group_remove_user "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "/staff/sales" "marc"
mentdb
{"removed": true, "user": "febbf573-9372-4d2e-9891-fd5aa0984103", "group": "/staff/sales"}

keycloak client_create <config> <client_json>


Description

    Create a client from its representation: clientId (required), name, publicClient, serviceAccountsEnabled, standardFlowEnabled, directAccessGrantsEnabled, redirectUris, webOrigins, attributes... Returns {id, client_id}. The secret of a confidential client is generated by Keycloak: read it with keycloak request GET /admin/realms//clients//client-secret

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    client_json:   The client as a JSON object - String - required
admin
keycloak client_create "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "{\"clientId\": \"billing-web\", \"name\": \"Billing\", \"publicClient\": false, \"standardFlowEnabled\": true, \"redirectUris\": [\"https://billing.example.com/*\"]}"
mentdb
{"id": "5baa0370-a3e5-4b28-9fd9-63aab63710eb", "client_id": "billing-web"}

keycloak clients <config>


Description

    The clients of the realm: rows {id, client_id, name, enabled, protocol, public_client, service_accounts, redirect_uris}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
keycloak clients "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}"
mentdb
[{"id": "9ac81d0e-6981-4d45-b71f-1fd083c5c610", "client_id": "account", "name": "${client_account}", "enabled": true, "protocol": "openid-connect", "public_client": true, "service_accounts": false, "redirect_uris": ["/realms/acme/account/*"]}, {"id": "76b6a325-c75a-4c8d-ac5d-5ba1e83e0835", "client_id": "account-console", "name": "${client_account-console}", "enabled": true, "protocol": "openid-connect", "public_client": true, "service_accounts": false, "redirect_uris": ["/realms/acme/account/*"]}, {"id": "8dfa3aa0-f967-4403-8f9c-8ecf2fe5e321", "client_id": "admin-cli", "name": "${client_admin-cli}", "enabled": true, "protocol": "openid-connect", "public_client": true, "service_accounts": false, "redirect_uris": []}, {"id": "5baa0370-a3e5-4b28-9fd9-63aab63710eb", "client_id": "billing-web", "name": "Billing", "enabled": true, "protocol": "openid-connect", "public_client": false, "service_accounts": false, "redirect_uris": ["https://billing.example.com/*"]}, {"id": "b80311e7-4f3a-40fe-81f6-685dfb4caadb", "client_id": "broker", "name": "${client_broker}", "enabled": true, "protocol": "openid-connect", "public_client": false, "service_accounts": false, "redirect_uris": []}, {"id": "3ff1a2a2-900a-43c4-9694-004b3bb8e138", "client_id": "realm-management", "name": "${client_realm-management}", "enabled": true, "protocol": "openid-connect", "public_client": false, "service_accounts": false, "redirect_uris": []}, {"id": "0e353453-fc4d-4049-8fd2-d170aedd142c", "client_id": "security-admin-console", "name": "${client_security-admin-console}", "enabled": true, "protocol": "openid-connect", "public_client": true, "service_accounts": false, "redirect_uris": ["/admin/acme/console/*"]}]

keycloak client_get <config> <client_id>


Description

    The representation of a client, without its secret; null when it does not exist

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    client_id:   The clientId of the client (not its internal id) - String - required
admin
keycloak client_get "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "billing-web"
mentdb
{"id": "5baa0370-a3e5-4b28-9fd9-63aab63710eb", "clientId": "billing-web", "name": "Billing", "surrogateAuthRequired": false, "enabled": true, "alwaysDisplayInConsole": false, "clientAuthenticatorType": "client-secret", "redirectUris": ["https://billing.example.com/*"], "webOrigins": ["https://billing.example.com"], "notBefore": 0, "bearerOnly": false, "consentRequired": false, "standardFlowEnabled": true, "implicitFlowEnabled": false, "directAccessGrantsEnabled": false, "serviceAccountsEnabled": false, "publicClient": false, "frontchannelLogout": false, "protocol": "openid-connect", "attributes": {"realm_client": "false", "client.secret.creation.time": "1794931233"}, "authenticationFlowBindingOverrides": {}, "fullScopeAllowed": true, "nodeReRegistrationTimeout": -1, "defaultClientScopes": ["web-origins", "acr", "profile", "roles", "basic", "email"], "optionalClientScopes": ["address", "phone", "offline_access", "organization", "microprofile-jwt"], "access": {"view": true, "configure": true, "manage": true}}

keycloak role_create <config> <name>


Description

    Create a realm role. Returns {created, client}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    name:   The name of the role - String - required
admin
keycloak role_create "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "auditor"
mentdb
{"created": "auditor", "client": null}

keycloak role_create <config> <name> <options_json>


Description

    Create a role with options: client (the clientId: a client role), description, attributes

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    name:   The name of the role - String - required
    options_json:   The options - String - required
admin
keycloak role_create "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "accountant" "{\"description\": \"Reads and validates the invoices\"}"
mentdb
{"created": "accountant", "client": null}
a role of a client (fixed result: real Keycloak 26.8.2)
admin
keycloak role_create "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "invoice-reader" "{\"client\": \"billing-web\", \"description\": \"Reads the invoices in the Billing application\"}"
mentdb
{"created": "invoice-reader", "client": "billing-web"}

keycloak roles <config>


Description

    The realm roles: rows {role, client, id, composite, description}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
admin
keycloak roles "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}"
mentdb
[{"role": "accountant", "client": null, "id": "52a0203c-dfd6-4be0-b3a1-bf8d0dd4a860", "composite": false, "description": "Reads and validates the invoices"}, {"role": "auditor", "client": null, "id": "69ab975b-db69-48a2-af0d-4d593b785661", "composite": false, "description": null}, {"role": "default-roles-acme", "client": null, "id": "613c7c4b-8466-4106-a284-fa251d8614bf", "composite": true, "description": "${role_default-roles}"}, {"role": "offline_access", "client": null, "id": "389693b6-1ceb-4107-99cb-55c5203b65f8", "composite": false, "description": "${role_offline-access}"}, {"role": "uma_authorization", "client": null, "id": "37c7f03a-a289-4e6c-a365-544fa75b390e", "composite": false, "description": "${role_uma_authorization}"}]

keycloak role_grant <config> <user> <role>


Description

    Give realm roles to a user (a name or a JSON array of names). Returns {granted, user, client}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    role:   A role name, or a JSON array of role names - String - required
admin
keycloak role_grant "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "marc" "[\"auditor\", \"accountant\"]"
mentdb
{"granted": ["auditor", "accountant"], "user": "febbf573-9372-4d2e-9891-fd5aa0984103", "client": null}

keycloak user_roles <config> <user>


Description

    The roles given directly to a user, of the realm (client null) and of the clients: rows {role, client, id, composite, description}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak user_roles "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "marc"
mentdb
[{"role": "accountant", "client": null, "id": "52a0203c-dfd6-4be0-b3a1-bf8d0dd4a860", "composite": false, "description": "Reads and validates the invoices"}, {"role": "default-roles-acme", "client": null, "id": "613c7c4b-8466-4106-a284-fa251d8614bf", "composite": true, "description": "${role_default-roles}"}, {"role": "auditor", "client": null, "id": "69ab975b-db69-48a2-af0d-4d593b785661", "composite": false, "description": null}]

keycloak user_roles <config> <user> <options_json>


Description

    The roles with options: effective (true: the realm roles with those of the composite roles and of the groups)

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    options_json:   The options - String - required
admin
keycloak user_roles "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "marc" "{\"effective\": true}"
mentdb
[{"role": "accountant", "client": null, "id": "52a0203c-dfd6-4be0-b3a1-bf8d0dd4a860", "composite": false, "description": "Reads and validates the invoices"}, {"role": "default-roles-acme", "client": null, "id": "613c7c4b-8466-4106-a284-fa251d8614bf", "composite": true, "description": "${role_default-roles}"}, {"role": "offline_access", "client": null, "id": "389693b6-1ceb-4107-99cb-55c5203b65f8", "composite": false, "description": "${role_offline-access}"}, {"role": "uma_authorization", "client": null, "id": "37c7f03a-a289-4e6c-a365-544fa75b390e", "composite": false, "description": "${role_uma_authorization}"}, {"role": "auditor", "client": null, "id": "69ab975b-db69-48a2-af0d-4d593b785661", "composite": false, "description": null}]

keycloak role_revoke <config> <user> <role>


Description

    Remove realm roles from a user. Returns {revoked, user, client}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    role:   A role name, or a JSON array of role names - String - required
admin
keycloak role_revoke "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "marc" "auditor"
mentdb
{"revoked": ["auditor"], "user": "febbf573-9372-4d2e-9891-fd5aa0984103", "client": null}

keycloak roles <config> <client_id>


Description

    The roles of a client

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    client_id:   The clientId of the client (not its internal id) - String - required
admin
keycloak roles "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "billing-web"
mentdb
[{"role": "invoice-reader", "client": "billing-web", "id": "da34a15e-3f20-49bf-a6c9-3aa5ab72bbf0", "composite": false, "description": "Reads the invoices in the Billing application"}]

keycloak role_grant <config> <user> <role> <client_id>


Description

    Give client roles to a user

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    role:   A role name, or a JSON array of role names - String - required
    client_id:   The clientId of the client (not its internal id) - String - required
admin
keycloak role_grant "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "zoe" "invoice-reader" "billing-web"
mentdb
{"granted": ["invoice-reader"], "user": "a2bd67c3-95a2-4719-afd5-1a6f418e7f3d", "client": "billing-web"}

keycloak role_revoke <config> <user> <role> <client_id>


Description

    Remove client roles from a user

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
    role:   A role name, or a JSON array of role names - String - required
    client_id:   The clientId of the client (not its internal id) - String - required
admin
keycloak role_revoke "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "zoe" "invoice-reader" "billing-web"
mentdb
{"revoked": ["invoice-reader"], "user": "a2bd67c3-95a2-4719-afd5-1a6f418e7f3d", "client": "billing-web"}

keycloak sessions <config> <user>


Description

    The open sessions of a user: rows {id, username, ip_address, start, last_access, clients}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak sessions "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "ana"
mentdb
[{"id": "gS2S0DWlPneedfmTedGlO9N7", "username": "ana", "ip_address": "127.0.0.1", "start": "2026-11-17T16:00:34Z", "last_access": "2026-11-17T16:00:34Z", "clients": ["admin-cli"]}]

keycloak logout <config> <user>


Description

    Close every session of a user (the refresh tokens stop working). Returns {logged_out}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak logout "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "ana"
mentdb
{"logged_out": "9a9bdab3-f3fb-4c51-9f51-e39037f9f2f7"}

keycloak request <config> <method> <path>


Description

    Any call of the REST API with the token: the path is relative to the URL (it starts with /admin or /realms), without . or .. segments. Returns the body of the answer, or {status} when it is empty

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    method:   GET, POST, PUT, DELETE, PATCH or HEAD - String - required
    path:   The path, with its query string - String - required
admin
keycloak request "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "GET" "/admin/realms/acme/users/count"
mentdb
4

keycloak request <config> <method> <path> <body_json>


Description

    A call with a JSON body

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    method:   GET, POST, PUT, DELETE, PATCH or HEAD - String - required
    path:   The path, with its query string - String - required
    body_json:   The JSON body - String - required
admin
keycloak request "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "POST" "/admin/realms/acme/client-scopes" "{\"name\": \"billing\", \"protocol\": \"openid-connect\"}"
mentdb
{"status": 201}

keycloak user_delete <config> <user>


Description

    Delete a user. Returns {deleted: 1}, or 0 when it does not exist

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    user:   The user: its id (UUID) or its username - String - required
admin
keycloak user_delete "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "leo"
mentdb
{"deleted": 1}

keycloak group_delete <config> <group>


Description

    Delete a group and its sub-groups (the users stay). Returns {deleted}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    group:   The group: its id (UUID), its path (/staff/sales) or the name of a top-level group - String - required
admin
keycloak group_delete "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "/staff"
mentdb
{"deleted": 1}

keycloak client_delete <config> <client_id>


Description

    Delete a client. Returns {deleted}

Parameters

    config:   The Keycloak configuration as JSON: url (http://127.0.0.1:8080, with /auth for the old WildFly distributions), realm (master: the realm the functions work on), auth_realm (master: the realm of the account that signs in), then an administrator with username and password (password grant, client_id admin-cli by default), or a service account with client_id and client_secret (client credentials grant); scope (the scopes asked for the token), ca_file (a PEM file of a private CA, with https), allow_plain (false: a secret over http is refused unless the host is localhost, 127.0.0.1 or ::1), timeout_ms (30000), max_bytes (64 MB, the largest answer) - String - required
    client_id:   The clientId of the client (not its internal id) - String - required
admin
keycloak client_delete "{\"url\": \"http://127.0.0.1:8080\", \"realm\": \"acme\", \"username\": \"admin\", \"password\": \"kc_admin_password\"}" "billing-web"
mentdb
{"deleted": 1}