Edgio

Purge (Clear-Cache) REST API

Purge content through the clear-cache endpoint.

Authentication

Authenticate API requests by passing a deploy token throgh the x-api-key header.
To create a deploy token
  1. From the Edgio Console, select the desired private space or organization.
  2. Select the desired property.
  3. From the left-hand pane, select Settings.
  4. From the Deploy Tokens section, click Create new Deploy Token.

Methods

clear-cache

POST https://edgio.app/api/v1/clear-cache
Purges entries from the cache for a specific environment. You can purge specific paths or surrogate keys. If no paths or surrogate keys are provided all entries will be purged.

Request Headers

The following request headers are required:
  • x-api-key: A property’s deploy token
  • content-type: "application/json"

Body

Provide the following parameters as JSON in the post body. Note that only one of the optional arguments can be passed at a time, for example paths and surrogateKeys cannot be cleared at once.
JSON
1{
2 "team": "the organization name",
3 "site": "the property name",
4 "environment": "the environment name",
5 "paths": ["Optional. An array of paths to clear. Use * as a wildcard."],
6 "surrogateKeys": ["Optional. An array of surrogate keys to clear"],
7 "cacheHashes": ["Optional. An array of cache hashes to clear"]
8}

Example:

JavaScript
1const fetch = require('node-fetch')
2
3const deployToken = '*****'
4const team = 'my-organization'
5const site = 'my-property'
6const environment = 'production'
7const paths = ['/some/path']
8
9async function clearCache() {
10 const res = await fetch('https://edgio.app/api/v1/clear-cache', {
11 method: 'POST',
12 headers: {
13 'content-type': 'application/json',
14 'x-api-key': deployToken,
15 },
16 body: JSON.stringify({
17 team,
18 site,
19 environment,
20 paths,
21 }),
22 })
23
24 console.log('Status:', res.status, res.statusText)
25 console.log('Body:', await res.text())
26}
27
28clearCache()