View as Markdown

CDN

The CDN API lets your server clear and purge cached content on the Ezoic CDN. Its endpoints live under /cdnservices/.

See API for how to enable the service, your base URL, and authentication. Examples below send your API key in the X-API-Key header.

Every endpoint returns the same response shape:

{"Success":true,"Error":""}

Ping

Verify the server is responding.

curl -X POST "https://api-gateway.ezoic.com/cdnservices/ping/" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json"
import requests

url = "https://api-gateway.ezoic.com/cdnservices/ping/"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}

response = requests.post(url, headers=headers)
print(response.json())
<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/ping/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;

Clear Cache

Clear the cache for a single URL in all regions.

curl -X POST "https://api-gateway.ezoic.com/cdnservices/clearcache" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "url": "https://www.example.com/"
}'
import requests

url = "https://api-gateway.ezoic.com/cdnservices/clearcache"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
payload = """{
  "url": "https://www.example.com/"
}"""

response = requests.post(url, headers=headers, data=payload)
print(response.json())
<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/clearcache");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
  "url": "https://www.example.com/"
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Field Type Description Required
url string The URL whose cache to clear required

Bulk Clear Cache

Clear the cache for an array of URLs, in batches of 100.

curl -X POST "https://api-gateway.ezoic.com/cdnservices/bulkclearcache" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "urls": [
    "https://www.example.com/",
    "https://www.example.com/page1",
    "https://www.example.com/page2"
  ]
}'
import requests

url = "https://api-gateway.ezoic.com/cdnservices/bulkclearcache"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
payload = """{
  "urls": [
    "https://www.example.com/",
    "https://www.example.com/page1",
    "https://www.example.com/page2"
  ]
}"""

response = requests.post(url, headers=headers, data=payload)
print(response.json())
<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/bulkclearcache");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
  "urls": [
    "https://www.example.com/",
    "https://www.example.com/page1",
    "https://www.example.com/page2"
  ]
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Field Type Description Required
urls list<string> The URLs whose cache to clear required

Clear by Surrogate Keys

Clear the cache for a comma-separated list of surrogate keys.

For domain, do not include a subdomain (such as www.), a scheme (such as http:// or https://), or a path (such as /).

curl -X POST "https://api-gateway.ezoic.com/cdnservices/clearbysurrogatekeys" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "keys": "key1,key2,keyC",
  "domain": "example.com"
}'
import requests

url = "https://api-gateway.ezoic.com/cdnservices/clearbysurrogatekeys"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
payload = """{
  "keys": "key1,key2,keyC",
  "domain": "example.com"
}"""

response = requests.post(url, headers=headers, data=payload)
print(response.json())
<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/clearbysurrogatekeys");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
  "keys": "key1,key2,keyC",
  "domain": "example.com"
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Field Type Description Required
keys string Comma-separated surrogate keys required
domain string The bare domain, without subdomain, scheme, or path required

Purge Cache

Purge the entire CDN cache for a domain.

For domain, do not include a subdomain (such as www.), a scheme (such as http:// or https://), or a path (such as /).

curl -X POST "https://api-gateway.ezoic.com/cdnservices/purgecache" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "domain": "example.com"
}'
import requests

url = "https://api-gateway.ezoic.com/cdnservices/purgecache"
headers = {"X-API-Key": "YOUR_API_KEY", "Content-Type": "application/json"}
payload = """{
  "domain": "example.com"
}"""

response = requests.post(url, headers=headers, data=payload)
print(response.json())
<?php
$ch = curl_init("https://api-gateway.ezoic.com/cdnservices/purgecache");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: YOUR_API_KEY", "Content-Type: application/json"]);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{
  "domain": "example.com"
}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Field Type Description Required
domain string The bare domain, without subdomain, scheme, or path required