Delete file
You can programmatically delete uploaded files in the media library using delete file API.
If a file or specific transformation has been requested in the past, then the response is cached. Deleting a file does not purge the cache. You can purge the cache using purge API.
Delete file API
DELETE
https://api.imagekit.io/v1/files/:fileId
Deletes a file and all its versions from the media library.
Path Parameters
Name | Type | Description |
---|---|---|
fileId | string | The unique fileId of the uploaded file. |
Headers
Name | Type | Description |
---|---|---|
Authorization | string | base64 encoding of Note the colon in the end. |
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.
Last updated