Tenants API
Introduction
In B2B SaaS applications, all users are usually grouped into tenants. Each of your business customers is represented as a tenant. The related users and all the data are fully isolated. Please refer to the multi-tenancy feature guide for more information and instructions.
Mutations
createTenant()
You can create new tenants by setting a name. The returned ID is needed when you assign tenants to users by using
createUser()
or updateUser()
await client.asSuperAdmin().createTenant({ tenant: { name: 'abc123' } });
updateTenant()
updateTenant()
works the same way as createTenant()
described above.
Queries
tenants()
Load tenant data. All query parameters can be applied here to narrow down the results.
await client.asSuperAdmin().tenants();
tenant()
Fetch a single tenant by ID
await client.asSuperAdmin().tenant({ id: "abc123" });