Skip to main content
Version: 2.0.0

permit.api.tenants.create()

Creates a new tenant.

Parameters

tenantData - An object that contains the information about the tenant. The payload is defined below.

Payload

key - A unique id by which Permit will identify the tenant. The tenant key must be url-friendly (slugified).
name - A descriptive name for the tenant.
description - optional - A longer description of the tenant.
attributes - optional - Arbitraty tenant attributes that will be used to enforce attribute-based access control policies.

Implementation

import io.permit.sdk.openapi.models.TenantCreate;
import io.permit.sdk.openapi.models.TenantRead;

// optional attributes for attribute-based access control
HashMap<String, Object> tenantAttributes = new HashMap<>();
tenantAttributes.put("age", Integer.valueOf(50));
tenantAttributes.put("fav_color", "red");

TenantRead tenant = permit.api.tenants.create(
new TenantCreate("tesla", "Tesla Inc").withDescription("The car company")
);