> For the complete documentation index, see [llms.txt](https://docs.digit.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digit.org/complaints-management/design/architecture/tenancy.md).

# Tenancy

## Overview

#### 🏙️ What is a Tenant in DIGIT?

A **tenant** in DIGIT is a **logical container** that isolates and manages data and configurations for an administrative unit such as a **city, department, or state**. It ensures **data isolation**, **independent configurations**, and **secure multi-tenancy** even when all tenants are hosted on the same DIGIT instance.

#### 🔹 What Does a Tenant Isolate?

<table><thead><tr><th width="225.4375">Type</th><th>Examples</th></tr></thead><tbody><tr><td>Reference Data</td><td>Service types, boundaries</td></tr><tr><td>Configuration Data</td><td>Workflows, SLAs</td></tr><tr><td>Transactional Data</td><td>Complaints, user records, audit logs</td></tr></tbody></table>

***

#### 🔹 Hierarchical Multi-Tenancy (DIGIT 2.9 LTS)

DIGIT supports a **hierarchical tenant structure**, allowing inheritance of data and configuration.

**Example Tenant Hierarchy**:

```
State: StateA
├── CityA → tenantId: statea.citya
├── CityB → tenantId: statea.cityb
└── CityC → tenantId: statea.cityc
```

Each tenant can:

* Use its own master/config data.
* Inherit from the parent tenant (e.g., state-level).

***

## Example Tenancy&#x20;

* **State-level tenant**: e.g., `statea`
* **City-level tenants**: e.g., `statea.citya`, `statea.cityb`

Each tenant has metadata:

* Contact info, address, logo
* District, ULB grade, region
* Coordinates (latitude/longitude)

{% hint style="info" %}
📌 **Tenants ≠ Boundaries**\
Tenants can also represent ministries, departments, or agencies, not just geographical units.
{% endhint %}

{% hint style="info" %}
Tenancy needs to be decided based on the use-case. The sample data for the product comes with a two level hierarchy. This need not be followed for implementations.
{% endhint %}

***

## Tenant Isolation in API Requests

<table><thead><tr><th width="210.59765625">Aspect </th><th>Detail</th></tr></thead><tbody><tr><td>Tenant ID</td><td>Must be passed in every API request (e.g., <code>statea.citya</code>)</td></tr><tr><td>Validated By</td><td>Gateway Service</td></tr><tr><td>Scope of Data Access</td><td>Only within that tenant — no cross-tenant access permitted</td></tr><tr><td>Defined In</td><td><code>tenants</code> master (MDMS module)</td></tr></tbody></table>

***

## External Integrations

* Always **maintain the tenant context** when integrating with 3rd-party systems.
* If external systems lack multi-tenancy support, **handle tenant-specific routing carefully**.

***

## Summary

<table><thead><tr><th width="193.9140625">Feature</th><th>Purpose/Detail</th></tr></thead><tbody><tr><td>Tenant ID</td><td>Identifies the tenant (e.g., <code>pg.citya</code>)</td></tr><tr><td>Scope</td><td>Data, configuration, workflows are tenant-bound</td></tr><tr><td>Defined In</td><td><code>tenant</code> module → <code>tenants</code> master (MDMS)</td></tr><tr><td>Required In APIs</td><td>All requests must include <code>tenantId</code></td></tr><tr><td>Validated By</td><td>Gateway Service</td></tr></tbody></table>

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.digit.org/complaints-management/design/architecture/tenancy.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
