---
title: "Deletes a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter. *External storage:* external files are only deleted when you directly delete a file or subfolder of a folder that has external storage configured. If you delete the folder itself, only the mapping is removed. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth."
method: DELETE
path: "/v2/accounts/{accountId}/folders"
tags: ["Folder"]
---

# Deletes a folder asynchronously. You can use ListFolder to preview the operation using the \`dryRun\` parameter. \*External storage:\* external files are only deleted when you directly delete a file or subfolder of a folder that has external storage configured. If you delete the folder itself, only the mapping is removed. Requires a \`secret_\*\` API key. Alternatively, you can use a \`public_\*\` API key and JWT-based auth.

`DELETE /v2/accounts/{accountId}/folders`

## Request

- Base URL: `https://api.bytescale.com`
- URL: `https://api.bytescale.com/v2/accounts/{accountId}/folders`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/bytescale/apis/bytescale-api/docs/v2/accounts/:accountId/folders/delete.ts> (a function with typed inputs; its response is checked against the schema)

Deletes a folder asynchronously.

You can use ListFolder to preview the operation using the `dryRun` parameter.

*External storage:* external files are only deleted when you directly delete a file or subfolder of a folder that has external storage configured. If you delete the folder itself, only the mapping is removed.

Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.

## Path parameters

- `accountId` string, required: Your account ID. This is visible on the settings page: https://www.bytescale.com/dashboard/settings

## Request body

- DeleteFolderRequest: Request body for DeleteFolder. You can use ListFolder to preview the operation using the `dryRun` parameter. *External storage:* external files are only deleted when you directly delete a file or subfolder of a folder that has external storage configured. If you delete the folder itself, only the mapping is removed.
  - `deleteFiles` boolean: If `true` then deletes files. Default: true
  - `deleteVirtualFolders` boolean: If `true` then deletes virtual folders (virtual folders are folders created using the PutFolder operation). Default: true
  - `folderPath` string, required: Absolute path to a folder. Begins with a `/`. Should not end with a `/`.
  - `recursive` boolean: If `true` then deletes files and folder settings that descend `folderPath`. If `false` then only deletes files that are direct children of `folderPath` and only deletes the folder settings of the current folder (if any). Does not delete the folder settings of any child or descendant folders. Default: true

## Response `200`

Success.

- AsyncResponse: Response body from an API endpoint that performs work asynchronously (i.e. does not complete the work immediately).
  - `jobDocs` 'https://www.bytescale.com/docs/job-api/GetJob', required: Link to the documentation that describes how to get a job's status from its job ID.
  - `jobId` string, required: Job ID.
  - `jobType` 'ProcessImageJob' | 'ProcessVideoJob' | 'ProcessAudioJob' | 'AntivirusJob' | 'ResetCacheJob' | 'DeleteFolderBatchJob' | 'DeleteFileBatchJob' | 'CopyFolderBatchJob' | 'CopyFileBatchJob', required: Job type.
  - `jobUrl` string, required: URL for the job's status. You can `GET` this URL to retrieve the job's status. You must authorize your `GET` request with a ```secret_*``` API key when accessing the URL.

## Other responses

- `401`: Unauthenticated.

## Changes

- **2026-09-01** `d63ecdd9ae9c`: 5 warning, 1 info
  - added the new `AntivirusJob` enum value to the `jobType` response property for the response status `200`
  - added the new `ProcessAudioJob` enum value to the `jobType` response property for the response status `200`
  - added the new `ProcessImageJob` enum value to the `jobType` response property for the response status `200`
  - added the new `ProcessVideoJob` enum value to the `jobType` response property for the response status `200`
  - …2 more

[Operation history](https://skmtc.dev/bytescale/apis/bytescale-api/changes/v2/accounts/:accountId/folders/delete.md)

---

[API](https://skmtc.dev/bytescale/apis/bytescale-api.md) - [All operations](https://skmtc.dev/bytescale/apis/bytescale-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bytescale/apis/bytescale-api/revisions/d63ecdd9ae9c?raw)
