Create Tenant
Tenant are entities that can request Keycloak to authenticate a user. It also use Keycloak to encrypt themselves and provide a single sign-on solution which can securely invoke other services over the network. Access this API to create a new tenant.
info
Tenant in mID refers to the Realm.
Resource Informations
| Name | Value |
|---|---|
| Requires authentication? | Yes |
| Rate limited? | No |
Request
Request headers
| Key | Value |
|---|---|
| Authorization | Bearer token |
| Content-Type | application/json |
HTTP request URL for SSMS
POST https://{tenantId}.{hostname}/digitanium/v4/tenants
HTTP request URL for SHIFT
POST https://{hostname}/auth/realms/{tenantId}/v4_realm/
note
Only MASTER tenant has the access to Create tenants.
note
API requests must be made over https. Calls made over plain http will fail. {tenantId} which is used in http request should be a master tenantId.
Parameters
No parameters fields are required.
Request body (Required)
| Field Name | Type | Description |
|---|---|---|
| tenantid | String | Define unique tenant id. |
| realm (Required) | String | Define unique realm id. |
| enabled | Boolean | If this is set to true the realm is enabled. |
| type | String | It specifies the RealmType, the possible values are SSMS or AST. |
| loginTheme | String | Define the theme of the realm. |
| accountTheme | String | Define the theme of the account. |
| adminTheme | String | Define the theme of the admin. |
| adminUsername (Required) | String | Define unique username of admin user. |
| adminEmail | String | Define an email of admin user. |
| adminPassword (Required) | String | Define new password of admin user. |
| adminFirstName | String | Define Firstname of admin user. |
| adminLastName | String | Define Lastname of admin user. |
| bruteForceProtected | Boolean | Bruteforce will be activated, if enabled. |
| otpBruteForceProtected | Boolean | Bruteforce will be activated for otp brute force detection. |
| actionTokenGeneratedByAdminLifespan | Integer | Expire time of the verification link, should be set as a default 86400 second in the field. |
| settings | Map | Defines the settings of the realm. Required settings can be configured. |
| requiredActions | Array | Pre-requisite for the functionality required. |
| alias | String | Pre-requisite for the functionality required. |
| name | String | The name for the required action. |
| providerId | String | The required action’s Id. |
| enabled | Boolean | If this is true the required action is enabled. |
| priority | Integer | The execution order of the required action. |
Sample Request
{
"id": "tenantExt000019",
"realm": "tenantExt000019",
"enabled": true,
"type": "AST",
"loginTheme": "kobilv2",
"accountTheme": "kobilv2",
"adminTheme": "kobilv2",
"emailTheme": "kobilv2",
"adminUsername": "admin",
"adminEmail": "user123@gmail.com",
"adminPassword": "Admin@123",
"adminFirstName": "",
"adminLastName": "",
"bruteForceProtected": true,
"otpBruteForceProtected": true,
"actionTokenGeneratedByAdminLifespan":86400,
"settings": {
" UserProperty": "id"
},
"requiredActions":[
{
"alias": "kobil-reg-status-required-action",
"name": "KOBIL Registration Status Verification",
"providerId": "kobil-reg-status-required-action",
"enabled": true,
"priority":1001
}
]
}
Response
| Field Name | Type | Description |
|---|---|---|
| message | String | Message explains result of the API call. Refer Response status Information for details. |
| status | String | The status of the API call. Refer Response status Information for details. |
| subSystem | Integer | subSystem categorizes the type of API that has been called. Refer Subsystem details for details. |
| data | Object | Object containing the newly created tenant details. |
| tenantName | String | Unique tenant name. |
| appId | String | Default appId. |
| emailId | String | Email of admin user. |
| appSecret | String | UUID, Secret of the default app. |
| tenantUrl | String | API URL of the tenant. |
Sample Response
{
"message": "Tenant created successfully",
"status": "OK",
"subSystem": 1,
"data": {
"tenantName": "tenant419",
"emailId": "user123@gmail.com",
"tenantUrl": " tenant419.aws.kobil.com",
"appId": "digitanium-app",
"appSecret": "5f8e7721-e20c-46ec-9beb-ada05cbfdf93"
}
}
Response Status Information
| Status Code | Status | Message |
|---|---|---|
| 200 | OK | Tenant created successfully |
| 400 | BAD_REQUEST | Tenant name should not be null or empty |
| 401 | Unauthorized | Failed to create tenant |
| 409 | CONFLICT | Tenant already exists |