Delete folder
delete
https://api.imagekit.io
/v1/folder/
Delete folder API

Response structure and status code

In case of an error, you will get an error code along with the error message. On success, you will receive a 204 status code with an empty body.

Examples

Here is the example request to understand the API usage.
cURL
Node.js
Python
PHP
Java
Ruby
Untitled
Untitled
curl -X DELETE "https://api.imagekit.io/v1/folder/" \
-H 'Content-Type: application/json' \
-u your_private_key: -d '
{
"folderPath" : "folder/to/delete/"
}
'
var ImageKit = require("imagekit");
var imagekit = new ImageKit({
publicKey : "your_public_api_key",
privateKey : "your_private_api_key",
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
});
imagekit.deleteFolder("folder/to/delete/", function(error, result) {
if(error) console.log(error);
else console.log(result);
});
from imagekitio import ImageKit
imagekit = ImageKit(
public_key='your_public_api_key',
private_key='your_private_api_key',
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
)
delete_folder = imagekit.delete_folder(options=DeleteFolderRequestOptions(folder_path="/test/demo"))
print("Delete folder-", delete_folder, end="\n\n")
# Raw Response
print(delete_folder.response_metadata.raw)
use ImageKit\ImageKit;
$public_key = "your_public_api_key";
$your_private_key = "your_private_api_key";
$url_end_point = "https://ik.imagekit.io/your_imagekit_id";
$imageKit = new ImageKit(
$public_key,
$your_private_key,
$url_end_point
);
$folderPath = 'folder/to/delete/';
$deleteFolder = $imageKit->deleteFolder($folderPath);
echo("Delete Folder : " . json_encode($deleteFolder));
DeleteFolderRequest deleteFolderRequest = new DeleteFolderRequest();
deleteFolderRequest.setFolderPath("folder/to/delete/");
ResultNoContent resultNoContent = ImageKit.getInstance().deleteFolder(deleteFolderRequest);
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
imagekitio.delete_folder(folder_path: 'folder/to/delete/')
[% tab title="Go" %}
resp, err := ik.Media.DeleteFolder(ctx, media.DeleteFolderParam{
FolderPath: "folder/to/delete/",
})
Copy link
On this page
delete
Delete folder API
Response structure and status code
Examples