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

# Delete Folder

> Delete a folder and optionally all of its contents recursively.

## Request Body

<ParamField body="drive_id" type="string" required>
  The ID of the drive containing the folder.
</ParamField>

<ParamField body="path" type="string" required>
  The path of the folder to delete.
</ParamField>

<ParamField body="confirm" type="boolean">
  When `false` or omitted, returns a preview of how many files would be deleted. Set to `true` to perform the recursive deletion.
</ParamField>

<RequestExample>
  ```bash cURL (Preview) theme={null}
  curl -X DELETE https://api.getagentdrive.com/v0/folders \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "drive_id": "drv_abc123",
      "path": "documents/old/"
    }'
  ```

  ```bash cURL (Confirm) theme={null}
  curl -X DELETE https://api.getagentdrive.com/v0/folders \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "drive_id": "drv_abc123",
      "path": "documents/old/",
      "confirm": true
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 Preview theme={null}
  {
    "path": "documents/old/",
    "file_count": 15,
    "message": "This folder contains 15 files. Set confirm to true to delete."
  }
  ```

  ```json 200 Confirmed theme={null}
  {
    "success": true,
    "deleted_count": 15
  }
  ```
</ResponseExample>

## Response (Preview)

<ResponseField name="path" type="string">
  The path of the folder.
</ResponseField>

<ResponseField name="file_count" type="integer">
  The number of files that would be deleted.
</ResponseField>

<ResponseField name="message" type="string">
  A human-readable message describing the impact of the deletion.
</ResponseField>

## Response (Confirmed)

<ResponseField name="success" type="boolean">
  Whether the deletion was successful.
</ResponseField>

<ResponseField name="deleted_count" type="integer">
  The number of files that were deleted.
</ResponseField>
