> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hydradb.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List Sub-Tenant IDs

> List all sub-tenants that have indexed data under a tenant.

## When to use it

* **Audit** – confirm which sub-tenants exist for compliance or usage reporting
* **Bulk operations** – iterate over sub-tenants to apply the same operation to each
* **Dynamic UI** – populate dropdowns or selectors in admin dashboards

A sub-tenant appears in this list only if it currently has indexed data (knowledge or memories).

## Endpoint

* **Auth:** Bearer token
* **Idempotency:** Read-only
* **Async:** No

## Example

<CodeGroup>
  ```bash cURL theme={"dark"}
  curl 'https://api.hydradb.com/tenants/sub_tenant_ids?tenant_id=my_first_tenant' \
    -H "Authorization: Bearer <your_api_key>"
  ```

  ```typescript TypeScript SDK theme={"dark"}
  const response = await client.tenant.getSubTenantIds({
    tenant_id: "my_first_tenant"
  });
  const subTenantIds = response.sub_tenant_ids;
  ```

  ```python Python SDK theme={"dark"}
  response = client.tenant.get_sub_tenant_ids(tenant_id="my_first_tenant")
  sub_tenant_ids = response.sub_tenant_ids
  ```
</CodeGroup>

## Query parameters

| Name        | Type   | Required | Description                         |
| ----------- | ------ | -------- | ----------------------------------- |
| `tenant_id` | string | Yes      | The tenant to list sub-tenants for. |

## Response

```json theme={"dark"}
{
  "sub_tenant_ids": ["engineering", "sales", "hr", "user_12345"],
  "message": "Successfully retrieved sub-tenant IDs"
}
```

| Field            | Description                                       |
| ---------------- | ------------------------------------------------- |
| `sub_tenant_ids` | Array of unique sub-tenant IDs with indexed data. |
| `message`        | Human-readable status.                            |

## Related endpoints

* **Before this:** [Upload knowledge](/api-reference/endpoint/upload-knowledge) · [Add memory](/api-reference/endpoint/add-memory) – sub-tenants are created implicitly during ingestion
* **Related:** [List data](/api-reference/endpoint/list-data) – browse content within a specific sub-tenant

## Errors

Common codes: `400 INVALID_PARAMETERS`, `404 TENANT_NOT_FOUND`. See [Error Responses](/api-reference/error-responses) for the full list.

Read more: [Essentials → Multi-Tenant Support](/essentials/multi-tenant)


## OpenAPI

````yaml GET /tenants/sub_tenant_ids
openapi: 3.1.0
info:
  title: HydraDB API
  description: REST APIs for the HydraDB retrieval engine
  version: 0.0.1
servers:
  - url: https://api.hydradb.com
    description: Production
    x-fern-server-name: hydradb-prod
security: []
paths:
  /tenants/sub_tenant_ids:
    get:
      tags:
        - tenants
      summary: Get Sub Tenant Ids
      operationId: get_sub_tenant_ids_tenants_sub_tenant_ids_get
      parameters:
        - name: tenant_id
          in: query
          required: true
          schema:
            type: string
            title: Tenant Id
            description: Unique identifier for the tenant/organization
            example: tenant_1234
          description: Unique identifier for the tenant/organization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubTenantIdsResponse'
        '400':
          description: Bad Request - Invalid input parameters
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/cortex__models__response__commons__ActualErrorResponse
        '401':
          description: Unauthorized - Authentication required
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/cortex__models__response__commons__ActualErrorResponse
        '403':
          description: Forbidden - Access denied
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/cortex__models__response__commons__ActualErrorResponse
        '404':
          description: Not Found - Resource does not exist
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/cortex__models__response__commons__ActualErrorResponse
        '422':
          description: Unprocessable Entity - Validation failed
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/cortex__models__response__commons__ActualErrorResponse
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/cortex__models__response__commons__ActualErrorResponse
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/cortex__models__response__commons__ActualErrorResponse
      security:
        - HTTPBearer: []
components:
  schemas:
    SubTenantIdsResponse:
      properties:
        sub_tenant_ids:
          items:
            type: string
          type: array
          title: Sub Tenant Ids
          description: >-
            Unique sub-tenant IDs that have indexed data in the tenant's
            collections
          example:
            - sub_tenant_1234
            - sub_tenant_4567
        message:
          type: string
          title: Message
          description: Summary message
          default: Successfully retrieved sub-tenant IDs
      type: object
      title: SubTenantIdsResponse
      description: Response for listing unique sub-tenant IDs in a tenant (from Milvus).
    cortex__models__response__commons__ActualErrorResponse:
      properties:
        detail:
          $ref: >-
            #/components/schemas/cortex__models__response__commons__ErrorResponse
      type: object
      required:
        - detail
      title: ActualErrorResponse
    cortex__models__response__commons__ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: false
          example: true
        message:
          type: string
          title: Message
          default: Error occurred
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ErrorResponse
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````