|
1 | 1 | --- |
2 | 2 | pcx_content_type: troubleshooting |
3 | | -title: Disable Auto Minify |
| 3 | +title: Turn off Auto Minify via API |
| 4 | +sidebar: |
| 5 | + label: Turn off Auto Minify |
4 | 6 | --- |
5 | 7 |
|
6 | | -If your site is still using deprecated features for [Auto Minify](/fundamentals/api/reference/deprecations/#auto-minify), disable Auto Minify via the Cloudflare dashboard or API. |
| 8 | +If your site is still using deprecated features for [Auto Minify](/fundamentals/api/reference/deprecations/#2024-08-05), turn off Auto Minify via API. |
7 | 9 |
|
8 | | -## Dashboard |
| 10 | +## Before you begin |
9 | 11 |
|
10 | | -To disable Auto Minify via the Cloudflare dashboard: |
| 12 | +You will need an [API token](/fundamentals/api/get-started/create-token/) with the following permissions: |
11 | 13 |
|
12 | | -1. Log into the [Cloudflare Dashboard](https://dash.cloudflare.com). |
13 | | -2. Go to **Speed** > **Optimization**. |
14 | | -3. Go to **Content Optimization**. |
15 | | -4. For **Auto Minify**, deselect all options. |
| 14 | +- _Zone_ > _Zone Settings_ > _Edit_ |
| 15 | +- _Zone_ > _Zone Settings_ > _Read_ |
16 | 16 |
|
17 | | -## API |
| 17 | +## (Optional) Check zone status |
18 | 18 |
|
19 | | -### Before you begin |
| 19 | +To check your zone's Auto Minify status, send a `GET` request to the `/zones/{zone_id}/settings/minify` endpoint. |
20 | 20 |
|
21 | | -You will need: |
22 | | - |
23 | | -- An [API token](/fundamentals/api/get-started/create-token/) with the following permissions: |
24 | | - - `Zone - Zone Settings - Edit` |
25 | | - - `Zone - Zone Settings - Read` |
26 | | - |
27 | | -### (Optional) Check zone status |
28 | | - |
29 | | -To check your zone's Auto Minify status, send a `GET` request to the `/zones/<ZONE_ID>/settings/minify` endpoint. |
30 | | - |
31 | | -```sh title="cURL example" |
32 | | -curl 'https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/settings/minify' \ |
33 | | - --header "Authorization: Bearer <CF_API_TOKEN>" \ |
34 | | - --header "Content-Type: application/json" |
| 21 | +```bash |
| 22 | +curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/settings/minify" \ |
| 23 | +--header "Authorization: Bearer <API_TOKEN>" |
35 | 24 | ``` |
36 | 25 |
|
37 | | -You will get the following response. If any of the values in the highlighted line are `"on"`, then you need to disable them. |
38 | | - |
39 | | -```json title="Example response" {4} |
| 26 | +```json output {4} |
40 | 27 | { |
41 | | - "result": { |
42 | | - "id": "minify", |
43 | | - "value": { "css": "off", "html": "off", "js": "off" }, |
44 | | - "modified_on": null, |
45 | | - "editable": true |
46 | | - }, |
47 | | - "success": true, |
48 | | - "errors": [], |
49 | | - "messages": [] |
| 28 | + "result": { |
| 29 | + "id": "minify", |
| 30 | + "value": { "css": "off", "html": "off", "js": "off" }, |
| 31 | + "modified_on": null, |
| 32 | + "editable": true |
| 33 | + }, |
| 34 | + "success": true, |
| 35 | + "errors": [], |
| 36 | + "messages": [] |
50 | 37 | } |
51 | 38 | ``` |
52 | 39 |
|
53 | | -### Disable with the API |
| 40 | +If any of the values in the highlighted line are `"on"`, then you need to turn them off. |
54 | 41 |
|
55 | | -To disable Auto Minify for your zone, send a `PATCH` request to the `/zones/<ZONE_ID>/settings/minify` endpoint. |
| 42 | +## Turn off Auto Minify using the API |
56 | 43 |
|
57 | | -```sh title="cURL example" |
58 | | -curl -X PATCH 'https://api.cloudflare.com/client/v4/zones/<ZONE_ID>/settings/minify' \ |
59 | | - --header "Authorization: Bearer <CF_API_TOKEN>" \ |
60 | | - --header "Content-Type: application/json" \ |
61 | | - -d '{"value":{"css":"off","html":"off","js":"off"}}' |
62 | | -``` |
| 44 | +To turn off Auto Minify for your zone, send a `PATCH` request to the `/zones/{zone_id}/settings/minify` endpoint. The value for `success` in the response should be `true`. |
63 | 45 |
|
64 | | -If successful, you will get something similar to this response. The value for `success` should be `true`. |
| 46 | +```bash |
| 47 | +curl --request PATCH \ |
| 48 | +"https://api.cloudflare.com/client/v4/zones/{zone_id}/settings/minify" \ |
| 49 | +--header "Authorization: Bearer <API_TOKEN>" \ |
| 50 | +--header "Content-Type: application/json" \ |
| 51 | +--data '{ "value": { "css": "off","html": "off","js": "off" } }' |
| 52 | +``` |
65 | 53 |
|
66 | | -```json title="Example disabled response" {8} |
| 54 | +```json output {8} |
67 | 55 | { |
68 | | - "result": { |
69 | | - "id": "minify", |
70 | | - "value": { "js": "off", "css": "off", "html": "off" }, |
71 | | - "modified_on": "2024-08-15T19:32:20.882640Z", |
72 | | - "editable": true |
73 | | - }, |
74 | | - "success": true, |
75 | | - "errors": [], |
76 | | - "messages": [] |
| 56 | + "result": { |
| 57 | + "id": "minify", |
| 58 | + "value": { "js": "off", "css": "off", "html": "off" }, |
| 59 | + "modified_on": "2024-11-15T19:32:20.882640Z", |
| 60 | + "editable": true |
| 61 | + }, |
| 62 | + "success": true, |
| 63 | + "errors": [], |
| 64 | + "messages": [] |
77 | 65 | } |
78 | 66 | ``` |
0 commit comments