Delete file version
delete
https://api.imagekit.io
/v1/files/:fileId/versions/:versionId
Delete file version API

Response structure and status code (application/JSON)

In case of an error, you will get an error code along with the error message. On success, you will receive a 200 status code with the file details in JSON-encoded response body.

Examples

Here is the example request to understand the API usage.
cURL
Node.js
Python
PHP
Java
Ruby
Go
# The unique fileId and versionId of the uploaded file. fileId and versionId (versionInfo.id) is returned in response of list files API and upload API.
curl -X DELETE "https://api.imagekit.io/v1/files/file_id/versions/version_id" \
-u your_private_api_key:
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/"
});
var fileId = "file_id";
var versionId = "version_id"
imagekit.deleteFileVersion({
fileId,
versionId
}, 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_file_version = imagekit.delete_file_version(file_id="file_id", version_id="version_id")
print("Delete file version-", delete_file_version, end="\n\n")
# Raw Response
print(delete_file_version.response_metadata.raw)
$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
);
$fileId = 'file_id';
$versionId = 'version_id';
$deleteFileVersion = $imageKit->deleteFileVersion($fileId, $versionId);
DeleteFileVersionRequest deleteFileVersionRequest = new DeleteFileVersionRequest();
deleteFileVersionRequest.setFileId("file_id");
deleteFileVersionRequest.setVersionId("version_id");
ResultNoContent resultNoContent = ImageKit.getInstance().deleteFileVersion(deleteFileVersionRequest);
imagekitio.delete_file_version(
file_id: 'file_id',
version_id: 'version_id'
)
resp, err := ik.Media.DeleteFileVersion(ctx, "file_id", "version_id")
Copy link
On this page
delete
Delete file version API
Response structure and status code (application/JSON)
Examples