## Change variants setting `client.cache.variants.edit(VariantEditParamsparams, RequestOptionsoptions?): VariantEditResponse` **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. ### Parameters - `params: VariantEditParams` - `zone_id: string` Path param: Identifier. - `value: Value` Body param: Value of the zone setting. - `avif?: Array` List of strings with the MIME types of all the variants that should be served for avif. - `bmp?: Array` List of strings with the MIME types of all the variants that should be served for bmp. - `gif?: Array` List of strings with the MIME types of all the variants that should be served for gif. - `jp2?: Array` List of strings with the MIME types of all the variants that should be served for jp2. - `jpeg?: Array` List of strings with the MIME types of all the variants that should be served for jpeg. - `jpg?: Array` List of strings with the MIME types of all the variants that should be served for jpg. - `jpg2?: Array` List of strings with the MIME types of all the variants that should be served for jpg2. - `png?: Array` List of strings with the MIME types of all the variants that should be served for png. - `tif?: Array` List of strings with the MIME types of all the variants that should be served for tif. - `tiff?: Array` List of strings with the MIME types of all the variants that should be served for tiff. - `webp?: Array` List of strings with the MIME types of all the variants that should be served for webp. ### Returns - `VariantEditResponse` - `id: "variants"` The identifier of the caching setting. - `"variants"` - `editable: boolean` Whether the setting is editable. - `value: Value` Value of the zone setting. - `avif?: Array` List of strings with the MIME types of all the variants that should be served for avif. - `bmp?: Array` List of strings with the MIME types of all the variants that should be served for bmp. - `gif?: Array` List of strings with the MIME types of all the variants that should be served for gif. - `jp2?: Array` List of strings with the MIME types of all the variants that should be served for jp2. - `jpeg?: Array` List of strings with the MIME types of all the variants that should be served for jpeg. - `jpg?: Array` List of strings with the MIME types of all the variants that should be served for jpg. - `jpg2?: Array` List of strings with the MIME types of all the variants that should be served for jpg2. - `png?: Array` List of strings with the MIME types of all the variants that should be served for png. - `tif?: Array` List of strings with the MIME types of all the variants that should be served for tif. - `tiff?: Array` List of strings with the MIME types of all the variants that should be served for tiff. - `webp?: Array` List of strings with the MIME types of all the variants that should be served for webp. - `modified_on?: string | null` Last time this setting was modified. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const response = await client.cache.variants.edit({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', value: {}, }); console.log(response.id); ``` #### 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" } } ```