Create Tenant
Creates a new tenant in the Databunker Pro system.Request Body
Response
Example Response
Notes
- The
TENANT-ACCESS-TOKENis a special token to authenticate all tenant related commands. For example create user records.
Create a Tenant User Account
You have two methods to specify the tenant name: you can either use theX-Bunker-Tenant HTTP header or include the tenant name in the hostname. If the X-Bunker-Tenant header is missing, Databunker Pro will attempt to retrieve the tenant name from the subdomain in the hostname. If neither option is available, a default tenant is used.
Example commands:
Notes
- Replace
TENANT-NAMEin the URL with the actual name of the tenant. - The request body and response format are identical to the standard
UserCreatecall — see the API Reference. The only difference is the tenant context supplied via theX-Bunker-Tenantheader or the subdomain.
Rename Tenant
Renames an existing tenant.Request Body
Example Request
Response
Example Response
Other commands:
For a full list of API requests, check out the API Reference.General Notes
-
Tenant Name Format: Tenant names must follow the format
[a-z0-9]+. This means they can only contain lowercase letters and numbers. -
Tenant-Specific URLs: After creating a tenant, you’ll interact with tenant-specific endpoints using URLs in the format
https://tenant-name.databunker-domain.com/.... -
Authentication: Most endpoints will require the
TENANT-ACCESS-TOKENfor authentication. Include this token in theX-Bunker-Tokenheader or as specified in the Databunker Pro documentation. - SSL/TLS: Always use HTTPS for secure communication with the API endpoints.
Database-level tenant isolation
On PostgreSQL, tenant isolation is enforced by the database itself rather than by the correctness of the queries Databunker Pro issues. Two dedicated roles are created during setup, bothNOSUPERUSER NOLOGIN — neither can log into the database directly, and both are reachable only through SET ROLE inside Databunker Pro’s own session.
How mtenant scoping works
Every tenant-scoped table has row-level security enabled, with a policy tying each row to the tenant set on the current session:users, userapps, audit, sessions, agreements, files, tokens, and the versioning tables.
The connection default is mtenant with my.tenantid=1, so a session gets the restricted role unless something explicitly changes it.
The
xtokens table is intentionally not under RLS. An incoming API token must be resolved to a tenant before the tenant is known, so that lookup cannot itself be tenant-scoped. Tokens carry their tenant binding, which is then applied to every subsequent query in the request.How madmin is constrained
The cross-tenant System Operations below necessarily bypass RLS, so two grants keep that bypass narrow:madmin holds SELECT only, and only on the users table. Even on the bypass path it cannot write anything, and cannot read audit records, sessions, files, or any other table.
MySQL and Oracle
Multi-tenancy is supported on both, but neither uses a database-enforced equivalent of RLS: there, tenant scoping is applied in the queries Databunker Pro issues. The isolation model is identical from the API’s point of view, without this second, database-level line of defence.Cross-tenant System Operations
Databunker Pro provides a dedicated System Operations API for cross-tenant queries. These endpoints are used for compliance workflows that span the entire deployment — DSAR fulfillment, regulator queries, right-to-erasure, and forensic investigations — where the answer to “find every record about this person across all our tenants” must come from one call rather than N tenant-by-tenant queries.Access control
All System Operations endpoints are:- Restricted to the main tenant admin (
tenantID = 1) — the highest-privilege principal of the deployment. Tenant-level admins cannot invoke these endpoints. - Gated by a
bulkListUnlockUUID — short-lived, must be obtained via/v2/BulkListUnlockimmediately before the call. This is the same default-deny mechanism used for bulk operations: an admin token alone is not enough. - Audited on every call.
Endpoints
Every response includes the originating
tenantid and tenantname for each profile, so the caller can see exactly which tenants the person appeared in.
Example: find a user across every tenant
Example response
Next steps
- Access control — policies and roles within a tenant
- Sub-accounts — choosing between tenants and groups
- Multi-jurisdiction deployment — when a separate instance beats a separate tenant