Cache purge API

You can programmatically purge CDN cache using purge API.

post
Cache purge API

https://api.websonic.io/v1/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
env
required
string
Specify the environment. It could be stage or prod.
urls
required
array
Array of URLs for which you want to purge CDN cache.
Response
200: OK
On success, you will receive a request ID returned in JSON-encoded response body.
{
requestId : "5d75bd483b6e5a21dc57a134"
}

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.

Examples

Here are some example requests to understand the API usage.

curl -X POST "https://api.websonic.io/v1/purge" \
-H "content-type: application/json" \
-u your_private_key: -d'
{
"urls": [
"https://www.example.com/page1.html",
"https://www.example.com/page2.html"
],
"env" : "prod"
}
'