TL;DR: In a multi-tenant client portal, the one bug you cannot ship is a client seeing another client's data. Everything else is recoverable; that one ends the relationship. My defense is boring on purpose: a tenant ID on every row, the tenant resolved from the session on the server and never from the request, one data-access layer that applies the tenant filter so queries cannot forget it, row-level security in the database as a second line, webhooks mapped to tenants by something the sender cannot fake, and a test that logs in as tenant A and tries to read tenant B. It is the spine of the client dashboards I have built for voice-AI work, from the chat-dash dashboard behind CallSetter AI to VoiceDash.
Most data leaks in small SaaS products are not hacks. They are a missing WHERE clause: a new endpoint on a Friday, a query copied from an admin screen that was allowed to see everything, and a client emailing a screenshot of another business's call transcript.
When I wrote about building VoiceDash, I said multi-tenancy has to be the spine of a white-label portal, not a feature added later. This is the practical version: what I put in place, and what I check when I inherit a portal.
What multi-tenant means in a client portal
A tenant is whoever owns a slice of the data. In a simple product it is a customer account. In a voice-AI agency portal it is layered: the agency is a tenant, and each of the agency's clients is a sub-tenant who must only ever see their own calls, bookings and leads.
There are three common ways to separate tenants:
- Shared tables with a tenant column. Every row carries a
tenant_id. Cheapest to run, easiest to get wrong. - Schema or database per tenant. Strong separation, but migrations, connection handling and reporting all multiply with your customer count.
- A hybrid. Shared tables for most things, separate storage for the few tenants with contractual or regulatory reasons to be isolated.
For a small team I start with shared tables almost every time, because it is the model you can actually operate. A per-tenant database you cannot migrate reliably is not safer, just a different way to break. The rest of this post assumes shared tables, where the discipline matters most.
The rules I follow from day one
Put the tenant on every row that belongs to one
Calls, transcripts, bookings, contacts, agent configs, uploaded files, audit logs. If a record belongs to a tenant, it carries the tenant ID directly, even when you could technically derive it through a join. Derived ownership is how leaks happen: the call belongs to an agent, the agent belongs to a client, and someone queries calls by date range without walking the chain.
I also add the tenant ID to the indexes that matter, usually as the leading column. Every real query is scoped to a tenant anyway, so this is good for performance as well as safety.
Resolve the tenant once, on the server, from the session
The tenant for a request comes from the authenticated session or token, resolved in one place on the server. Never from a query parameter, a request body field or a header the browser can edit. If a URL contains /clients/123/calls, the 123 is a request to look at something, not proof of permission. The server checks that the logged-in user belongs to tenant 123 before doing anything else, and if they do not, the answer is a 404, not a 403, so you do not confirm that tenant 123 exists.
Make the safe path the only easy path
The single biggest improvement is architectural: one data-access layer that every query goes through, and that layer applies the tenant filter automatically. Endpoints ask for "calls for this date range," and the layer adds "for this tenant" without being asked. A developer who wants to read across tenants, for an internal admin view or a billing job, has to call a separately named function that is obviously different and easy to grep for.
This matters more now than it used to. I use Claude Code on client projects every day, and an AI assistant will happily write a correct-looking query that forgets the tenant scope. If the scope lives in the layer and not in each query, a forgotten filter is not possible to write by accident, by a human or a model.
Add a second line of defense in the database
Application code has bugs, so I like the database to refuse cross-tenant reads on its own. In Postgres that is row-level security: a policy that only returns rows whose tenant matches a value set for the current connection or transaction. In Firebase it is security rules that compare the document's tenant field to a claim on the user's token. The specifics depend on the stack, but the principle is the same: if the application layer fails, the database still says no.
Row-level security has costs: it complicates connection pooling, surprises you in migrations, and is easy to bypass with a superuser role. For a portal holding recordings, transcripts or contact details it is still worth it. Treat it as the seatbelt, not the brakes.
Where tenant leaks actually come from
When I review a portal, these are the places I look first, because they are where I have seen the bugs live.
Inbound webhooks
Voice platforms, CRMs and payment providers send events to your server. The event does not arrive with a logged-in user, so the code has to decide which tenant it belongs to. If that decision is based on a field in the payload that anyone could set, an attacker, or just a misconfigured client, can write data into someone else's account.
I map webhooks to tenants by something the sender cannot fake: a per-tenant webhook URL with an unguessable token, a signature verified with a per-tenant secret, or an ID from the provider (an agent ID or location ID) that you look up in your own table and that only one tenant can own. In the CallSetter build, events flowed from Retell into a dashboard and into GoHighLevel as the CRM, and the mapping from "which agent took this call" to "which client sees it" is the line that has to be right. It is also a reason to keep webhook handling boring and well logged, which I covered in why post-call automation fails.
Background jobs and exports
Scheduled reports, CSV exports, nightly summaries. These run without a user session, so the automatic tenant scope from the request is not there. Every job should take the tenant as an explicit argument and run through the same scoped data layer. A daily email that loops over all calls and groups by client is one bug away from sending client A's summary to client B.
Caches and file storage
A cache key of calls:today is a leak waiting for traffic. Cache keys include the tenant. File paths include the tenant, and file access goes through signed URLs that are generated after the permission check, with a short expiry. Recordings and transcripts are exactly the kind of thing clients forward to each other, so a permanent public link to an audio file is a bad idea even inside one tenant.
Search, analytics and AI features
Search indexes, analytics tables and embedding stores are copies of your data that often skip the main permission model. If you add "ask questions about your calls" to a portal, retrieval must filter by tenant before anything reaches the model. A model cannot be trusted to ignore context it was given, only not to see context it never got. Same lesson as prompt injection in voice agents: enforce the boundary in code, not in the prompt.
Support tools and impersonation
When your team needs to see what a client sees, build a deliberate "view as tenant" feature: limited to specific staff, logged with who and why, and visibly marked in the UI. A shared admin login that sees everything is how the Friday leaks start.
White-label adds its own isolation problems
A white-label portal like VoiceDash has extra surfaces where tenants can bleed into each other:
- Custom domains. The domain decides which brand loads, so domain-to-agency mapping needs verified ownership, and a session issued on agency A's domain must not work on agency B's.
- Branding and emails. A password reset email with the wrong agency's logo is a small leak, but clients notice instantly, and it tells them the boundaries are soft.
- Per-tenant secrets. Agencies connect their own voice platform or CRM keys. Store them encrypted, scoped to the tenant, and never return them to the browser. More in handling API keys and secrets on client projects.
Test it like an attacker, every build
The check I trust most is simple and automated. Create two tenants in the test database with similar data. Log in as tenant A. Then call every endpoint that takes an ID, using tenant B's IDs, and assert that every single one returns not found. Run the same idea against exports, file URLs and webhook handlers.
It is cheap to write once the data layer exists, and it catches the Friday endpoint before a client does. I also alert on requests denied for crossing tenants, because a spike is either a bug or someone probing, which fits the setup in error monitoring for a small product.
What I check when I inherit a portal
When a founder hands me an existing client portal, multi-tenancy is high on my first week audit list. My quick questions:
- Where does the tenant for a request come from, and is it ever read from the client?
- Is there one data-access layer, or do endpoints write their own queries?
- Does the database enforce anything on its own?
- How are webhooks assigned to tenants?
- Do background jobs, exports and caches carry the tenant explicitly?
- Is there a test that tries to read across tenants?
If most of the answers are "it depends on the endpoint," that is the technical debt worth paying down first, ahead of any new feature, because it is the only category of bug that can end a client relationship in one email.
The short version
Tenant on every row, resolved from the session, scoped by one data layer, backed by a database policy. Webhooks mapped by something the sender cannot forge. Jobs, caches, files and AI retrieval scoped explicitly. A cross-tenant test on every build. None of this is clever, and that is the point: a client portal earns trust by showing a business its own results and nothing else.
I build AI voice agents, client dashboards and the full-stack products around them for startups and agencies in the US, UK and Europe. If you are building a client portal, or inherited one and are not sure where the tenant boundaries are, read more about my background or book a call.