Manually purge the GraphQL edge cache

GraphCDN automatically creates a custom GraphQL API, the "Purging API", for your service that allows you to purge your cache. Purging the cache globally takes at most 150ms.

To try the purging API, head to the "Purging API" tab on your service's dashboard.

Note that in most cases you don't need to manually purge because of Automatic Mutation Invalidation!

Programmatic usage

The URL structure for the purging API is:<service-name>


To use your service's purging API you need to authenticate with a Purging API Token. To create a new one, go to your service's "Settings" tab and navigate to the "Purging API Tokens" section.

You might already see some tokens in the list called something like "dashboard-74asd8" that you did not create. This is nothing to worry about. When you navigate to the "Purging API" tab on your service's dashboard we automatically create a new token so you can try it out without having to create one manually.

To send a request to the purging API you need to send the purging API token in the graphcdn-token header.

For example, here is how to access the API from Node.js:

const fetch = require('node-fetch')
async function purgeAllPosts() {
await fetch('<>', {
method: 'POST', // Always POST purge mutations
headers: {
'Content-Type': 'application/json', // and specify the Content-Type
'graphcdn-token': 'das09dja09sjda0s9ja...',
body: JSON.stringify({ query: `mutation { purgePost }` }),
purgeAllPosts().catch((e) => console.error(e))

If you want to try it in the GraphQL playground use the "HTTP Headers" tab at the bottom.

The purging API gives you access to fine-grained purging mutations that you can use to invalidate any data that has changed right from your backend.

Note that it's preferable to purge as fine-grained as possible. The less data you invalidate the higher your cache hit rate will be.

Purge all occurrences of a specific object

The most specific purge mutation possible. Use this unless you have a reason not to!

You can purge all queries that contain a specific object/node, for example the User with the id 5:

mutation {
purgeUser(id: [5])

Of course, since this is GraphQL, you can purge as many specific objects/nodes as you want at once:

mutation {
purgeUser(id: [1, 2, 5, 7])
purgePost(id: [12, 13])

Purging by GraphQL query name

With this mutation, you can purge all cached results of the query with the name(s) you provide. For example, to invalidate all listUsers and listPosts query results:

mutation {
_purgeQuery(queries: [listUsers, listPosts])

Note that this mutation has an underscore in front of it as we don't want this generic name to conflict with your specific types.

Purging all occurrences of a GraphQL type

You can purge all query results that contain any instance of an object. For example, to purge all cached results of queries that have any user in them, simply purge all users by not passing the id argument:

mutation {

Purging everything (advanced)

BE CAREFUL: Purging all queries will temporarily increase traffic to your origin server while we don't have anything cached anymore. Use this sparingly as a last resort and make sure your origin servers can handle the resulting traffic spike.

You can purge all cached results GraphCDN has stored with the special _purgeAll mutation. Be extra careful when using this, as it will cause a traffic spike to your origin server.