Skip to main content
Sub-accounts (also referred to as hierarchical accounts) in Databunker Pro enable organizations to create isolated account structures within their Databunker Pro instance. This feature is essential for businesses that need to manage multiple independent accounts, departments, or organizational units while maintaining data isolation and administrative control.

What Problems Do Sub-accounts Solve?

1. Organizational Structure Management

  • ✅ Create isolated account spaces for different departments or business units
  • ✅ Maintain separate administrative control for each sub-account
  • ✅ Enable independent data management per sub-account
  • ✅ Support hierarchical organizational structures

2. Multi-tenant SaaS Applications

  • ✅ Provide isolated data storage for each customer
  • ✅ Enable customer-specific administrative access
  • ✅ Maintain complete data separation between accounts
  • ✅ Support white-label or reseller scenarios

3. Compliance and Data Isolation

  • ✅ Ensure complete data isolation between sub-accounts
  • ✅ Meet regulatory requirements for data separation
  • ✅ Enable independent audit trails per sub-account
  • ✅ Support compliance with data residency requirements

Implementation Approaches

Databunker Pro provides two primary approaches for implementing sub-accounts:
  1. Multi-tenancy Support - Creates isolated tenants with dedicated admin tokens
  2. Groups with Roles and Policies - Uses Databunker Pro’s CRBAC system for group-based management
These approaches can also be combined together to create an even more flexible solution that leverages both database-level isolation from multi-tenancy and fine-grained access control from groups.

Approach 1: Multi-tenancy Support

Multi-tenancy is the recommended approach when you need complete data isolation and independent administrative control for each sub-account. After creating a tenant, you receive a tenant admin token that allows full management of all records within that tenant.

How It Works

When you create a new tenant using the multi-tenancy feature:
  1. A new isolated tenant is created with its own data namespace
  2. A tenant admin token is generated that provides full administrative access
  3. All records created within this tenant are completely isolated from other tenants at the database level. Note: Multi-tenancy is supported on PostgreSQL, MySQL, and Oracle; on PostgreSQL it is enforced with native row-level security (RLS).
  4. The tenant admin token can manage all user records, application data, and configurations within the tenant
Records are separated from one tenant to another at the database level, ensuring that queries executed by specific tenants are restricted to their own records and providing complete data isolation.

Creating a Sub-account with Multi-tenancy

Response:

Using the Tenant Admin Token

The tenant admin token is one of several credential types — see the Authentication reference for the full hierarchy. Once you have the tenant admin token, you can use it to manage all records within that tenant:

JavaScript/TypeScript Example

Python Example

Benefits of Multi-tenancy Approach

  • Complete Data Isolation: Each tenant has its own isolated data namespace
  • Independent Administration: Tenant admin tokens provide full control within the tenant
  • Scalability: Supports unlimited tenants with database-level isolation
  • Security: Built-in tenant separation at the database level
  • Compliance: Meets data residency and isolation requirements

Approach 2: Groups with Roles and Policies

The groups approach leverages Databunker Pro’s Conditional Role-Based Access Control (CRBAC) system. Each group can store sub-accounts, and a group admin user manages all users within that group. This approach is implemented using roles and policies.

How It Works

With the groups approach:
  1. Create a group to represent the sub-account
  2. Assign a group admin role to a user who will manage the sub-account
  3. Create policies that grant the group admin access to manage users within the group
  4. Add users to the group as needed
  5. The group admin can manage all users within their assigned group

Creating a Sub-account with Groups

Creating Policies for Group Admin

Create a policy that allows the group admin to manage all users within their group:

JavaScript/TypeScript Example

Benefits of Groups Approach

  • Flexible Access Control: Fine-grained permissions using CRBAC policies
  • Role-Based Management: Different roles can be assigned within groups
  • Conditional Access: Policies can include complex conditions for access control
  • Compliance Support: Supports FERPA, GDPR, and DPDPA compliance scenarios
  • Hierarchical Structures: Supports parent-child relationships within groups

Choosing the Right Approach

Use Multi-tenancy When:

  • You need complete data isolation between sub-accounts
  • Each sub-account requires independent administrative control
  • You’re building a multi-tenant SaaS application
  • You need to meet strict data residency requirements
  • You want database-level isolation for security

Use Groups Approach When:

  • You need flexible, role-based access control within sub-accounts
  • You want to implement hierarchical organizational structures
  • You need conditional access policies (e.g., parent-child relationships)
  • You’re building compliance-focused applications (FERPA, GDPR, DPDPA)
  • You want fine-grained permissions for different user roles

Real-World Use Cases

1. SaaS Multi-tenant Application

Create isolated sub-accounts for each customer:

2. Departmental Sub-accounts

Organize departments within an organization:

3. Reseller/Partner Program

Enable partners to manage their own customer data:

Security Considerations

Multi-tenancy Security

  • Database-level isolation: Tenant data isolation is supported on PostgreSQL, MySQL, and Oracle; on PostgreSQL it is enforced with native row-level security (RLS)
  • Token-Based Access: Tenant admin tokens are scoped to their tenant
  • Audit Logging: All tenant operations are logged separately
  • Encryption: Each tenant’s data is encrypted independently

Groups Security

  • Policy Enforcement: CRBAC policies control all access
  • Role Validation: Roles are verified before granting access
  • Condition Checks: Policies include conditions for additional security
  • Audit Trail: All group operations are logged with role information

Best Practices

  1. Token Management: Securely store and rotate tenant admin tokens
  2. Policy Design: Design policies carefully to ensure proper access control
  3. Regular Audits: Review sub-account access and permissions regularly
  4. Monitoring: Monitor sub-account activity for security and compliance
  5. Documentation: Document which approach is used for each sub-account

Conclusion

Databunker Pro provides two powerful approaches for implementing sub-accounts:
  • Multi-tenancy offers complete isolation and independent administration
  • Groups with CRBAC provides flexible, role-based access control
Both approaches enable organizations to create secure, scalable sub-account structures that meet their specific requirements for data isolation, administrative control, and compliance. The approaches can be combined together to create an even more flexible solution that leverages database-level isolation from multi-tenancy and fine-grained access control from groups. Choose the approach that best fits your use case:
  • Use multi-tenancy for complete isolation and independent administration
  • Use groups for flexible role-based access control and hierarchical structures
  • Combine both approaches for maximum flexibility with database-level isolation and fine-grained permissions