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
- From the Edgio Console, select the desired private space or organization.
- Select the desired property.
- From the left-hand pane, select Settings.
- 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 tokencontent-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')23const deployToken = '*****'4const team = 'my-organization'5const site = 'my-property'6const environment = 'production'7const paths = ['/some/path']89async 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 })2324 console.log('Status:', res.status, res.statusText)25 console.log('Body:', await res.text())26}2728clearCache()