Create a realm
const url = 'http://localhost:8000/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/realms';
const options = {
method: 'POST',
headers: {
'API-Version': '2026-06-01.beta',
'API-Key': '<API-Key>',
'Content-Type': 'application/json'
},
body: '{"name":"customer-portal","display_name":"Customer Portal"}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}curl --request POST \
--url http://localhost:8000/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/realms \
--header 'API-Key: <API-Key>' \
--header 'API-Version: 2026-06-01.beta' \
--header 'Content-Type: application/json' \
--data '{ "name": "customer-portal", "display_name": "Customer Portal" }'Creates a new realm in the specified cluster. The cluster must be in the available state.
Required scope: realms:write
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Request body for creating a realm. If display_name is omitted, the realm name is used.
object
Example
customer-portalHuman-friendly name for the realm. Defaults to name when omitted.
Example
Customer PortalWhether to apply Skycloak’s default login branding to the new realm. Defaults to true
when omitted, so the realm serves the Skycloak look instead of the stock Keycloak login
page. Set to false to leave the realm’s themes untouched. Branding can always be
applied or reset later from the realm’s Branding page.
Example
trueExample
{
"name": "customer-portal",
"display_name": "Customer Portal"
}Responses
Section titled “Responses”The request has succeeded and a new resource has been created as a result.
Realm details returned when a realm is created.
object
Whether users can sign in to this realm.
Keycloak SSL requirement. Maps directly to Keycloak’s sslRequired realm setting.
Whether self-registration is open to anyone.
Whether email addresses are used as usernames during registration.
Whether users can sign in with their email address instead of username.
Whether multiple accounts may share the same email address.
Time when the realm was created, when available.
Whether Skycloak’s default login branding was applied to the realm as part of this
create. false when apply_default_branding was set to false, and also when the
branding step failed: the realm is created either way, and branding can be applied
from the realm’s Branding page.
Example
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"name": "customer-portal",
"display_name": "Customer Portal",
"enabled": true,
"ssl_required": "external",
"registration_allowed": false,
"registration_email_as_username": false,
"login_with_email_allowed": true,
"duplicate_emails_allowed": false,
"default_branding_applied": true
}Access is unauthorized.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Access is forbidden.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}The server cannot find the requested resource.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}The request conflicts with the current state of the server.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Client error
object
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com",
"errors": [
{
"field": "example",
"detail": "example",
"code": "example",
"value": "example"
}
]
}Client error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Headers
Section titled “Headers”Server error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}Server error
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}