requestId
returned in the response of purge cache API.your_private_api_key:
Note the colon in the end.Pending
or Completed
{status : "Pending" // or "Completed"}
In case of 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.
The JSON-encoded response will have status
property.
Field | Description |
status | The current status of a submitted purge request. It can be either:
|
Here are some example requests to understand the API usage.
# requestId returned in response of purge cache API.curl -X GET "https://api.imagekit.io/v1/files/purge/requestId" \-u your_private_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/"});​imagekit.getPurgeCacheStatus("cache_request_id", function(error, result) {if(error) console.log(error);else console.log(result);});
from imagekitio import ImageKit​imagekit = ImageKit(private_key='your_public_api_key',public_key='your_private_api_key',url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/')​purge_cache_status = imagekit.get_purge_cache_status("cache_request_id")​print("Cache status-", purge_cache_status)
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);​$purgeCacheStatus = $imageKit->purgeCacheApiStatus("cache_request_id");​echo("Purge cache status : " . json_encode($purgeCacheStatus));
ResultCacheStatus result=ImageKit.getInstance().getPurgeCacheStatus("cache_request_id");
imagekitio = ImageKit::ImageKitClient.new("your_private_key", "your_public_key", "your_url_endpoint")purge_cache_status = imagekitio.purge_file_cache_status("cache_request_id")