Create folder
post
https://api.imagekit.io
/v1/folder/
Create folder API

Response structure and status code

On success, you will receive a 201 status code with an empty body.

Examples

Here is the example request to understand the API usage.
cURL
Node.js
Python
PHP
Java
Ruby
Go
curl -X POST "https://api.imagekit.io/v1/folder/" \
-H 'Content-Type: application/json' \
-u your_private_key: -d '
{
"folderName" : "new_folder",
"parentFolderPath" : "source/folder/path"
}
'
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.createFolder({
folderName: "new_folder",
parentFolderPath: "source/folder/path"
}, 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/'
)
create_folder = imagekit.create_folder(options=CreateFolderRequestOptions(folder_name="test", parent_folder_path="/"))
print("Create folder-", create_folder, end="\n\n")
# Raw Response
print(create_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
);
$folderName = 'new_folder';
$parentFolderPath = 'source/folder/path';
$createFolder = $imageKit->createFolder([
'folderName' => $folderName,
'parentFolderPath' => $parentFolderPath,
]);
echo("Create Folder : " . json_encode($createFolder));
CreateFolderRequest createFolderRequest = new CreateFolderRequest();
createFolderRequest.setFolderName("new_folder");
createFolderRequest.setParentFolderPath("source/folder/path");
ResultEmptyBlock resultEmptyBlock = ImageKit.getInstance().createFolder(createFolderRequest);
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
imagekitio.create_folder(folder_name: 'new_folder', parent_folder_path: 'source/folder/path')
resp, err := ik.Media.CreateFolder(ctx, media.CreateFolderParam{
FolderName: "new_folder",
ParentFolderPath: "source/folder/path"
}
Copy link
On this page
post
Create folder API
Response structure and status code
Examples