Purge cache

post
Purge cache API

https://api.imagekit.io/v1/files/purge
This will purge CDN and ImageKit.io internal cache.
Request
Response
Request
Headers
Authorization
required
string
base64 encoding of your_private_api_key: Note the colon in the end.
Body Parameters
url
required
string
The exact URL of the file to be purged. For example - https://ik.imageki.io/your_imagekit_id/rest-of-the-file-path.jpg
Response
200: OK
On success, you will receive a requestId which can be used to get the purge request status.
{
requestId : "598821f949c0a938d57563bd"
}

Response structure and status code

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 request ID returned in JSON-encoded response body.

requestId can be used to fetch the status of submitted purge request.

Limitations

Purge API has following limitations:

  • An account can issue a maximum of 1000 purge requests in a month. Please reach out to us at support@imagekit.io if you need to increase this limit.

  • Purge API doesn't accept wildcard in url. Please reach out to us at support@imagekit.io if you need to purge all images on a specific pattern.

Examples

Here are some example requests to understand the API usage.

cURL
cURL
curl -X POST "https://api.imagekit.io/v1/files/purge" \
-H "content-type: application/json" \
-u your_private_key: -d'
{
"url": "https://ik.imagekit.io/your_imagekit_id/default-image.jpg"
}
'