You can programmatically delete uploaded files in media library using delete file API.
When you delete a file, all its transformations are also deleted. However, if a file or specific transformation has been requested in the past, then the response is cached in CDN. You can purge the cache from the CDN using purge API.
fileIdis returned in list files API and upload API
your_private_api_key:Note the colon in the end.
In case of error, you will get an error code along with the error message. On success, you will receive a
204 status code with empty body.
Here is the example request to understand the API usage.
# The unique fileId of the uploaded file. fileId is returned in response of list files API and upload API.curl -X DELETE "https://api.imagekit.io/v1/files/fileId" \-u your_private_key: