Skip to content
Start here

Update Managed Transforms

PATCH/zones/{zone_id}/managed_headers

Updates the status of one or more Managed Transforms.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Response Compression WriteConfig Settings WriteDynamic URL Redirects WriteCache Settings WriteCustom Errors WriteOrigin WriteManaged headers WriteZone Transform Rules WriteMass URL Redirects WriteMagic Firewall WriteL4 DDoS Managed Ruleset WriteHTTP DDoS Managed Ruleset WriteSanitize WriteTransform Rules WriteSelect Configuration WriteBot Management WriteZone WAF WriteAccount WAF WriteAccount Rulesets WriteLogs WriteLogs Write
Path ParametersExpand Collapse
zone_id: string

The unique ID of the zone.

Body ParametersJSONExpand Collapse
managed_request_headers: array of object { id, enabled, has_conflict, conflicts_with }

The list of Managed Request Transforms.

id: string

The human-readable identifier of the Managed Transform.

minLength1
enabled: boolean

Whether the Managed Transform is enabled.

has_conflict: boolean

Whether the Managed Transform conflicts with the currently-enabled Managed Transforms.

conflicts_with: optional array of string

The Managed Transforms that this Managed Transform conflicts with.

managed_response_headers: array of object { id, enabled, has_conflict, conflicts_with }

The list of Managed Response Transforms.

id: string

The human-readable identifier of the Managed Transform.

minLength1
enabled: boolean

Whether the Managed Transform is enabled.

has_conflict: boolean

Whether the Managed Transform conflicts with the currently-enabled Managed Transforms.

conflicts_with: optional array of string

The Managed Transforms that this Managed Transform conflicts with.

ReturnsExpand Collapse
errors: array of object { message, code, source }

A list of error messages.

message: string

A text description of this message.

minLength1
code: optional number

A unique code for this message.

source: optional object { pointer }

The source of this message.

pointer: string

A JSON pointer to the field that is the source of the message.

minLength1
messages: array of object { message, code, source }

A list of warning messages.

message: string

A text description of this message.

minLength1
code: optional number

A unique code for this message.

source: optional object { pointer }

The source of this message.

pointer: string

A JSON pointer to the field that is the source of the message.

minLength1
result: object { managed_request_headers, managed_response_headers }

A result.

managed_request_headers: array of object { id, enabled, has_conflict, conflicts_with }

The list of Managed Request Transforms.

id: string

The human-readable identifier of the Managed Transform.

minLength1
enabled: boolean

Whether the Managed Transform is enabled.

has_conflict: boolean

Whether the Managed Transform conflicts with the currently-enabled Managed Transforms.

conflicts_with: optional array of string

The Managed Transforms that this Managed Transform conflicts with.

managed_response_headers: array of object { id, enabled, has_conflict, conflicts_with }

The list of Managed Response Transforms.

id: string

The human-readable identifier of the Managed Transform.

minLength1
enabled: boolean

Whether the Managed Transform is enabled.

has_conflict: boolean

Whether the Managed Transform conflicts with the currently-enabled Managed Transforms.

conflicts_with: optional array of string

The Managed Transforms that this Managed Transform conflicts with.

success: true

Whether the API call was successful.

Update Managed Transforms

curl https://api.cloudflare.com/client/v4/zones/$ZONE_ID/managed_headers \
    -X PATCH \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "managed_request_headers": [
            {
              "id": "add_bot_protection_headers",
              "enabled": true
            }
          ],
          "managed_response_headers": [
            {
              "id": "add_security_headers",
              "enabled": true
            }
          ]
        }'
{
  "errors": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "messages": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "result": {
    "managed_request_headers": [
      {
        "id": "add_bot_protection_headers",
        "enabled": true,
        "has_conflict": false,
        "conflicts_with": [
          "add_true_client_ip_headers"
        ]
      }
    ],
    "managed_response_headers": [
      {
        "id": "add_security_headers",
        "enabled": true,
        "has_conflict": false,
        "conflicts_with": [
          "add_true_client_ip_headers"
        ]
      }
    ]
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "messages": [
    {
      "message": "something bad happened",
      "code": 10000,
      "source": {
        "pointer": "/rules/0/action"
      }
    }
  ],
  "result": {
    "managed_request_headers": [
      {
        "id": "add_bot_protection_headers",
        "enabled": true,
        "has_conflict": false,
        "conflicts_with": [
          "add_true_client_ip_headers"
        ]
      }
    ],
    "managed_response_headers": [
      {
        "id": "add_security_headers",
        "enabled": true,
        "has_conflict": false,
        "conflicts_with": [
          "add_true_client_ip_headers"
        ]
      }
    ]
  },
  "success": true
}