Skip to content

Start a realm import

POST
/clusters/{cluster_id}/realms/import
curl --request POST \
  --url http://localhost:8000/clusters/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/realms/import \
  --header 'API-Key: <API-Key>' \
  --header 'API-Version: 2026-06-01.beta' \
  --header 'Content-Type: application/json' \
  --data '{ "source_kind": "upload", "upload_s3_key": "realm-imports/uploads/ws/abc.zip.enc", "password": "a-strong-passphrase" }'

Imports a realm (configuration, users, and credentials) into the cluster via the Keycloak Admin API. Preflight validates the target Keycloak version, refuses a name collision, and blocks on missing password-hash providers. Poll GET /realm-imports/{import_id} until status is completed or failed.

Required scope: clusters:imports:write

cluster_id
required
string format: uuid
API-Version
required
string
Allowed values: 2026-06-01.beta
Media typeapplication/json
object
source_kind

Where the artifact comes from. upload (default) or stored.

string
Allowed values: upload stored
upload_s3_key

Object key of a previously-uploaded artifact (from the upload-url endpoint). Required when source_kind is upload.

string
source_export_id

A stored realm export id. Required when source_kind is stored.

string
password

Password to decrypt an encrypted artifact. Omit for a bare foreign JSON.

string

Example

{
  "source_kind": "upload",
  "upload_s3_key": "realm-imports/uploads/ws/abc.zip.enc",
  "password": "a-strong-passphrase"
}

Returned when a realm import has been accepted for processing. Poll the resource until status is completed or failed.

Media typeapplication/json
object
id
required
string format: uuid
cluster_id
required
string format: uuid
realm
required

The imported realm’s name, derived from the artifact.

string
source_kind
required
string
Allowed values: upload stored
status
required
string
Allowed values: pending processing completed failed
progress
required

Percent complete, 0-100.

integer
source_version

Keycloak version that produced the artifact.

string
nullable
target_version

Target cluster’s Keycloak version at import time.

string
nullable
error_message

Failure description. Only set when status is failed.

string
nullable
created_at
required
string format: date-time
completed_at
string format: date-time
nullable

Example

{
  "id": "7b1c2d3e-4f5a-6b7c-8d9e-0f1a2b3c4d5e",
  "cluster_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "realm": "cust-brasilia",
  "source_kind": "upload",
  "status": "completed",
  "progress": 100,
  "source_version": "26.6.1",
  "target_version": "26.6.2",
  "error_message": null,
  "created_at": "2026-07-19T15:00:00Z",
  "completed_at": "2026-07-19T15:03:00Z"
}
Location
required
string format: uri

URL of the resource being created or modified. Poll this endpoint to track completion.

Retry-After
integer

The server could not understand the request due to invalid syntax.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

Access is unauthorized.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

Client error

Media typeapplication/problem+json

Returned when a workspace plan quota would be exceeded. required_plan indicates the minimum plan needed to complete the request.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri
current_plan
required
string
required_plan
required
string
code

Machine-readable identifier of the quota that was hit, so a client can tell quotas apart without parsing detail. Known values include cluster_limit (the workspace’s total cluster allowance), cluster_size_quota (the allowance for the requested cluster size) and cluster_size (the requested size is not offered on the plan at all). New values may be added.

string
current_usage

How many of the resource the workspace currently has.

integer
current_limit

Maximum allowed by the current plan. 0 means the plan does not include the resource at all.

integer

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com",
  "current_plan": "example",
  "required_plan": "example",
  "code": "example",
  "current_usage": 1,
  "current_limit": 1
}

Access is forbidden.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

The server cannot find the requested resource.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

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.

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

Client error

Media typeapplication/problem+json
object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri
errors
required
Array<object>
>= 1 items
object
field
required
string
detail
required
string
code
string
value

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

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}
Retry-After
integer
RateLimit-Limit
integer
RateLimit-Remaining
integer
RateLimit-Reset
integer
X-RateLimit-Limit-Second
integer
X-RateLimit-Remaining-Second
integer
X-RateLimit-Limit-Minute
integer
X-RateLimit-Remaining-Minute
integer
X-RateLimit-Limit-Hour
integer
X-RateLimit-Remaining-Hour
integer
X-RateLimit-Limit-Day
integer
X-RateLimit-Remaining-Day
integer

Server error

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}

Server error

Media typeapplication/problem+json

RFC 9457 Problem Details object.

object
type
required
string format: uri
title
required
string
status
required
integer
detail
required
string
instance
string format: uri

Example generated

{
  "type": "https://example.com",
  "title": "example",
  "status": 1,
  "detail": "example",
  "instance": "https://example.com"
}