Realm Users

Create a realm user

Creates a user in the specified realm.

Required scope: realm-users:write

post/clusters/{cluster_id}/realms/{realm_name}/users

Request

  • Base URL: http://localhost:8000
  • URL: http://localhost:8000/clusters/{cluster_id}/realms/{realm_name}/users
  • Auth: API key in header API-Key

Path parameters

cluster_idstring uuid required
realm_namestring required

Keycloak realm name (not ID). Must start with a letter; allows letters, digits, and hyphens.

Example:customer-portal

Headers

API-Version'2026-06-01.beta' required

Request body

usernamestring required

Realm username. Allows letters, digits, dots, hyphens, underscores, and @.

emailstring email required
first_namestring
last_namestring
temporary_passwordstring password required

Initial password set for the user. Must be at least 8 characters. Additional constraints are enforced by the realm's Keycloak password policy at the time of creation (e.g. minimum uppercase/lowercase/digit/special-character counts, disallow reuse, disallow username/email as password). Password policy violations return 422 with a message describing the specific rule that was not met.

enabledboolean

Whether the user can sign in immediately after creation.

rolesRealmRoleName[]

Realm roles to assign after the user is created.

Example request

{
  "username": "john.doe",
  "email": "john@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "temporary_password": "ChangeMe123",
  "enabled": true,
  "roles": [
    "admin"
  ]
}

Response

The request has succeeded and a new resource has been created as a result.

idstring required
usernamestring required

Realm username. Allows letters, digits, dots, hyphens, underscores, and @.

emailstring email required
first_namestring
last_namestring
enabledboolean required

Whether the user can sign in.

email_verifiedboolean

Whether the email address has been verified.

organizationstring

Organization associated with the user, when available.

last_login_atstring date-time

Most recent successful sign-in time, when available.

created_atstring date-time

Time when the user was created, when available.

Example response

{
  "id": "9f3f2e5c-9e3d-4b1d-9f53-2a8af5a5d9a1",
  "username": "john.doe",
  "email": "john@example.com",
  "first_name": "John",
  "last_name": "Doe",
  "enabled": true,
  "email_verified": true,
  "organization": "Acme Corp"
}

Changes

No recorded changes to this operation across all 1 revision of this API.