---
hide_title: false
hide_table_of_contents: false
pagination_next: null
pagination_prev: null
---

# purgeSurrogateKey

The **`purgeSurrogateKey()`** function is used to purge the given surrogate key string from Fastly's cache.

There are two purge modes: soft purge and hard purge, with hard purge as the default which clears all items
from the cache immediately. When using a soft purge, stale entries are maintained in the cache, reducing
orgin load, while also enabling stale revalidations.

See the [Fastly Purge Documentation](https://www.fastly.com/documentation/guides/concepts/edge-state/cache/purging/#surrogate-key-purge) for more information on caching and purge operations.

## Syntax

```js
purgeSurrogateKey(surrogateKey, soft?)
```

### Parameters

- `surrogateKey` _: string_
  - The surrogate key string
- `soft?` _: boolean_
  - Enables a soft purge, retaining stale entries in the cache. Default is a hard purge.

### Return value

`undefined`.
