---
title: "Create a domain route"
method: POST
path: "/clusters/{cluster_id}/domains/{domain_id}/routes"
tags: ["Domain Routes"]
---

# Create a domain route

`POST /clusters/{cluster_id}/domains/{domain_id}/routes`

## Request

- Base URL: `http://localhost:8000`
- URL: `http://localhost:8000/clusters/{cluster_id}/domains/{domain_id}/routes`
- Auth: API key in header `API-Key`

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`

## Path parameters

- `cluster_id` string, uuid, required
- `domain_id` string, uuid, required

## Headers

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

## Request body

- CreateDomainRouteRequest
  - `realm` string, required: Keycloak realm name (not ID). Must start with a letter; allows letters, digits, and hyphens.
  - `hide_realm_path` boolean: When `true`, the `/realms/{name}` path segment is omitted from URLs. Defaults to `false`.
  - `allow_admin_access` boolean: When `true`, the Keycloak admin console is accessible via this domain. Defaults to `true`.
  - `cors_allowed_origins` string[]: CORS origins allowed to make requests via this domain.

## Response `201`

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

- DomainRoute: A route that maps a custom domain to a Keycloak realm. Traffic arriving at the domain is served by the associated realm.
  - `id` string, uuid, required
  - `domain_id` string, uuid, required
  - `cluster_id` string, uuid, required
  - `realm` string, required: Keycloak realm name (not ID). Must start with a letter; allows letters, digits, and hyphens.
  - `hide_realm_path` boolean, required: When `true`, the `/realms/{name}` path segment is omitted from URLs served by this domain.
  - `allow_admin_access` boolean, required: When `true`, the Keycloak admin console is accessible via this domain.
  - `cors_allowed_origins` string[], required: CORS origins allowed to make requests via this domain.
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required

## Other responses

- `400`: The server could not understand the request due to invalid syntax.
- `401`: Access is unauthorized.
- `403`: Access is forbidden.
- `404`: The server cannot find the requested resource.
- `409`: The request conflicts with the current state of the server.
- `422`: Client error
- `429`: Client error
- `500`: Server error
- `501`: Server error

---

[API](https://skmtc.dev/skycloak/apis/skycloak-public-api.md) · [All operations](https://skmtc.dev/skycloak/apis/skycloak-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/skycloak/apis/skycloak-public-api/revisions/33a69e2ce35f?raw)
