Purge cache status
get
https://api.imagekit.io
/v1/files/purge/:requestId
Purge cache status 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 purge request status in a JSON-encoded response body.

Understanding the response

The JSON-encoded response will have status property.
Field
Description
status
The current status of a submitted purge request. It can be either:
  • Pending - The request has been successfully submitted, and purging is in progress.
  • Completed - The purge request has been successfully completed. And now you should get a fresh object. Check the Age header in response to confirm this.

Examples

Here are some example requests to understand the API usage.
cURL
Node.js
Python
PHP
Java
Ruby
1
# requestId returned in response of purge cache API.
2
curl -X GET "https://api.imagekit.io/v1/files/purge/requestId" \
3
-u your_private_key:
Copied!
1
var ImageKit = require("imagekit");
2
3
var imagekit = new ImageKit({
4
publicKey : "your_public_api_key",
5
privateKey : "your_private_api_key",
6
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
7
});
8
9
imagekit.getPurgeCacheStatus("cache_request_id", function(error, result) {
10
if(error) console.log(error);
11
else console.log(result);
12
});
Copied!
1
from imagekitio import ImageKit
2
3
imagekit = ImageKit(
4
public_key='your_public_api_key',
5
private_key='your_private_api_key',
6
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
7
)
8
9
purge_cache_status = imagekit.get_purge_cache_status("cache_request_id")
10
11
print("Cache status-", purge_cache_status)
Copied!
1
use ImageKit\ImageKit;
2
3
$public_key = "your_public_api_key";
4
$your_private_key = "your_private_api_key";
5
$url_end_point = "https://ik.imagekit.io/your_imagekit_id";
6
7
$imageKit = new ImageKit(
8
$public_key,
9
$your_private_key,
10
$url_end_point
11
);
12
13
$purgeCacheStatus = $imageKit->purgeCacheApiStatus("cache_request_id");
14
15
echo("Purge cache status : " . json_encode($purgeCacheStatus));
Copied!
1
ResultCacheStatus result=ImageKit.getInstance().getPurgeCacheStatus("cache_request_id");
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
purge_cache_status = imagekitio.purge_file_cache_status(request_id: "cache_request_id")
Copied!
Last modified 1mo ago