# Cache ## Purge Cached Content **post** `/zones/{zone_id}/purge_cache` ### Purge All Cached Content Removes ALL files from Cloudflare's cache. All tiers can purge everything. ``` {"purge_everything": true} ``` ### Purge Cached Content by URL Granularly removes one or more files from Cloudflare's cache by specifying URLs. All tiers can purge by URL. To purge files with custom cache keys, include the headers used to compute the cache key as in the example. If you have a device type or geo in your cache key, you will need to include the CF-Device-Type or CF-IPCountry headers. If you have lang in your cache key, you will need to include the Accept-Language header. **NB:** When including the Origin header, be sure to include the **scheme** and **hostname**. The port number can be omitted if it is the default port (80 for http, 443 for https), but must be included otherwise. Single file purge example with files: ``` {"files": ["http://www.example.com/css/styles.css", "http://www.example.com/js/index.js"]} ``` Single file purge example with url and header pairs: ``` {"files": [{url: "http://www.example.com/cat_picture.jpg", headers: { "CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN" }}, {url: "http://www.example.com/dog_picture.jpg", headers: { "CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US" }}]} ``` ### Purge Cached Content by Tag, Host or Prefix Granularly removes one or more files from Cloudflare's cache either by specifying the host, the associated Cache-Tag, or a Prefix. Flex purge with tags: ``` {"tags": ["a-cache-tag", "another-cache-tag"]} ``` Flex purge with hosts: ``` {"hosts": ["www.example.com", "images.example.com"]} ``` Flex purge with prefixes: ``` {"prefixes": ["www.example.com/foo", "images.example.com/bar/baz"]} ``` ### Availability and limits please refer to [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits). ### Path Parameters - `zone_id: string` ### Body Parameters - `body: { tags } or { hosts } or { prefixes } or 3 more` - `CachePurgeFlexPurgeByTags { tags }` - `tags: optional array of string` For more information on cache tags and purging by tags, please refer to [purge by cache-tags documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/). - `CachePurgeFlexPurgeByHostnames { hosts }` - `hosts: optional array of string` For more information purging by hostnames, please refer to [purge by hostname documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/). - `CachePurgeFlexPurgeByPrefixes { prefixes }` - `prefixes: optional array of string` For more information on purging by prefixes, please refer to [purge by prefix documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/). - `CachePurgeEverything { purge_everything }` - `purge_everything: optional boolean` For more information, please refer to [purge everything documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/). - `CachePurgeSingleFile { files }` - `files: optional array of string` For more information on purging files, please refer to [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). - `CachePurgeSingleFileWithURLAndHeaders { files }` - `files: optional array of { headers, url }` For more information on purging files with URL and headers, please refer to [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). - `headers: optional map[string]` - `url: optional string` ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: boolean` Indicates the API call's success or failure. - `result: optional { id }` - `id: string` ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/purge_cache \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "tags": [ "a-cache-tag", "another-cache-tag" ] }' ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353" } } ``` ## Domain Types ### Cache Purge Response - `CachePurgeResponse { id }` - `id: string` # Cache Reserve ## Get Cache Reserve setting **get** `/zones/{zone_id}/cache/cache_reserve` Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information. ### Path Parameters - `zone_id: string` Identifier. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/cache_reserve \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "errors": [], "messages": [], "result": { "editable": true, "id": "cache_reserve", "value": "off" }, "success": true } ``` ## Change Cache Reserve setting **patch** `/zones/{zone_id}/cache/cache_reserve` Increase cache lifetimes by automatically storing all cacheable files into Cloudflare's persistent object storage buckets. Requires Cache Reserve subscription. Note: using Tiered Cache with Cache Reserve is highly recommended to reduce Reserve operations costs. See the [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) for more information. ### Path Parameters - `zone_id: string` Identifier. ### Body Parameters - `value: "on" or "off"` Value of the Cache Reserve zone setting. - `"on"` - `"off"` ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/cache_reserve \ -X PATCH \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "value": "on" }' ``` #### Response ```json { "errors": [], "messages": [], "result": { "editable": true, "id": "cache_reserve", "value": "on" }, "success": true } ``` ## Get Cache Reserve Clear **get** `/zones/{zone_id}/cache/cache_reserve_clear` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. ### Path Parameters - `zone_id: string` Identifier. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, start_ts, state, 2 more }` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: string` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: optional string` The time that the latest Cache Reserve Clear operation completed. - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/cache_reserve_clear \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "errors": [], "messages": [], "result": { "end_ts": "2023-10-02T12:00:00.12345Z", "id": "cache_reserve_clear", "start_ts": "2023-10-02T10:00:00.12345Z", "state": "Completed" }, "success": true } ``` ## Start Cache Reserve Clear **post** `/zones/{zone_id}/cache/cache_reserve_clear` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. ### Path Parameters - `zone_id: string` Identifier. ### Body Parameters - `body: unknown` ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, start_ts, state, 2 more }` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: string` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: optional string` The time that the latest Cache Reserve Clear operation completed. - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/cache_reserve_clear \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{}' ``` #### Response ```json { "errors": [], "messages": [], "result": { "id": "cache_reserve_clear", "start_ts": "2023-10-02T10:00:00.12345Z", "state": "In-progress" }, "success": true } ``` ## Domain Types ### Cache Reserve - `CacheReserve = "cache_reserve"` The identifier of the caching setting. - `"cache_reserve"` ### Cache Reserve Clear - `CacheReserveClear = "cache_reserve_clear"` ID of the zone setting. - `"cache_reserve_clear"` ### State - `State = "In-progress" or "Completed"` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` ### Cache Reserve Get Response - `CacheReserveGetResponse { id, editable, value, modified_on }` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Cache Reserve Edit Response - `CacheReserveEditResponse { id, editable, value, modified_on }` - `id: CacheReserve` The identifier of the caching setting. - `"cache_reserve"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Cache Reserve zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Cache Reserve Status Response - `CacheReserveStatusResponse { id, start_ts, state, 2 more }` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: string` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: optional string` The time that the latest Cache Reserve Clear operation completed. - `modified_on: optional string` Last time this setting was modified. ### Cache Reserve Clear Response - `CacheReserveClearResponse { id, start_ts, state, 2 more }` You can use Cache Reserve Clear to clear your Cache Reserve, but you must first disable Cache Reserve. In most cases, this will be accomplished within 24 hours. You cannot re-enable Cache Reserve while this process is ongoing. Keep in mind that you cannot undo or cancel this operation. - `id: CacheReserveClear` ID of the zone setting. - `"cache_reserve_clear"` - `start_ts: string` The time that the latest Cache Reserve Clear operation started. - `state: State` The current state of the Cache Reserve Clear operation. - `"In-progress"` - `"Completed"` - `end_ts: optional string` The time that the latest Cache Reserve Clear operation completed. - `modified_on: optional string` Last time this setting was modified. # Smart Tiered Cache ## Get Smart Tiered Cache setting **get** `/zones/{zone_id}/cache/tiered_cache_smart_topology_enable` Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin. ### Path Parameters - `zone_id: string` Identifier. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: "tiered_cache_smart_topology_enable"` The identifier of the caching setting. - `"tiered_cache_smart_topology_enable"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Smart Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/tiered_cache_smart_topology_enable \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tiered_cache_smart_topology_enable", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Patch Smart Tiered Cache setting **patch** `/zones/{zone_id}/cache/tiered_cache_smart_topology_enable` Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin. ### Path Parameters - `zone_id: string` Identifier. ### Body Parameters - `value: "on" or "off"` Enable or disable the Smart Tiered Cache. - `"on"` - `"off"` ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: "tiered_cache_smart_topology_enable"` The identifier of the caching setting. - `"tiered_cache_smart_topology_enable"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Smart Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/tiered_cache_smart_topology_enable \ -X PATCH \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "value": "on" }' ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tiered_cache_smart_topology_enable", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete Smart Tiered Cache setting **delete** `/zones/{zone_id}/cache/tiered_cache_smart_topology_enable` Smart Tiered Cache dynamically selects the single closest upper tier for each of your website’s origins with no configuration required, using our in-house performance and routing data. Cloudflare collects latency data for each request to an origin, and uses the latency data to determine how well any upper-tier data center is connected with an origin. As a result, Cloudflare can select the data center with the lowest latency to be the upper-tier for an origin. ### Path Parameters - `zone_id: string` Identifier. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, modified_on }` - `id: "tiered_cache_smart_topology_enable"` The identifier of the caching setting. - `"tiered_cache_smart_topology_enable"` - `editable: boolean` Whether the setting is editable. - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/tiered_cache_smart_topology_enable \ -X DELETE \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tiered_cache_smart_topology_enable", "editable": true, "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Domain Types ### Smart Tiered Cache Get Response - `SmartTieredCacheGetResponse { id, editable, value, modified_on }` - `id: "tiered_cache_smart_topology_enable"` The identifier of the caching setting. - `"tiered_cache_smart_topology_enable"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Smart Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Smart Tiered Cache Edit Response - `SmartTieredCacheEditResponse { id, editable, value, modified_on }` - `id: "tiered_cache_smart_topology_enable"` The identifier of the caching setting. - `"tiered_cache_smart_topology_enable"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Smart Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Smart Tiered Cache Delete Response - `SmartTieredCacheDeleteResponse { id, editable, modified_on }` - `id: "tiered_cache_smart_topology_enable"` The identifier of the caching setting. - `"tiered_cache_smart_topology_enable"` - `editable: boolean` Whether the setting is editable. - `modified_on: optional string` Last time this setting was modified. # Variants ## Get variants setting **get** `/zones/{zone_id}/cache/variants` Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers. ### Path Parameters - `zone_id: string` Identifier. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: "variants"` The identifier of the caching setting. - `"variants"` - `editable: boolean` Whether the setting is editable. - `value: { avif, bmp, gif, 8 more }` Value of the zone setting. - `avif: optional array of string` List of strings with the MIME types of all the variants that should be served for avif. - `bmp: optional array of string` List of strings with the MIME types of all the variants that should be served for bmp. - `gif: optional array of string` List of strings with the MIME types of all the variants that should be served for gif. - `jp2: optional array of string` List of strings with the MIME types of all the variants that should be served for jp2. - `jpeg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpeg. - `jpg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg. - `jpg2: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg2. - `png: optional array of string` List of strings with the MIME types of all the variants that should be served for png. - `tif: optional array of string` List of strings with the MIME types of all the variants that should be served for tif. - `tiff: optional array of string` List of strings with the MIME types of all the variants that should be served for tiff. - `webp: optional array of string` List of strings with the MIME types of all the variants that should be served for webp. - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/variants \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "variants", "editable": true, "value": { "avif": [ "image/webp", "image/jpeg" ], "bmp": [ "image/webp", "image/jpeg" ], "gif": [ "image/webp", "image/jpeg" ], "jp2": [ "image/webp", "image/avif" ], "jpeg": [ "image/webp", "image/avif" ], "jpg": [ "image/webp", "image/avif" ], "jpg2": [ "image/webp", "image/avif" ], "png": [ "image/webp", "image/avif" ], "tif": [ "image/webp", "image/avif" ], "tiff": [ "image/webp", "image/avif" ], "webp": [ "image/jpeg", "image/avif" ] }, "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Change variants setting **patch** `/zones/{zone_id}/cache/variants` Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers. ### Path Parameters - `zone_id: string` Identifier. ### Body Parameters - `value: { avif, bmp, gif, 8 more }` Value of the zone setting. - `avif: optional array of string` List of strings with the MIME types of all the variants that should be served for avif. - `bmp: optional array of string` List of strings with the MIME types of all the variants that should be served for bmp. - `gif: optional array of string` List of strings with the MIME types of all the variants that should be served for gif. - `jp2: optional array of string` List of strings with the MIME types of all the variants that should be served for jp2. - `jpeg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpeg. - `jpg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg. - `jpg2: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg2. - `png: optional array of string` List of strings with the MIME types of all the variants that should be served for png. - `tif: optional array of string` List of strings with the MIME types of all the variants that should be served for tif. - `tiff: optional array of string` List of strings with the MIME types of all the variants that should be served for tiff. - `webp: optional array of string` List of strings with the MIME types of all the variants that should be served for webp. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: "variants"` The identifier of the caching setting. - `"variants"` - `editable: boolean` Whether the setting is editable. - `value: { avif, bmp, gif, 8 more }` Value of the zone setting. - `avif: optional array of string` List of strings with the MIME types of all the variants that should be served for avif. - `bmp: optional array of string` List of strings with the MIME types of all the variants that should be served for bmp. - `gif: optional array of string` List of strings with the MIME types of all the variants that should be served for gif. - `jp2: optional array of string` List of strings with the MIME types of all the variants that should be served for jp2. - `jpeg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpeg. - `jpg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg. - `jpg2: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg2. - `png: optional array of string` List of strings with the MIME types of all the variants that should be served for png. - `tif: optional array of string` List of strings with the MIME types of all the variants that should be served for tif. - `tiff: optional array of string` List of strings with the MIME types of all the variants that should be served for tiff. - `webp: optional array of string` List of strings with the MIME types of all the variants that should be served for webp. - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/variants \ -X PATCH \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "value": {} }' ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "variants", "editable": true, "value": { "avif": [ "image/webp", "image/jpeg" ], "bmp": [ "image/webp", "image/jpeg" ], "gif": [ "image/webp", "image/jpeg" ], "jp2": [ "image/webp", "image/avif" ], "jpeg": [ "image/webp", "image/avif" ], "jpg": [ "image/webp", "image/avif" ], "jpg2": [ "image/webp", "image/avif" ], "png": [ "image/webp", "image/avif" ], "tif": [ "image/webp", "image/avif" ], "tiff": [ "image/webp", "image/avif" ], "webp": [ "image/jpeg", "image/avif" ] }, "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Delete variants setting **delete** `/zones/{zone_id}/cache/variants` Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers. ### Path Parameters - `zone_id: string` Identifier. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, modified_on }` - `id: "variants"` The identifier of the caching setting. - `"variants"` - `editable: boolean` Whether the setting is editable. - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/variants \ -X DELETE \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "variants", "editable": true, "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Domain Types ### Cache Variant - `CacheVariant { id, modified_on }` Variant support enables caching variants of images with certain file extensions in addition to the original. This only applies when the origin server sends the 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but does not serve the variant requested, the response will not be cached. This will be indicated with BYPASS cache status in the response headers. - `id: "variants"` ID of the zone setting. - `"variants"` - `modified_on: optional string` Last time this setting was modified. ### Variant Get Response - `VariantGetResponse { id, editable, value, modified_on }` - `id: "variants"` The identifier of the caching setting. - `"variants"` - `editable: boolean` Whether the setting is editable. - `value: { avif, bmp, gif, 8 more }` Value of the zone setting. - `avif: optional array of string` List of strings with the MIME types of all the variants that should be served for avif. - `bmp: optional array of string` List of strings with the MIME types of all the variants that should be served for bmp. - `gif: optional array of string` List of strings with the MIME types of all the variants that should be served for gif. - `jp2: optional array of string` List of strings with the MIME types of all the variants that should be served for jp2. - `jpeg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpeg. - `jpg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg. - `jpg2: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg2. - `png: optional array of string` List of strings with the MIME types of all the variants that should be served for png. - `tif: optional array of string` List of strings with the MIME types of all the variants that should be served for tif. - `tiff: optional array of string` List of strings with the MIME types of all the variants that should be served for tiff. - `webp: optional array of string` List of strings with the MIME types of all the variants that should be served for webp. - `modified_on: optional string` Last time this setting was modified. ### Variant Edit Response - `VariantEditResponse { id, editable, value, modified_on }` - `id: "variants"` The identifier of the caching setting. - `"variants"` - `editable: boolean` Whether the setting is editable. - `value: { avif, bmp, gif, 8 more }` Value of the zone setting. - `avif: optional array of string` List of strings with the MIME types of all the variants that should be served for avif. - `bmp: optional array of string` List of strings with the MIME types of all the variants that should be served for bmp. - `gif: optional array of string` List of strings with the MIME types of all the variants that should be served for gif. - `jp2: optional array of string` List of strings with the MIME types of all the variants that should be served for jp2. - `jpeg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpeg. - `jpg: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg. - `jpg2: optional array of string` List of strings with the MIME types of all the variants that should be served for jpg2. - `png: optional array of string` List of strings with the MIME types of all the variants that should be served for png. - `tif: optional array of string` List of strings with the MIME types of all the variants that should be served for tif. - `tiff: optional array of string` List of strings with the MIME types of all the variants that should be served for tiff. - `webp: optional array of string` List of strings with the MIME types of all the variants that should be served for webp. - `modified_on: optional string` Last time this setting was modified. ### Variant Delete Response - `VariantDeleteResponse { id, editable, modified_on }` - `id: "variants"` The identifier of the caching setting. - `"variants"` - `editable: boolean` Whether the setting is editable. - `modified_on: optional string` Last time this setting was modified. # Regional Tiered Cache ## Get Regional Tiered Cache setting **get** `/zones/{zone_id}/cache/regional_tiered_cache` Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies. ### Path Parameters - `zone_id: string` Identifier. ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: RegionalTieredCache` The identifier of the caching setting. - `"tc_regional"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Regional Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/regional_tiered_cache \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tc_regional", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Change Regional Tiered Cache setting **patch** `/zones/{zone_id}/cache/regional_tiered_cache` Instructs Cloudflare to check a regional hub data center on the way to your upper tier. This can help improve performance for smart and custom tiered cache topologies. ### Path Parameters - `zone_id: string` Identifier. ### Body Parameters - `value: "on" or "off"` Value of the Regional Tiered Cache zone setting. - `"on"` - `"off"` ### Returns - `errors: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `pointer: optional string` - `messages: array of ResponseInfo` - `code: number` - `message: string` - `documentation_url: optional string` - `source: optional { pointer }` - `success: true` Whether the API call was successful. - `true` - `result: optional { id, editable, value, modified_on }` - `id: RegionalTieredCache` The identifier of the caching setting. - `"tc_regional"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Regional Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Example ```http curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/cache/regional_tiered_cache \ -X PATCH \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ -d '{ "value": "on" }' ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "tc_regional", "editable": true, "value": "on", "modified_on": "2014-01-01T05:20:00.12345Z" } } ``` ## Domain Types ### Regional Tiered Cache - `RegionalTieredCache = "tc_regional"` The identifier of the caching setting. - `"tc_regional"` ### Regional Tiered Cache Get Response - `RegionalTieredCacheGetResponse { id, editable, value, modified_on }` - `id: RegionalTieredCache` The identifier of the caching setting. - `"tc_regional"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Regional Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified. ### Regional Tiered Cache Edit Response - `RegionalTieredCacheEditResponse { id, editable, value, modified_on }` - `id: RegionalTieredCache` The identifier of the caching setting. - `"tc_regional"` - `editable: boolean` Whether the setting is editable. - `value: "on" or "off"` Value of the Regional Tiered Cache zone setting. - `"on"` - `"off"` - `modified_on: optional string` Last time this setting was modified.