> ## 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.

# Delete Tenant

> Permanently delete a tenant and all its data.

## When to use it

* **Offboarding** – a customer has churned and you need to remove their data
* **Environment teardown** – delete test or staging tenants
* **Compliance** – right-to-deletion requests under GDPR or similar

<Warning>
  **This operation is irreversible.** Deleting a tenant permanently removes:

  * Graph database storage
  * Vector store collections (knowledge and memory)
  * Source documents
  * Chunk data
  * Tenant metadata schema
  * Tenant ID mapping

  This data cannot be recovered.
</Warning>

## Endpoint

* **Auth:** Bearer token
* **Idempotency:** Re-sending for a deleted tenant returns `404 TENANT_NOT_FOUND`
* **Async:** Yes – returns `deletion_scheduled`. Cleanup runs in the background.

## Example

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

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

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

## Query parameters

| Name        | Type   | Required | Description           |
| ----------- | ------ | -------- | --------------------- |
| `tenant_id` | string | Yes      | The tenant to delete. |

## Response

```json theme={"dark"}
{
  "tenant_id": "my_first_tenant",
  "status": "deletion_scheduled",
  "message": "Tenant deregistered. Background cleanup is in progress."
}
```

| Field       | Description                                           |
| ----------- | ----------------------------------------------------- |
| `tenant_id` | The tenant scheduled for deletion.                    |
| `status`    | Always `deletion_scheduled`. Cleanup is asynchronous. |
| `message`   | Human-readable status.                                |

## Behavior notes

<Info>
  **Cleanup is asynchronous.** Deletion runs in the background and is typically complete within a few minutes. Treat deletion as eventually consistent.
</Info>

<Info>
  **Re-creation.** Once deletion is scheduled, re-creating a tenant with the same `tenant_id` may fail until cleanup completes. If you need to re-create immediately, use a different `tenant_id`.
</Info>

## Related endpoints

* **Before this:** [List data](/api-reference/endpoint/list-data) – confirm what's stored before deleting
* **Alternative:** [Delete knowledge](/api-reference/endpoint/delete-knowledge) · [Delete memory](/api-reference/endpoint/delete-memory) – remove individual items instead of the whole tenant

## Errors

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


## OpenAPI

````yaml DELETE /tenants/delete
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/delete:
    delete:
      tags:
        - tenants
      summary: Delete Tenant
      operationId: delete_tenant_tenants_delete_delete
      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/TenantDeleteResponse'
        '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:
    TenantDeleteResponse:
      properties:
        tenant_id:
          type: string
          title: Tenant Id
          description: Identifier provided by user
          example: tenant_1234
        status:
          type: string
          title: Status
          default: deletion_scheduled
        message:
          type: string
          title: Message
          default: Tenant deregistered. Background cleanup is in progress.
      type: object
      required:
        - tenant_id
      title: TenantDeleteResponse
    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

````