---
title: "Purge cache"
method: POST
path: "/cdn/resources/{resource_id}/purge"
tags: ["Tools"]
---

# Purge cache

`POST /cdn/resources/{resource_id}/purge`

Delete cache from CDN servers. This is necessary to update CDN content.

We have different limits for different purge types:
- **Purge all cache** - One purge request for a CDN resource per minute.
- **Purge by URL** - Two purge requests for a CDN resource per minute. One purge request is limited to 100 URLs.
- **Purge by pattern** - One purge request for a CDN resource per minute. One purge request is limited to 10 patterns.

## Path parameters

- `resource_id` integer, required

## Request body

- union
  - object
    - `urls` string[] — **Purge by URL** clears the cache of a specific files. This purge type is recommended. Specify file URLs including query strings. URLs should start with / without a domain name. Purge by URL depends on the following CDN options: 1. "vary response header" is used. If your origin serves variants of the same content depending on the Vary HTTP response header, purge by URL will delete only one version of the file. 2. "slice" is used. If you update several files in the origin without clearing the CDN cache, purge by URL will delete only the first slice (with bytes=0… .) 3. "ignoreQueryString" is used. Don’t specify parameters in the purge request. 4. "query_params_blacklist" is used. Only files with the listed in the option parameters will be cached as different objects. Files with other parameters will be cached as one object. In this case, specify the listed parameters in the Purge request. Don't specify other parameters. 5. "query_params_whitelist" is used. Files with listed in the option parameters will be cached as one object. Files with other parameters will be cached as different objects. In this case, specify other parameters (if any) besides the ones listed in the purge request.
  - object
    - `paths` string[] — **Purge by pattern** clears the cache that matches the pattern. Use * operator, which replaces any number of symbols in your path. It's important to note that wildcard usage (*) is permitted only at the end of a pattern. Query string added to any patterns will be ignored, and purge request will be processed as if there weren't any parameters. Purge by pattern is recursive. Both /path and /path* will result in recursive purging, meaning all content under the specified path will be affected. As such, using the pattern /path* is functionally equivalent to simply using /path.
  - object
    - `paths` string[] — **Purge all cache** clears the entire cache for the CDN resource. Specify an empty array to purge all content for the resource. When you purge all assets, CDN servers request content from your origin server and cause a high load. Therefore, we recommend to use purge by URL for large content quantities.

## Response `201`

Successful.

## Other responses

- `400` — Failed to purge the CDN resource cache.
- `429` — You have exceeded number of allowed purge requests for your CDN resource.

---

[API](https://skmtc.dev/g-core/apis/gcore-openapi.md) · [All operations](https://skmtc.dev/g-core/apis/gcore-openapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/g-core/gcore-openapi/revisions/09e652815095/schema)
