Skip to content

Cache Invalidation

Storyblok uses a Content Delivery Network (CDN) to deliver content as fast as possible. To have a high cache hit rate for published content, Storyblok uses a cv parameter (cache version), which is a Unix timestamp.

The most up-to-date cv value of a space can be retrieved with an API call excluding the cv parameter:

https://api.storyblok.com/v2/cdn/spaces/me/?token=YOUR_TOKEN

The API response will contain a cv value that can be used in subsequent API requests to receive the latest version of the content. In order to handle cache invalidation, the cv value needs to be stored in memory. Furthermore, it needs to be updated when certain criteria are met. For example, Storyblok’s webhook events may be used to invalidate the cache whenever content is published, updated, or deleted.

curl "https://api.storyblok.com/v2/cdn/spaces/me?token=wANpEQEsMYGOwLxwXQ76Ggtt"
Example Response
{
"space": {
"domain": "https://storyblok.com/",
"id": 123456,
"name": "Example Space",
"version": 1706094649
}
}
curl "https://api.storyblok.com/v2/cdn/stories?cv=1541863983&token=wANpEQEsMYGOwLxwXQ76Ggtt"