Create a domain route
const url = 'http://localhost:8000/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/domains/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/routes';
const options = {
method: 'POST',
headers: {
'API-Version': '2026-06-01.beta',
'API-Key': '<API-Key>',
'Content-Type': 'application/json'
},
body: '{"realm":"customer-portal","hide_realm_path":true,"allow_admin_access":true,"cors_allowed_origins":["example"]}'
};
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/domains/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/routes \
--header 'API-Key: <API-Key>' \
--header 'API-Version: 2026-06-01.beta' \
--header 'Content-Type: application/json' \
--data '{ "realm": "customer-portal", "hide_realm_path": true, "allow_admin_access": true, "cors_allowed_origins": [ "example" ] }'Binds a verified domain to a realm. Traffic to the domain is then handled by the specified realm. The domain must be verified before creating a route. Each realm can only be bound to one domain.
Required scope: domains: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”object
The realm that will handle traffic for this domain.
When true, the /realms/{name} path segment is omitted from URLs. Defaults to false.
When true, the Keycloak admin console is accessible via this domain. Defaults to true.
CORS origins allowed to make requests via this domain.
Responses
Section titled “Responses”The request has succeeded and a new resource has been created as a result.
A route that maps a custom domain to a Keycloak realm. Traffic arriving at the domain is served by the associated realm.
object
The realm that handles traffic for this domain.
When true, the /realms/{name} path segment is omitted from URLs served by this domain.
When true, the Keycloak admin console is accessible via this domain.
CORS origins allowed to make requests via this domain.
Example
{
"realm": "customer-portal"
}The server could not understand the request due to invalid syntax.
RFC 9457 Problem Details object.
object
Example generated
{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "https://example.com"
}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"
}