Purging API

Edge caching is a performance optimization strategy implemented in your GraphQL API to cache responses in proximity to the end-users. This technique significantly cuts down overall latency, augmenting the speed of data delivery.

More granular control over the purging of the cache can be done via the Admin API.

The Admin API URL is available at: https://[project-slug].grafbase.app/admin.

You'll need to send the header x-api-key with an API key for your project.

This API is typically useful if you mutate data not using the GraphQL API.

If you use use the GraphQL API to mutate data, you should consider using the automatic mutationInvalidation option instead.

You can use the Admin API to purge a type, list, and entity. This directly relates to the tags referenced in mutationInvalidation.

The format of each input type consists of:

  • PurgeTypeInput — Purges all cached values that have the provided Type
  • PurgeListInput — Purges all cached values that have lists of the provided Type
  • PurgeEntityInput — Purges all cached values that have the provided Type and the given fields
mutation { cachePurgeTypes(input: { type: { type: "MyTypename" } }) { tags } }

You can purge the entire cache for your project using the cachePurgeAll mutation:

mutation { cachePurgeAll { hostname } }
Was this page helpful?