Multi-tenancy
API

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()

mutation {
  createTenant(user: { name: "abc123" }) {
    id
  }
}

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.

query {
  tenants {
    data {
      name
    }
  }
}

tenant()

Fetch a single tenant by ID

query {
  tenant(id: "123") {
    name
  }
}