Skip to main content

How to make requests in a multi-tenant environment


Setting the tenant ID and username

When using multi-tenancy, all client requests require an authorization token (JWT) used to identify and authorize the caller.

In production, the custom claim used to generate the JWT is provided by an identity provider such as Auth0. The custom claim specifies a tenant_ID, a value indicating the authorized tenant, and a username, an optional value specifying individual users.

The value for tenant_ID can be:

  • The string _, which grants access only to resources available to all tenants (public resources).

  • A specific tenant name, which grants access to the tenant identities and keys, plus the public resources belonging to tenant _.

  • The string *, which grants access to all resources regardless of restriction (this is like root access, so be careful using it).

When receiving a request, once the server has successfully performed standard checks on the JWT, it extracts the tenant_ID and a X-Tenant-ID header that is optionally set by the client indicating the tenant to impersonate. The combination of these two values determines to whose resources access is granted, as shown in the following table (using foo and bar as example tenant names):

tenant_IDX-Tenant-IDRead accessWrite access
fooemptyfoo, _foo
foobar (invalid)n/an/a
foo* (invalid)n/an/a
*emptyall tenants, __
**all tenants, __

Defining access

You can define more advanced access levels by using nested tenants in combination with username to restrict access to resources by group and individual privileges. Resources you can restrict include chains, accounts, and transactions.

Use : to identify each additional level of access with tenant_ID and the optional X-Tenant-ID. Each nested level gives access to the resources of itself and the previously listed level. The following table shows examples for three levels of nesting.

tenant_IDLevel of access
tenantOnetenantOne resources only
tenantOne:groupOnetenantOne and tenantOne:groupOne resources
tenantOne:groupOne:departmentOnetenantOne, tenantOne:groupOne, and tenantOne:groupOne:departmentOne resources

A user with tenant_ID=tenantOne:groupOne and username=userOne claims has access to tenantOne, tenantOne:groupOne, and userOne resources.

Make a request

Simply pass the Bearer token as part of the Authorization header when doing an HTTP call or fill the authToken parameter when using the JS SDK.

curl --location --request GET '' \
--header 'Authorization: Bearer eyJh...JoVg'

The Quorum Developer Quickstart showcases usage of the multi-tenancy.