Skip to main content

Tenant API

The Tenant API provides REST endpoints for managing tenants, their organizational hierarchy (departments), roles, groups, applications, property templates, and user assignments. Access requires a Keycloak admin bearer token with appropriate realm-management permissions.

Scope

The API covers the following domain areas:

  • Tenant lifecycle — create, read, update, delete, and search tenants
  • Departments — hierarchical organizational units within a tenant, including tree views and sub-departments
  • Department users — assign and unassign users to departments
  • Roles — manage realm and client roles scoped to a tenant
  • Groups — associate Keycloak groups with a tenant
  • Property templates — define typed property schemas for structured department metadata
  • Department templates — reusable department blueprints organized into template groups
  • Applications — global application catalog and tenant-scoped application assignments
  • User assignments — query user-to-tenant assignment data across departments

Definitions

Tenant lifecycle

OperationDescription
List tenantsRetrieve tenants with pagination and search filtering
Get tenantRetrieve a single tenant by ID
Create tenantProvision a new tenant with name, alias, description, and domain associations
Update tenantModify tenant metadata or toggle enabled status
Delete tenantPermanently remove a tenant and all associated resources
Search by aliasLook up a tenant by its unique alias

Departments

OperationDescription
List root departmentsRetrieve top-level departments within a tenant
Get department treeRetrieve the full hierarchical tree as nested nodes
Create departmentAdd a department with optional template, roles, and attributes
Get departmentRetrieve a single department with template-inherited data
Update departmentModify department metadata, roles, or attributes
Delete departmentRemove a department
List / create / get / update / delete sub-departmentsManage departments nested under a parent department

Department users

OperationDescription
List department usersRetrieve users assigned to a department with their roles
Assign userAssign a user to a department with optional roles and attributes
Unassign userRemove a user from a department

Roles

OperationDescription
List organization rolesRetrieve roles assigned to a tenant, with optional global filter
List available rolesRetrieve roles not yet assigned to a tenant
Add roleAssign an existing realm or client role to a tenant
Remove roleUnassign a role from a tenant
Create and assign roleCreate a new realm role and assign it to a tenant in one operation
List global realm rolesRetrieve all realm-level roles
List department rolesRetrieve realm or client roles scoped to a department

Groups

OperationDescription
List organization groupsRetrieve Keycloak groups associated with a tenant
Add groupAssociate a Keycloak group with a tenant
Remove groupDisassociate a group from a tenant

Property templates

OperationDescription
List / get / create / update / delete property templatesManage typed property schemas (STRING, NUMERIC, DATE, BOOLEAN) for department metadata

Department templates

OperationDescription
List / get / create / update / delete department templatesManage reusable department blueprints with predefined roles and attributes
List / add / remove template rolesManage roles assigned to a department template
List / get / create / update / delete template groupsOrganize department templates into logical collections
Clone template groupDuplicate a template group and all its templates

Applications

OperationDescription
List / get / create / update / delete global applicationsManage the realm-level application catalog
List tenant applicationsRetrieve applications assigned to a tenant
Assign application to tenantAssociate a global application with a tenant
Unassign application from tenantRemove an application assignment without deleting the application

User assignments

OperationDescription
List user assignmentsRetrieve all department assignments for a user
Get user assignment treeRetrieve the organization hierarchy filtered to a user's departments

Example

{
"method": "POST",
"path": "/tenants",
"body": {
"name": "Acme Corp",
"alias": "acme",
"description": "Primary tenant for Acme Corporation",
"domains": [
{ "name": "acme.example.com" }
]
}
}