API Maker

The backend engine for the AI era

Multi-tenantEpisode 33 4:37 9 chapters October 2026

Multi-Tenant APIs: One Set of APIs, a Database per Tenant

One set of APIs for every customer, each with a database of its own. Keep tenants in a table named by the secret, build a multi-tenant instance with one structure for many databases, pick the tenant by path or header, refuse suspended tenants, and move a tenant with one call.

In the playlists The complete course Migrations & tenants

Chapters

What you will learn

  • Where the tenants are: a table, named by the secret
  • A multi-tenant instance
  • One structure, many databases
  • The same URL for two tenants: path or header
  • Suspended tenants, refused
  • A tenant that moves, told in one call
In the docsMulti-tenant
Transcript618 words · click a time to play from there

Multi-tenant, the usual way

One set of APIs for every customer, each with a database of its own. In this video, multi-tenant APIs with API Maker. Serving many customers usually means a branch of code or a deployment per customer, or one shared database with a tenant id in every table and every query, where one forgotten filter shows a customer the data of another. With API Maker, one instance serves every tenant, each with its own database, the request names its tenant, in the path or in a header, and a new customer is a row, not a deploy.

In this video : where the tenants are, a multi-tenant instance, the same URL for two tenants, the tenant in the path, in a header, or suspended, and a tenant which moves.

Where the tenants are

Calm Home for Business : interior studios work on Calm Home, each with a PostgreSQL database of its own and the same table of projects. The studios are rows of a table, crm dot public dot studios : a username, a name, the connection string of its database, and active. An entry of the default secret names that table, and finds only the active studios. Pine Studio is suspended : active is false.

A multi-tenant instance

Instance API, Add New. PostgreSQL, named studios, and its connection, the key of the PostgreSQL server in the secret : the panel shows key names, never their values. Below, Is Multi Tenant Structure Instance : on, and its entry, multiTenant.studios. The hint says how a request names its tenant : in the path, studios colon colon tenant, or with the header x-am-tenant-username. Test : connected. Save. The instance studios. Its structure database, also named studios, holds the table every studio has.

Bulk Schema Creation : one schema, for every studio at once. And the tenants it offers : oakwood and linen. Pine is not there : it is suspended.

The same URL for two tenants

API Testing : studios, the tenant oakwood, the database studios, projects, Get all. Send : the three projects of Oakwood Interiors. Now the tenant linen : the database, the table and the API stay picked. Send : the two projects of Linen and Loft. The same URL, another database.

Path, header, or suspended

From an app : the tenant in the path, studios colon colon oakwood. Or in a header, x-am-tenant-username : linen. No tenant : the structure database answers, with its template row. Pine : four hundred, unable to find a tenant named pine. A save for Oakwood, and PostgreSQL itself counts : four projects for Oakwood, the others unchanged.

A tenant which moves

A studio moves to another database server : its row gets the new connection string. Then, in System APIs, Multi tenant instance updated, in its body, the instance and the studio. Send : every server connects anew to that studio, and the answers kept for the instance are dropped.

Good to know

A person token made for one tenant is refused for another. Custom APIs read the tenant of the request in g.req.params.tenantUsername. The tenants table can be on any engine, and its connection strings can be encrypted with the secret. Onboarding a customer : a database, and a row. No restart.

Built on standards

A database per tenant : isolation by construction, not by a filter in every query. One set of APIs, schemas, hooks and permissions for all of them. So code written by an AI assistant can not forget a tenant id : there is none to forget.

Recap

To sum up. Tenants in a table, named by the secret. One instance, a database per tenant. The tenant in the path or in a header. Suspended tenants refused. And a tenant which moves, told in one call. Next : error messages in the language of each caller. API Maker. Build faster, spend smarter, deliver better.