# CDN

Source: https://docs.ezoic.com/docs/api/cdn/


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

See [API](/docs/api/) for how to enable the service, your base URL, and authentication. Every request takes your `developerKey`.

Every endpoint returns the same response shape:

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

## Ping

Verify the server is responding.



```bash
curl -X POST "https://api-gateway.ezoic.com/cdnservices/ping/?developerKey=YOUR_API_KEY"
```



## Clear Cache

Clear the cache for a single URL in all regions.



```bash
curl -X POST "https://api-gateway.ezoic.com/cdnservices/clearcache?developerKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "url": "https://www.example.com/"
}'
```



| 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.



```bash
curl -X POST "https://api-gateway.ezoic.com/cdnservices/bulkclearcache?developerKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "urls": [
    "https://www.example.com/",
    "https://www.example.com/page1",
    "https://www.example.com/page2"
  ]
}'
```



| 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 `/`).



```bash
curl -X POST "https://api-gateway.ezoic.com/cdnservices/clearbysurrogatekeys?developerKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "keys": "key1,key2,keyC",
  "domain": "example.com"
}'
```



| 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 `/`).



```bash
curl -X POST "https://api-gateway.ezoic.com/cdnservices/purgecache?developerKey=YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "domain": "example.com"
}'
```



| Field | Type | Description | Required |
| --- | --- | --- | --- |
| `domain` | string | The bare domain, without subdomain, scheme, or path | required |

