Tenant Management

Tenants in Ema form a hierarchy. A root tenant sits at the top, and child tenants inherit configurations from their parent. This page covers the APIs for creating, querying, and managing tenants.

Tenant Hierarchy

Root Tenant
├── Child Tenant A
│ ├── Grandchild Tenant A1
│ └── Grandchild Tenant A2
└── Child Tenant B

Each tenant has its own set of AI Employees, workflows, dashboards, and users. Child tenants can inherit templates and configurations from their parent.

CreateTenant

Create a new child tenant under an existing parent tenant.

PropertyValue
URL/tenant.v1.TenantService/CreateTenant
HTTP MethodPOST
ProtocolgRPC-Web over HTTP

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/grpc-web+proto
x-grpc-webstringYes1

Request

FieldTypeRequiredDescription
tenantTenantYesTenant definition: domain, company_name, email; optional size, parent_tenant_id, alternate_domains. Parent is inferred from the caller's token if parent_tenant_id is omitted.
user_namestringYesName of the initial tenant admin user
user_emailstringYesEmail of the initial tenant admin user
user_create_api_keybooleanNoIf true, returns API keys for the admin in the response
additional_usersarrayNoExtra users to seed alongside the admin
workspace_namestringNoDefault workspace name
sizeintegerNoExpected tenant size
third_party_direct_login_configobjectNoSSO/IDP configuration for direct login

Response

FieldTypeDescription
tenantTenantThe created Tenant (id, domain, company_name, email, default_workspace_id, parent_tenant_id, size, alternate_domains)
api_keysarrayAPI keys generated for any seeded users with create_api_key set

CreateTenantWithApiKey

Create a new child tenant and simultaneously generate API keys for its admin users. Unlike the other endpoints in this section, this is a REST endpoint (not gRPC-Web) — it wraps CreateTenant but exposes a flatter request/response shape that some integrations target directly.

PropertyValue
URL/api/tenant/create_tenant_with_api_key
HTTP MethodPOST
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/json

Request

FieldTypeRequiredDescription
domainstringYesTenant domain (subdomain slug)
company_namestringYesDisplay name for the tenant
emailstringYesContact email for the tenant
admin_usersarrayYesOne or more admin user definitions: { user_name, email, create_api_key }. The first entry becomes the primary admin; the rest are added as additional users.
alternate_domainsarrayNoAdditional domains the tenant should also be reachable at
sizeenumNoExpected tenant size (TenantSize enum value)
login_redirect_urlstringConditionalRequired only when third-party direct login is enabled for this Ema instance
logout_redirect_urlstringConditionalRequired only when third-party direct login is enabled for this Ema instance

Response

FieldTypeDescription
tenant_idstringUUID of the newly created tenant
api_keysarrayPer-admin API keys, each { email, api_key }. Populated for each admin user that had create_api_key=true.

GetTenant

Retrieve details about the tenant associated with the caller's token.

PropertyValue
URL/tenant.v1.TenantService/GetTenant
HTTP MethodPOST
ProtocolgRPC-Web over HTTP

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token
Content-TypestringYesapplication/grpc-web+proto
x-grpc-webstringYes1

Request

Empty request body — the tenant is resolved from the caller's access token.

Response

FieldTypeDescription
tenantTenantTenant details: id, domain, company_name, email, default_workspace_id, alternate_domains, parent_tenant_id, size

GetUsers

Retrieve the list of users associated with a tenant.

PropertyValue
URL/api/user/get_users
HTTP MethodGET
ProtocolREST (HTTP/JSON)

Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token

Response

Returns a list of user objects associated with the authenticated tenant.

FieldTypeDescription
totalintegerTotal number of users in the tenant
usersarrayList of user objects
users[].idstringUUID of the user
users[].namestringDisplay name of the user
users[].emailstringEmail address of the user
users[].is_adminbooleanWhether the user is a tenant admin
users[].tenant_idstringUUID of the tenant the user belongs to
users[].statusstringCurrent user status (e.g. active, invited)

Last updated: Jul 3, 2026