---
title: Purging with surrogate keys
summary: null
url: >-
  https://www.fastly.com/documentation/guides/full-site-delivery/purging/purging-with-surrogate-keys
---

Fastly provides several levels of cache purging and choosing the right purging method is essential to keeping your website fast. While Fastly's [purge all](https://www.fastly.com/documentation/guides/full-site-delivery/purging/purging-all-content) is a speedy way to invalidate your cache, it may temporarily increase your website's load time while the cache rebuilds. If you find yourself purging all cache on more than a weekly basis, consider using [surrogate keys](https://www.fastly.com/documentation/guides/full-site-delivery/purging/working-with-surrogate-keys) for more targeted purging.

Surrogate keys are unique identifiers that you assign to portions of content that share common traits, making them easier to process as groups in some way. Using the `Surrogate-Key` header, you can tag an object, such as an image or a blog post, with one or more keys. When you need to explicitly remove content from the Fastly edge cache, rather than allowing it to expire or to be evicted, you can use surrogate keys to purge groups of content selectively instead of purging all content.

This guide describes how to use the Fastly control panel to purge surrogate keys. You can also purge surrogate keys using the [Fastly API](https://www.fastly.com/documentation/reference/api/purging/#purge-tag) and [CLI](https://www.fastly.com/documentation/reference/cli/service/purge/).

## Before you begin

This guide assumes you're already familiar with how to [work with the `Surrogate-Key` header](https://www.fastly.com/documentation/guides/full-site-delivery/purging/working-with-surrogate-keys) to tag related pieces of cacheable content.

## Purging objects with surrogate keys

You can use the Fastly control panel to manually purge objects via key:

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2.   From the [**Home**](https://manage.fastly.com/home) page, select the appropriate service. You can use the search box to search by ID, name, or domain.

3. From the **Purge** menu, select **Purge key**.

   ![a purge by url](/img/purge-key-example.png)

4. In the **Keys** field, enter one or more surrogate keys. Use spaces to separate multiple keys.

5. _(Optional)_ Select the [Soft purge](https://www.fastly.com/documentation/guides/full-site-delivery/purging/soft-purges) checkbox to mark your content as outdated instead of deleting it from cache.

6. Click **Purge**.

> **HINT:** In Compute services, the simple cache interface provides an edge-accessible mechanism for purging an object by key, available in each language [SDK](https://www.fastly.com/documentation/reference/compute/sdks).

## Troubleshooting

If you're having trouble executing a surrogate key purge, or if the purge appears to have no effect, check the following:

- **Surrogate key capitalization:** Surrogate keys are case sensitive. Ensure the case of the key specified in your purge request matches that on the content.
- **Keys present on cached content:** To determine which keys are present on a piece of cached content, use the `Fastly-Debug: 1` header. See the instructions on [using a Fastly-Debug header with curl](https://www.fastly.com/documentation/guides/full-site-delivery/caching/checking-cache#using-a-fastly-debug-header-with-curl) for more information.
- **Stale content settings:** If your purge was executed as a soft purge, your service may continue to serve the pre-purge content based on your [stale content settings](https://www.fastly.com/documentation/guides/full-site-delivery/performance/serving-stale-content/).

## What's next

Explore the other purging methods available with Fastly such as [purging a URL](https://www.fastly.com/documentation/guides/full-site-delivery/purging/purging-a-url) and [purging all content](https://www.fastly.com/documentation/guides/full-site-delivery/purging/purging-all-content).

## Related content

- [Purging best practices](https://www.fastly.com/documentation/guides/full-site-delivery/purging/purging-best-practices)
- [Purging API documentation](https://www.fastly.com/documentation/reference/api/purging/)
