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

# Delete Department

> Delete a department (soft delete by default)

## Authentication

This endpoint requires authentication with a Bearer token. Only users with **Super Admin** or **HR Manager** roles can delete departments.

<ParamField path="id" type="string" required>
  The unique identifier of the department to delete
</ParamField>

## Query Parameters

<ParamField query="hard_delete" type="boolean" default="false">
  If `true`, permanently deletes the department. If `false` or omitted, performs a soft delete.
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="message" type="string">
  Confirmation message
</ResponseField>

<RequestExample>
  ```bash Soft Delete theme={null}
  curl -X DELETE https://api.companyflow.com/departments/{id} \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```bash Hard Delete theme={null}
  curl -X DELETE "https://api.companyflow.com/departments/{id}?hard_delete=true" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "message": "department deleted"
  }
  ```

  ```json 400 - Bad Request theme={null}
  {
    "success": false,
    "message": "invalid department id"
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "success": false,
    "message": "insufficient role"
  }
  ```

  ```json 500 - Internal Server Error theme={null}
  {
    "success": false,
    "message": "failed to delete department"
  }
  ```
</ResponseExample>

<Note>
  Soft delete marks the department as deleted but preserves the data in the database. Hard delete permanently removes the department record.
</Note>
