Search + K

Command Palette

Search for a command to run...

Sign In

Update a WAF rule

Deprecated
PATCH /zones/{zone_id}/firewall/waf/packages/{package_id}/rules/{rule_id}
Copy endpoint
https://api.cloudflare.com/client/v4

Updates a WAF rule. You can only update the mode/action of the rule.

Note: Applies only to the previous version of WAF managed rules.

Parameters

path Path Parameters

Name Type
rule_id required
type WafManagedRulesIdentifier = string
package_id required
type WafManagedRulesIdentifier = string
zone_id required
type WafManagedRulesSchemasIdentifier = string

Request Body

application/json required
{ mode?: "default" | "disable" | "simulate" | "block" | "challenge" | "on" | "off"; }

Responses

200 application/json

Update a WAF rule response.

type WafManagedRulesRuleResponseSingle = type WafManagedRulesApiResponseSingle = never & { result?: {}; } & { result?: WafManagedRulesAnomalyRule

When triggered, anomaly detection WAF rules contribute to an overall threat score that will determine if a request is considered malicious. You can configure the total scoring threshold through the 'sensitivity' property of the WAF package.

type WafManagedRulesAnomalyRule = never
| WafManagedRulesTraditionalDenyRule

When triggered, traditional WAF rules cause the firewall to immediately act upon the request based on the configuration of the rule. A 'deny' rule will immediately respond to the request based on the configured rule action/mode (for example, 'block') and no other rules will be processed.

type WafManagedRulesTraditionalDenyRule = WafManagedRulesBase & { allowed_modes?: WafManagedRulesAllowedModesDenyTraditional;default_mode?: WafManagedRulesDefaultMode;mode?: WafManagedRulesModeDenyTraditional; }
| WafManagedRulesTraditionalAllowRule

When triggered, traditional WAF rules cause the firewall to immediately act on the request based on the rule configuration. An 'allow' rule will immediately allow the request and no other rules will be processed.

type WafManagedRulesTraditionalAllowRule = WafManagedRulesBase & { allowed_modes?: WafManagedRulesAllowedModesAllowTraditional;mode?: WafManagedRulesModeAllowTraditional; }
; }

Client Errors

4XX application/json

Update a WAF rule response failure.

type WafManagedRulesRuleResponseSingle = type WafManagedRulesApiResponseSingle = never & { result?: {}; } & { result?: WafManagedRulesAnomalyRule

When triggered, anomaly detection WAF rules contribute to an overall threat score that will determine if a request is considered malicious. You can configure the total scoring threshold through the 'sensitivity' property of the WAF package.

type WafManagedRulesAnomalyRule = never
| WafManagedRulesTraditionalDenyRule

When triggered, traditional WAF rules cause the firewall to immediately act upon the request based on the configuration of the rule. A 'deny' rule will immediately respond to the request based on the configured rule action/mode (for example, 'block') and no other rules will be processed.

type WafManagedRulesTraditionalDenyRule = WafManagedRulesBase & { allowed_modes?: WafManagedRulesAllowedModesDenyTraditional;default_mode?: WafManagedRulesDefaultMode;mode?: WafManagedRulesModeDenyTraditional; }
| WafManagedRulesTraditionalAllowRule

When triggered, traditional WAF rules cause the firewall to immediately act on the request based on the rule configuration. An 'allow' rule will immediately allow the request and no other rules will be processed.

type WafManagedRulesTraditionalAllowRule = WafManagedRulesBase & { allowed_modes?: WafManagedRulesAllowedModesAllowTraditional;mode?: WafManagedRulesModeAllowTraditional; }
; }
& interface WafManagedRulesApiResponseCommonFailure {
errors: WafManagedRulesMessages
type WafManagedRulesMessages = { code: number;message: string; }[]
;
messages: WafManagedRulesMessages
type WafManagedRulesMessages = { code: number;message: string; }[]
;
result: null;
success: false;
}