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

# Delete department

> Permanently deletes a department together with all its sub-departments. This cannot be undone. The approvers configured on the deleted departments are deleted, and employees linked to any of them are left without a department. Nothing is changed if the request fails. The organization's root department cannot be deleted. Returns 403 when the organization does not exist or the authenticated user is not an administrator of it. Returns 404 when the department does not exist or belongs to a different organization.




## OpenAPI

````yaml /openapi/findity-admin-api.json delete /organizations/{organizationId}/departments/{departmentId}
openapi: 3.1.0
info:
  title: Findity Admin API
  description: Findity Admin API
  version: 1.0.0
servers:
  - url: https://stage-api.findity.com/api/v1/admin
  - url: https://api.findity.com/api/v1/admin
security:
  - bearerAuth: []
paths:
  /organizations/{organizationId}/departments/{departmentId}:
    delete:
      tags:
        - Departments
      summary: Delete department
      description: >
        Permanently deletes a department together with all its sub-departments.
        This cannot be undone. The approvers configured on the deleted
        departments are deleted, and employees linked to any of them are left
        without a department. Nothing is changed if the request fails. The
        organization's root department cannot be deleted. Returns 403 when the
        organization does not exist or the authenticated user is not an
        administrator of it. Returns 404 when the department does not exist or
        belongs to a different organization.
      operationId: adminDeleteDepartment
      parameters:
        - name: organizationId
          in: path
          required: true
          description: >
            String. The organization's internal ID (32-character hex string) or
            its `externalSourceId`. When the value matches the format of an
            internal ID, the internal ID takes precedence.
          schema:
            type: string
            example: 11adfe2a080040e3892ffb89c21ec44e
        - name: departmentId
          in: path
          required: true
          description: >
            String. The ID of the department to delete, as returned in the `id`
            field of the response. Lookup by `externalSourceId` is not supported
            for departments, unlike `organizationId`.
          schema:
            type: string
            example: 9360d03ad7294220868d67f42a2a144d
      responses:
        '204':
          description: No Content — department and its sub-departments successfully deleted
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400Error'
              examples:
                Deleting the root department:
                  value:
                    result: error
                    code: CANNOT_DELETE_ROOT_DEPARTMENT
                    description: Cannot delete the organization's root department.
                Inconsistent department data:
                  value:
                    result: error
                    code: DEPARTMENT_DELETE_CONFLICT
                    description: >-
                      The department cannot be deleted because its data is
                      inconsistent.
        '403':
          description: Forbidden — organization not found or access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/403Error'
              examples:
                Organization not found or access denied:
                  value:
                    result: error
                    description: Organization not found or access denied
        '404':
          description: Not found — department does not exist
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/404Error'
              examples:
                Department not found:
                  value:
                    result: error
                    code: DEPARTMENT_NOT_FOUND
                    description: Department not found
components:
  schemas:
    400Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
    403Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
      example:
        result: error
        description: Not allowed
    404Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
      example:
        result: error
        code: ORGANIZATION_NOT_FOUND
        description: 'Failed to get organization for id: {orgId}'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````