---
title: Purging
summary: Instant Purging removes content from Fastly immediately so it can be refreshed from your origin servers. While the default approach for issuing an individual URL Instant Purge uses the Fastly API, <code>https://api.fastly.com/</code>, it is not required.
url: https://www.fastly.com/documentation/reference/api/purging
---

Instant Purging removes content from Fastly immediately so it can be refreshed from your origin servers. While the default approach for issuing an individual URL Instant Purge uses the Fastly API, <code>https://api.fastly.com/</code>, it is not required.

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `surrogate_keys` | array |  |
| `id` | string | Alphanumeric string identifying a Purging. (Read-only) |

## API endpoints

### Purge a URL

**POST** `/purge/{cached_url}`

Instant Purge an individual URL.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `cached_url` | string | path | Yes | URL of object in cache to be purged. |
| `fastly-soft-purge` | integer | header | No | If present, this header triggers the purge to be 'soft', which marks the affected object as stale rather than making it inaccessible.  Typically set to "1" when used, but the value is not important. |

### Purge everything from a service

**POST** `/service/{service_id}/purge_all`

Instant Purge everything from a service.
Purge-all requests cannot be done in soft mode and will always immediately invalidate all cached content associated with the service. To do a soft-purge-all, consider applying a constant <a href="https://www.fastly.com/documentation/guides/full-site-delivery/purging/working-with-surrogate-keys/">surrogate key</a> tag (e.g., <code>"all"</code>) to all objects.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |

### Purge by surrogate key tag

**POST** `/service/{service_id}/purge/{surrogate_key}`

Instant Purge a particular service of items tagged with a Surrogate Key. Only one surrogate key can be purged at a time. Multiple keys can be purged using a batch surrogate key purge request.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `fastly-soft-purge` | integer | header | No | If present, this header triggers the purge to be 'soft', which marks the affected object as stale rather than making it inaccessible.  Typically set to "1" when used, but the value is not important. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `surrogate_key` | string | path | Yes | Surrogate keys are used to efficiently purge content from cache. Instead of purging your entire site or individual URLs, you can tag related assets (like all images and descriptions associated with a single product) with surrogate keys, and these grouped URLs can be purged in a single request. |

### Purge multiple surrogate key tags

**POST** `/service/{service_id}/purge`

Instant Purge a particular service of items tagged with surrogate keys. Up to 256 surrogate keys can be purged in one batch request. As an alternative to sending the keys in a JSON object in the body of the request, this endpoint also supports listing keys in a <code>Surrogate-Key</code> request header, e.g. <code>Surrogate-Key: key_1 key_2 key_3</code>.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `fastly-soft-purge` | integer | header | No | If present, this header triggers the purge to be 'soft', which marks the affected object as stale rather than making it inaccessible.  Typically set to "1" when used, but the value is not important. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `surrogate-key` | string | header | No | Purge multiple surrogate key tags using a request header. Not required if a JSON POST body is specified. |

