Tenants API overview

Using multi-tenancy your application can serve multiple customers. In Serialized the data between tenants is isolated, but easily managed via a single project. To manage a multi-tenant Serialized application, you use the Tenants API to create, update and manage your tenants.

When working with a multi-tenant project, you need to add an HTTP header to each and every API call.

The parameter is called Serialized-Tenant-Id and is expected to contain the UUID of the tenant for which the API call is made.

Creating a tenant

Each tenant has an isolated data store. This data store includes all data that you store in Serialized:

  • Aggregates
  • Projections
  • Reactions

Before you can store data in a multi-tenant project you must create the tenant explicitly. Each tenant has a unique ID and a (optional) reference which can be used either as a human-readable identifier (such as a customer name) or the ID of the tenant in a different system.

When the tenant is created via the add tenant API call a data store for the tenant is created. You will also be able to view the tenant data in the console.

Modifying data in multi-tenant projects

To operate on data (aggregates, projections, reactions) in a multi-tenant project, the client application must indicate to the Serialized API which tenant is the target. In the respective APIs this is indicated with an additional header called Serialized-Tenant-Id where the unique tenant ID is provided.

Project configuration for multi-tenant projects

The multi-tenancy support is carefully designed to support easy upgrades of your application's features without the need to manually run data updates across all your tenants.

For example, if you want to change a projection definition to your application, you will only need to provide a single API call to update the projection definition and all projections for all tenants will be automatically rebuilt.

The API's that are cross-tenant are any calls for creating or modifying projection definitions or reaction definitions.

Tenant deletion

The Tenant API obviously supports deletion of tenants. The deletion of a tenant removes all data for that tenant permanently, so be careful when integrating this API method in a user-facing application.