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

# Delete a tenant

> Delete an existing tenant and deactivate the related organization. A tenant from the user's own organization cannot be deleted. A tenant cannot be deleted if the organization has more than one tenant.



## OpenAPI

````yaml /en/api-reference/openapi.en-v1.json delete /v1/organizations/{organization_id}/tenants/{tenant_id}
openapi: 3.0.3
info:
  title: Public Portal API
  version: 1.0.0
  description: Public REST API for portal
servers:
  - url: https://api.staging.flxwvdexternal.com
    description: Staging API server.
security:
  - bearerAuth: []
tags: []
paths:
  /v1/organizations/{organization_id}/tenants/{tenant_id}:
    delete:
      tags:
        - Tenants
      summary: Delete a tenant
      description: >-
        Delete an existing tenant and deactivate the related organization. A
        tenant from the user's own organization cannot be deleted. A tenant
        cannot be deleted if the organization has more than one tenant.
      operationId: deleteTenant
      parameters:
        - name: organization id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: The unique identifier of the tenant's owning organization
          example: 507f1f77bcf86cd799439011
        - name: tenant_id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: The unique identifier of the tenant to be deleted
          example: 507f1f77bcf86cd799439020
      responses:
        '204':
          description: >-
            Tenant deleted successfully. The related organization has been
            deactivated. No content is returned in the response body.
        '400':
          $ref: '#/components/responses/BadRequest'
          description: >-
            Invalid request. Common causes: - Invalid path parameters - Invalid
            tenant ID format
        '401':
          $ref: '#/components/responses/Unauthorized'
          description: >-
            Unauthorized: authentication required or user does not have
            permissions to delete the tenant. Also returned when attempting to
            delete a tenant from the user's own organization.
        '404':
          $ref: '#/components/responses/NotFound'
          description: Tenant not found
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
          description: >-
            Unprocessable entity: business logic validation error. Common
            causes: - Cannot delete a tenant with sub-tenants (organization has
            more than one tenant) - Cannot delete a tenant from its own
            organization
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnprocessableEntity:
      description: Unprocessable Entity
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````