Skip to content
Start here

Get an account or zone ruleset

rulesets.get(strruleset_id, RulesetGetParams**kwargs) -> RulesetGetResponse
GET/{accounts_or_zones}/{account_or_zone_id}/rulesets/{ruleset_id}

Fetches the latest version of an account or zone ruleset.

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)
Mass URL Redirects WriteMass URL Redirects ReadMagic Firewall WriteMagic Firewall ReadL4 DDoS Managed Ruleset WriteL4 DDoS Managed Ruleset ReadTransform Rules WriteTransform Rules ReadSelect Configuration WriteSelect Configuration ReadAccount WAF WriteAccount WAF ReadAccount Rulesets ReadAccount Rulesets WriteLogs WriteLogs Read
ParametersExpand Collapse
ruleset_id: str

The unique ID of the ruleset.

account_id: Optional[str]

The Account ID to use for this endpoint. Mutually exclusive with the Zone ID.

zone_id: Optional[str]

The Zone ID to use for this endpoint. Mutually exclusive with the Account ID.

ReturnsExpand Collapse
One of the following:
class UnionMember0: …
id: Optional[str]

The unique ID of the ruleset.

description: Optional[str]

An informative description of the ruleset.

kind: Optional[Kind]

The kind of the ruleset.

One of the following:
"managed"
"custom"
"root"
"zone"
last_updated: Optional[datetime]

The timestamp of when the ruleset was last modified.

formatdate-time
name: Optional[str]

The human-readable name of the ruleset.

minLength1
phase: Optional[Phase]

The phase of the ruleset.

One of the following:
"ddos_l4"
"ddos_l7"
"http_config_settings"
"http_custom_errors"
"http_log_custom_fields"
"http_ratelimit"
"http_request_cache_settings"
"http_request_dynamic_redirect"
"http_request_firewall_custom"
"http_request_firewall_managed"
"http_request_late_transform"
"http_request_origin"
"http_request_redirect"
"http_request_sanitize"
"http_request_sbfm"
"http_request_transform"
"http_response_cache_settings"
"http_response_compression"
"http_response_firewall_custom"
"http_response_firewall_managed"
"http_response_headers_transform"
"magic_transit"
"magic_transit_ids_managed"
"magic_transit_managed"
"magic_transit_ratelimit"
rules: Optional[List[UnionMember0Rule]]

The list of rules in the ruleset.

One of the following:
class UnionMember0RuleBlockRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember0RuleChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember0RuleChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember0RuleResponseCompressionRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleDDoSDynamicRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleExecuteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleForceConnectionCloseRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleJavaScriptChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["js_challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember0RuleJavaScriptChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember0RuleJavaScriptChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember0RuleLogRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleLogCustomFieldRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleManagedChallengeRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleRedirectRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleRewriteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleRouteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleScoreRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleServeErrorRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleSetCacheControlRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_control"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember0RuleSetCacheControlRuleActionParameters]

The parameters configuring the rule’s action.

immutable: Optional[UnionMember0RuleSetCacheControlRuleActionParametersImmutable]

A cache-control directive configuration.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersImmutableSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersImmutableRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

max_age: Optional[UnionMember0RuleSetCacheControlRuleActionParametersMaxAge]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersMaxAgeSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersMaxAgeRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_revalidate: Optional[UnionMember0RuleSetCacheControlRuleActionParametersMustRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersMustRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersMustRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_understand: Optional[UnionMember0RuleSetCacheControlRuleActionParametersMustUnderstand]

A cache-control directive configuration.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersMustUnderstandSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersMustUnderstandRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_cache: Optional[UnionMember0RuleSetCacheControlRuleActionParametersNoCache]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersNoCacheSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember0RuleSetCacheControlRuleActionParametersNoCacheRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_store: Optional[UnionMember0RuleSetCacheControlRuleActionParametersNoStore]

A cache-control directive configuration.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersNoStoreSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersNoStoreRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_transform: Optional[UnionMember0RuleSetCacheControlRuleActionParametersNoTransform]

A cache-control directive configuration.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersNoTransformSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersNoTransformRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

private: Optional[UnionMember0RuleSetCacheControlRuleActionParametersPrivate]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersPrivateSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember0RuleSetCacheControlRuleActionParametersPrivateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

proxy_revalidate: Optional[UnionMember0RuleSetCacheControlRuleActionParametersProxyRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersProxyRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

public: Optional[UnionMember0RuleSetCacheControlRuleActionParametersPublic]

A cache-control directive configuration.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersPublicSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersPublicRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

s_maxage: Optional[UnionMember0RuleSetCacheControlRuleActionParametersSMaxage]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersSMaxageSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersSMaxageRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_if_error: Optional[UnionMember0RuleSetCacheControlRuleActionParametersStaleIfError]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersStaleIfErrorSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_while_revalidate: Optional[UnionMember0RuleSetCacheControlRuleActionParametersStaleWhileRevalidate]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember0RuleSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember0RuleSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember0RuleSetCacheControlRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember0RuleSetCacheControlRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember0RuleSetCacheSettingsRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleSetCacheTagsRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_tags"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember0RuleSetCacheTagsRuleActionParameters]

The parameters configuring the rule’s action.

One of the following:
class UnionMember0RuleSetCacheTagsRuleActionParametersAddCacheTagsValues: …

Add cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember0RuleSetCacheTagsRuleActionParametersAddCacheTagsExpression: …

Add cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember0RuleSetCacheTagsRuleActionParametersRemoveCacheTagsValues: …

Remove cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember0RuleSetCacheTagsRuleActionParametersRemoveCacheTagsExpression: …

Remove cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember0RuleSetCacheTagsRuleActionParametersSetCacheTagsValues: …

Set cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember0RuleSetCacheTagsRuleActionParametersSetCacheTagsExpression: …

Set cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember0RuleSetCacheTagsRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember0RuleSetCacheTagsRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember0RuleSetConfigurationRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleSkipRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember0RuleTransformResponseHTMLRule: …
id: str

The unique ID of the rule.

action: Literal["transform_response_html"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember0RuleTransformResponseHTMLRuleActionParameters]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember0RuleTransformResponseHTMLRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember0RuleTransformResponseHTMLRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
version: Optional[str]

The version of the ruleset.

class UnionMember1: …
id: Optional[str]

The unique ID of the ruleset.

description: Optional[str]

An informative description of the ruleset.

kind: Optional[Kind]

The kind of the ruleset.

One of the following:
"managed"
"custom"
"root"
"zone"
last_updated: Optional[datetime]

The timestamp of when the ruleset was last modified.

formatdate-time
name: Optional[str]

The human-readable name of the ruleset.

minLength1
phase: Optional[Phase]

The phase of the ruleset.

One of the following:
"ddos_l4"
"ddos_l7"
"http_config_settings"
"http_custom_errors"
"http_log_custom_fields"
"http_ratelimit"
"http_request_cache_settings"
"http_request_dynamic_redirect"
"http_request_firewall_custom"
"http_request_firewall_managed"
"http_request_late_transform"
"http_request_origin"
"http_request_redirect"
"http_request_sanitize"
"http_request_sbfm"
"http_request_transform"
"http_response_cache_settings"
"http_response_compression"
"http_response_firewall_custom"
"http_response_firewall_managed"
"http_response_headers_transform"
"magic_transit"
"magic_transit_ids_managed"
"magic_transit_managed"
"magic_transit_ratelimit"
rules: Optional[List[UnionMember1Rule]]

The list of rules in the ruleset.

One of the following:
class UnionMember1RuleBlockRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember1RuleChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember1RuleChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember1RuleResponseCompressionRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleDDoSDynamicRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleExecuteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleForceConnectionCloseRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleJavaScriptChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["js_challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember1RuleJavaScriptChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember1RuleJavaScriptChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember1RuleLogRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleLogCustomFieldRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleManagedChallengeRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleRedirectRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleRewriteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleRouteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleScoreRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleServeErrorRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleSetCacheControlRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_control"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember1RuleSetCacheControlRuleActionParameters]

The parameters configuring the rule’s action.

immutable: Optional[UnionMember1RuleSetCacheControlRuleActionParametersImmutable]

A cache-control directive configuration.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersImmutableSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersImmutableRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

max_age: Optional[UnionMember1RuleSetCacheControlRuleActionParametersMaxAge]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersMaxAgeSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersMaxAgeRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_revalidate: Optional[UnionMember1RuleSetCacheControlRuleActionParametersMustRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersMustRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersMustRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_understand: Optional[UnionMember1RuleSetCacheControlRuleActionParametersMustUnderstand]

A cache-control directive configuration.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersMustUnderstandSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersMustUnderstandRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_cache: Optional[UnionMember1RuleSetCacheControlRuleActionParametersNoCache]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersNoCacheSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember1RuleSetCacheControlRuleActionParametersNoCacheRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_store: Optional[UnionMember1RuleSetCacheControlRuleActionParametersNoStore]

A cache-control directive configuration.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersNoStoreSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersNoStoreRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_transform: Optional[UnionMember1RuleSetCacheControlRuleActionParametersNoTransform]

A cache-control directive configuration.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersNoTransformSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersNoTransformRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

private: Optional[UnionMember1RuleSetCacheControlRuleActionParametersPrivate]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersPrivateSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember1RuleSetCacheControlRuleActionParametersPrivateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

proxy_revalidate: Optional[UnionMember1RuleSetCacheControlRuleActionParametersProxyRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersProxyRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

public: Optional[UnionMember1RuleSetCacheControlRuleActionParametersPublic]

A cache-control directive configuration.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersPublicSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersPublicRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

s_maxage: Optional[UnionMember1RuleSetCacheControlRuleActionParametersSMaxage]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersSMaxageSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersSMaxageRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_if_error: Optional[UnionMember1RuleSetCacheControlRuleActionParametersStaleIfError]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersStaleIfErrorSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_while_revalidate: Optional[UnionMember1RuleSetCacheControlRuleActionParametersStaleWhileRevalidate]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember1RuleSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember1RuleSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember1RuleSetCacheControlRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember1RuleSetCacheControlRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember1RuleSetCacheSettingsRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleSetCacheTagsRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_tags"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember1RuleSetCacheTagsRuleActionParameters]

The parameters configuring the rule’s action.

One of the following:
class UnionMember1RuleSetCacheTagsRuleActionParametersAddCacheTagsValues: …

Add cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember1RuleSetCacheTagsRuleActionParametersAddCacheTagsExpression: …

Add cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember1RuleSetCacheTagsRuleActionParametersRemoveCacheTagsValues: …

Remove cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember1RuleSetCacheTagsRuleActionParametersRemoveCacheTagsExpression: …

Remove cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember1RuleSetCacheTagsRuleActionParametersSetCacheTagsValues: …

Set cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember1RuleSetCacheTagsRuleActionParametersSetCacheTagsExpression: …

Set cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember1RuleSetCacheTagsRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember1RuleSetCacheTagsRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember1RuleSetConfigurationRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleSkipRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember1RuleTransformResponseHTMLRule: …
id: str

The unique ID of the rule.

action: Literal["transform_response_html"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember1RuleTransformResponseHTMLRuleActionParameters]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember1RuleTransformResponseHTMLRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember1RuleTransformResponseHTMLRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
version: Optional[str]

The version of the ruleset.

class UnionMember2: …
id: Optional[str]

The unique ID of the ruleset.

description: Optional[str]

An informative description of the ruleset.

kind: Optional[Kind]

The kind of the ruleset.

One of the following:
"managed"
"custom"
"root"
"zone"
last_updated: Optional[datetime]

The timestamp of when the ruleset was last modified.

formatdate-time
name: Optional[str]

The human-readable name of the ruleset.

minLength1
phase: Optional[Phase]

The phase of the ruleset.

One of the following:
"ddos_l4"
"ddos_l7"
"http_config_settings"
"http_custom_errors"
"http_log_custom_fields"
"http_ratelimit"
"http_request_cache_settings"
"http_request_dynamic_redirect"
"http_request_firewall_custom"
"http_request_firewall_managed"
"http_request_late_transform"
"http_request_origin"
"http_request_redirect"
"http_request_sanitize"
"http_request_sbfm"
"http_request_transform"
"http_response_cache_settings"
"http_response_compression"
"http_response_firewall_custom"
"http_response_firewall_managed"
"http_response_headers_transform"
"magic_transit"
"magic_transit_ids_managed"
"magic_transit_managed"
"magic_transit_ratelimit"
rules: Optional[List[UnionMember2Rule]]

The list of rules in the ruleset.

One of the following:
class UnionMember2RuleBlockRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember2RuleChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember2RuleChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember2RuleResponseCompressionRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleDDoSDynamicRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleExecuteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleForceConnectionCloseRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleJavaScriptChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["js_challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember2RuleJavaScriptChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember2RuleJavaScriptChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember2RuleLogRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleLogCustomFieldRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleManagedChallengeRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleRedirectRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleRewriteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleRouteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleScoreRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleServeErrorRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleSetCacheControlRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_control"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember2RuleSetCacheControlRuleActionParameters]

The parameters configuring the rule’s action.

immutable: Optional[UnionMember2RuleSetCacheControlRuleActionParametersImmutable]

A cache-control directive configuration.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersImmutableSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersImmutableRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

max_age: Optional[UnionMember2RuleSetCacheControlRuleActionParametersMaxAge]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersMaxAgeSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersMaxAgeRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_revalidate: Optional[UnionMember2RuleSetCacheControlRuleActionParametersMustRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersMustRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersMustRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_understand: Optional[UnionMember2RuleSetCacheControlRuleActionParametersMustUnderstand]

A cache-control directive configuration.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersMustUnderstandSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersMustUnderstandRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_cache: Optional[UnionMember2RuleSetCacheControlRuleActionParametersNoCache]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersNoCacheSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember2RuleSetCacheControlRuleActionParametersNoCacheRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_store: Optional[UnionMember2RuleSetCacheControlRuleActionParametersNoStore]

A cache-control directive configuration.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersNoStoreSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersNoStoreRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_transform: Optional[UnionMember2RuleSetCacheControlRuleActionParametersNoTransform]

A cache-control directive configuration.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersNoTransformSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersNoTransformRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

private: Optional[UnionMember2RuleSetCacheControlRuleActionParametersPrivate]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersPrivateSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember2RuleSetCacheControlRuleActionParametersPrivateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

proxy_revalidate: Optional[UnionMember2RuleSetCacheControlRuleActionParametersProxyRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersProxyRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

public: Optional[UnionMember2RuleSetCacheControlRuleActionParametersPublic]

A cache-control directive configuration.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersPublicSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersPublicRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

s_maxage: Optional[UnionMember2RuleSetCacheControlRuleActionParametersSMaxage]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersSMaxageSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersSMaxageRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_if_error: Optional[UnionMember2RuleSetCacheControlRuleActionParametersStaleIfError]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersStaleIfErrorSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_while_revalidate: Optional[UnionMember2RuleSetCacheControlRuleActionParametersStaleWhileRevalidate]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember2RuleSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember2RuleSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember2RuleSetCacheControlRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember2RuleSetCacheControlRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember2RuleSetCacheSettingsRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleSetCacheTagsRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_tags"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember2RuleSetCacheTagsRuleActionParameters]

The parameters configuring the rule’s action.

One of the following:
class UnionMember2RuleSetCacheTagsRuleActionParametersAddCacheTagsValues: …

Add cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember2RuleSetCacheTagsRuleActionParametersAddCacheTagsExpression: …

Add cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember2RuleSetCacheTagsRuleActionParametersRemoveCacheTagsValues: …

Remove cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember2RuleSetCacheTagsRuleActionParametersRemoveCacheTagsExpression: …

Remove cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember2RuleSetCacheTagsRuleActionParametersSetCacheTagsValues: …

Set cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember2RuleSetCacheTagsRuleActionParametersSetCacheTagsExpression: …

Set cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember2RuleSetCacheTagsRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember2RuleSetCacheTagsRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember2RuleSetConfigurationRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleSkipRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember2RuleTransformResponseHTMLRule: …
id: str

The unique ID of the rule.

action: Literal["transform_response_html"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember2RuleTransformResponseHTMLRuleActionParameters]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember2RuleTransformResponseHTMLRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember2RuleTransformResponseHTMLRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
version: Optional[str]

The version of the ruleset.

class UnionMember3: …
id: Optional[str]

The unique ID of the ruleset.

description: Optional[str]

An informative description of the ruleset.

kind: Optional[Kind]

The kind of the ruleset.

One of the following:
"managed"
"custom"
"root"
"zone"
last_updated: Optional[datetime]

The timestamp of when the ruleset was last modified.

formatdate-time
name: Optional[str]

The human-readable name of the ruleset.

minLength1
phase: Optional[Phase]

The phase of the ruleset.

One of the following:
"ddos_l4"
"ddos_l7"
"http_config_settings"
"http_custom_errors"
"http_log_custom_fields"
"http_ratelimit"
"http_request_cache_settings"
"http_request_dynamic_redirect"
"http_request_firewall_custom"
"http_request_firewall_managed"
"http_request_late_transform"
"http_request_origin"
"http_request_redirect"
"http_request_sanitize"
"http_request_sbfm"
"http_request_transform"
"http_response_cache_settings"
"http_response_compression"
"http_response_firewall_custom"
"http_response_firewall_managed"
"http_response_headers_transform"
"magic_transit"
"magic_transit_ids_managed"
"magic_transit_managed"
"magic_transit_ratelimit"
rules: Optional[List[UnionMember3Rule]]

The list of rules in the ruleset.

One of the following:
class UnionMember3RuleBlockRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember3RuleChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember3RuleChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember3RuleResponseCompressionRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleDDoSDynamicRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleExecuteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleForceConnectionCloseRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleJavaScriptChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["js_challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember3RuleJavaScriptChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember3RuleJavaScriptChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember3RuleLogRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleLogCustomFieldRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleManagedChallengeRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleRedirectRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleRewriteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleRouteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleScoreRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleServeErrorRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleSetCacheControlRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_control"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember3RuleSetCacheControlRuleActionParameters]

The parameters configuring the rule’s action.

immutable: Optional[UnionMember3RuleSetCacheControlRuleActionParametersImmutable]

A cache-control directive configuration.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersImmutableSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersImmutableRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

max_age: Optional[UnionMember3RuleSetCacheControlRuleActionParametersMaxAge]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersMaxAgeSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersMaxAgeRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_revalidate: Optional[UnionMember3RuleSetCacheControlRuleActionParametersMustRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersMustRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersMustRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_understand: Optional[UnionMember3RuleSetCacheControlRuleActionParametersMustUnderstand]

A cache-control directive configuration.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersMustUnderstandSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersMustUnderstandRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_cache: Optional[UnionMember3RuleSetCacheControlRuleActionParametersNoCache]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersNoCacheSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember3RuleSetCacheControlRuleActionParametersNoCacheRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_store: Optional[UnionMember3RuleSetCacheControlRuleActionParametersNoStore]

A cache-control directive configuration.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersNoStoreSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersNoStoreRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_transform: Optional[UnionMember3RuleSetCacheControlRuleActionParametersNoTransform]

A cache-control directive configuration.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersNoTransformSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersNoTransformRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

private: Optional[UnionMember3RuleSetCacheControlRuleActionParametersPrivate]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersPrivateSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember3RuleSetCacheControlRuleActionParametersPrivateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

proxy_revalidate: Optional[UnionMember3RuleSetCacheControlRuleActionParametersProxyRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersProxyRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

public: Optional[UnionMember3RuleSetCacheControlRuleActionParametersPublic]

A cache-control directive configuration.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersPublicSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersPublicRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

s_maxage: Optional[UnionMember3RuleSetCacheControlRuleActionParametersSMaxage]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersSMaxageSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersSMaxageRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_if_error: Optional[UnionMember3RuleSetCacheControlRuleActionParametersStaleIfError]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersStaleIfErrorSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_while_revalidate: Optional[UnionMember3RuleSetCacheControlRuleActionParametersStaleWhileRevalidate]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember3RuleSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember3RuleSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember3RuleSetCacheControlRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember3RuleSetCacheControlRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember3RuleSetCacheSettingsRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleSetCacheTagsRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_tags"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember3RuleSetCacheTagsRuleActionParameters]

The parameters configuring the rule’s action.

One of the following:
class UnionMember3RuleSetCacheTagsRuleActionParametersAddCacheTagsValues: …

Add cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember3RuleSetCacheTagsRuleActionParametersAddCacheTagsExpression: …

Add cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember3RuleSetCacheTagsRuleActionParametersRemoveCacheTagsValues: …

Remove cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember3RuleSetCacheTagsRuleActionParametersRemoveCacheTagsExpression: …

Remove cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember3RuleSetCacheTagsRuleActionParametersSetCacheTagsValues: …

Set cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember3RuleSetCacheTagsRuleActionParametersSetCacheTagsExpression: …

Set cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember3RuleSetCacheTagsRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember3RuleSetCacheTagsRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember3RuleSetConfigurationRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleSkipRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember3RuleTransformResponseHTMLRule: …
id: str

The unique ID of the rule.

action: Literal["transform_response_html"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember3RuleTransformResponseHTMLRuleActionParameters]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember3RuleTransformResponseHTMLRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember3RuleTransformResponseHTMLRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
version: Optional[str]

The version of the ruleset.

class UnionMember4: …
id: Optional[str]

The unique ID of the ruleset.

description: Optional[str]

An informative description of the ruleset.

kind: Optional[Kind]

The kind of the ruleset.

One of the following:
"managed"
"custom"
"root"
"zone"
last_updated: Optional[datetime]

The timestamp of when the ruleset was last modified.

formatdate-time
name: Optional[str]

The human-readable name of the ruleset.

minLength1
phase: Optional[Phase]

The phase of the ruleset.

One of the following:
"ddos_l4"
"ddos_l7"
"http_config_settings"
"http_custom_errors"
"http_log_custom_fields"
"http_ratelimit"
"http_request_cache_settings"
"http_request_dynamic_redirect"
"http_request_firewall_custom"
"http_request_firewall_managed"
"http_request_late_transform"
"http_request_origin"
"http_request_redirect"
"http_request_sanitize"
"http_request_sbfm"
"http_request_transform"
"http_response_cache_settings"
"http_response_compression"
"http_response_firewall_custom"
"http_response_firewall_managed"
"http_response_headers_transform"
"magic_transit"
"magic_transit_ids_managed"
"magic_transit_managed"
"magic_transit_ratelimit"
rules: Optional[List[UnionMember4Rule]]

The list of rules in the ruleset.

One of the following:
class UnionMember4RuleBlockRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember4RuleChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember4RuleChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember4RuleResponseCompressionRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleDDoSDynamicRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleExecuteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleForceConnectionCloseRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleJavaScriptChallengeRule: …
id: str

The unique ID of the rule.

action: Literal["js_challenge"]

The action to perform when the rule matches.

enabled: bool

Whether the rule should be executed.

expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[object]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember4RuleJavaScriptChallengeRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember4RuleJavaScriptChallengeRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember4RuleLogRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleLogCustomFieldRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleManagedChallengeRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleRedirectRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleRewriteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleRouteRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleScoreRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleServeErrorRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleSetCacheControlRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_control"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember4RuleSetCacheControlRuleActionParameters]

The parameters configuring the rule’s action.

immutable: Optional[UnionMember4RuleSetCacheControlRuleActionParametersImmutable]

A cache-control directive configuration.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersImmutableSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersImmutableRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

max_age: Optional[UnionMember4RuleSetCacheControlRuleActionParametersMaxAge]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersMaxAgeSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersMaxAgeRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_revalidate: Optional[UnionMember4RuleSetCacheControlRuleActionParametersMustRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersMustRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersMustRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

must_understand: Optional[UnionMember4RuleSetCacheControlRuleActionParametersMustUnderstand]

A cache-control directive configuration.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersMustUnderstandSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersMustUnderstandRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_cache: Optional[UnionMember4RuleSetCacheControlRuleActionParametersNoCache]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersNoCacheSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember4RuleSetCacheControlRuleActionParametersNoCacheRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_store: Optional[UnionMember4RuleSetCacheControlRuleActionParametersNoStore]

A cache-control directive configuration.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersNoStoreSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersNoStoreRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

no_transform: Optional[UnionMember4RuleSetCacheControlRuleActionParametersNoTransform]

A cache-control directive configuration.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersNoTransformSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersNoTransformRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

private: Optional[UnionMember4RuleSetCacheControlRuleActionParametersPrivate]

A cache-control directive configuration that accepts optional qualifiers (header names).

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersPrivateSetDirective: …

Set the directive with optional qualifiers.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

qualifiers: Optional[List[str]]

Optional list of header names to qualify the directive (e.g., for “private” or “no-cache” directives).

class UnionMember4RuleSetCacheControlRuleActionParametersPrivateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

proxy_revalidate: Optional[UnionMember4RuleSetCacheControlRuleActionParametersProxyRevalidate]

A cache-control directive configuration.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersProxyRevalidateSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersProxyRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

public: Optional[UnionMember4RuleSetCacheControlRuleActionParametersPublic]

A cache-control directive configuration.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersPublicSetDirective: …

Set the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersPublicRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

s_maxage: Optional[UnionMember4RuleSetCacheControlRuleActionParametersSMaxage]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersSMaxageSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersSMaxageRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_if_error: Optional[UnionMember4RuleSetCacheControlRuleActionParametersStaleIfError]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersStaleIfErrorSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersStaleIfErrorRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

stale_while_revalidate: Optional[UnionMember4RuleSetCacheControlRuleActionParametersStaleWhileRevalidate]

A cache-control directive configuration that accepts a duration value in seconds.

One of the following:
class UnionMember4RuleSetCacheControlRuleActionParametersStaleWhileRevalidateSetDirective: …

Set the directive with a duration value in seconds.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
value: int

The duration value in seconds for the directive.

minimum0
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

class UnionMember4RuleSetCacheControlRuleActionParametersStaleWhileRevalidateRemoveDirective: …

Remove the directive.

operation: Literal["set", "remove"]

The operation to perform on the cache-control directive.

One of the following:
"set"
"remove"
cloudflare_only: Optional[bool]

Whether the directive should only be applied to the Cloudflare CDN cache.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember4RuleSetCacheControlRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember4RuleSetCacheControlRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember4RuleSetCacheSettingsRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleSetCacheTagsRule: …
id: str

The unique ID of the rule.

action: Literal["set_cache_tags"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember4RuleSetCacheTagsRuleActionParameters]

The parameters configuring the rule’s action.

One of the following:
class UnionMember4RuleSetCacheTagsRuleActionParametersAddCacheTagsValues: …

Add cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember4RuleSetCacheTagsRuleActionParametersAddCacheTagsExpression: …

Add cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember4RuleSetCacheTagsRuleActionParametersRemoveCacheTagsValues: …

Remove cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember4RuleSetCacheTagsRuleActionParametersRemoveCacheTagsExpression: …

Remove cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
class UnionMember4RuleSetCacheTagsRuleActionParametersSetCacheTagsValues: …

Set cache tags using a list of values.

operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
values: List[str]

A list of cache tag values.

class UnionMember4RuleSetCacheTagsRuleActionParametersSetCacheTagsExpression: …

Set cache tags using an expression.

expression: str

An expression that evaluates to an array of cache tag values.

minLength1
operation: Literal["add", "remove", "set"]

The operation to perform on the cache tags.

One of the following:
"add"
"remove"
"set"
categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember4RuleSetCacheTagsRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember4RuleSetCacheTagsRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
class UnionMember4RuleSetConfigurationRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleSkipRule: …
id: str
action: str
enabled: bool
expression: str
ref: str
class UnionMember4RuleTransformResponseHTMLRule: …
id: str

The unique ID of the rule.

action: Literal["transform_response_html"]

The action to perform when the rule matches.

enabled: bool
expression: str

The expression defining which traffic will match the rule.

minLength1
last_updated: datetime

The timestamp of when the rule was last modified.

formatdate-time
ref: str

The reference of the rule (the rule’s ID by default).

minLength1
version: str

The version of the rule.

action_parameters: Optional[UnionMember4RuleTransformResponseHTMLRuleActionParameters]

The parameters configuring the rule’s action.

categories: Optional[List[str]]

The categories of the rule.

description: Optional[str]

An informative description of the rule.

exposed_credential_check: Optional[UnionMember4RuleTransformResponseHTMLRuleExposedCredentialCheck]

Configuration for exposed credential checking.

password_expression: str

An expression that selects the password used in the credentials check.

minLength1
username_expression: str

An expression that selects the user ID used in the credentials check.

minLength1
logging: Optional[Logging]

An object configuring the rule’s logging behavior.

enabled: bool

Whether to generate a log when the rule matches.

ratelimit: Optional[UnionMember4RuleTransformResponseHTMLRuleRatelimit]

An object configuring the rule’s rate limit behavior.

characteristics: List[str]

Characteristics of the request on which the rate limit counter will be incremented.

period: int

Period in seconds over which the counter is being incremented.

minimum0
counting_expression: Optional[str]

An expression that defines when the rate limit counter should be incremented. It defaults to the same as the rule’s expression.

minLength1
mitigation_timeout: Optional[int]

Period of time in seconds after which the action will be disabled following its first execution.

requests_per_period: Optional[int]

The threshold of requests per period after which the action will be executed for the first time.

minimum1
requests_to_origin: Optional[bool]

Whether counting is only performed when an origin is reached.

score_per_period: Optional[int]

The score threshold per period for which the action will be executed the first time.

score_response_header_name: Optional[str]

A response header name provided by the origin, which contains the score to increment rate limit counter with.

minLength1
version: Optional[str]

The version of the ruleset.

Get an account or zone ruleset

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
ruleset = client.rulesets.get(
    ruleset_id="2f2feab2026849078ba485f918791bdc",
    account_id="account_id",
)
print(ruleset)
{
  "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": {
    "id": "2f2feab2026849078ba485f918791bdc",
    "description": "A description for my ruleset.",
    "kind": "root",
    "last_updated": "2000-01-01T00:00:00Z",
    "name": "My ruleset",
    "phase": "http_request_firewall_custom",
    "rules": [
      {
        "last_updated": "2000-01-01T00:00:00Z",
        "version": "1",
        "id": "id",
        "action": "action",
        "action_parameters": {
          "response": {
            "content": "{\n  \"success\": false,\n  \"error\": \"you have been blocked\"\n}",
            "content_type": "application/json",
            "status_code": 400
          }
        },
        "categories": [
          "directory-traversal"
        ],
        "description": "Block the request.",
        "enabled": true,
        "exposed_credential_check": {
          "password_expression": "url_decode(http.request.body.form[\\\"password\\\"][0])",
          "username_expression": "url_decode(http.request.body.form[\\\"username\\\"][0])"
        },
        "expression": "expression",
        "logging": {
          "enabled": true
        },
        "ratelimit": {
          "characteristics": [
            "cf.colo.id"
          ],
          "period": 60,
          "counting_expression": "http.request.body.raw eq \"abcd\"",
          "mitigation_timeout": 600,
          "requests_per_period": 1000,
          "requests_to_origin": true,
          "score_per_period": 400,
          "score_response_header_name": "my-score"
        },
        "ref": "ref"
      }
    ],
    "version": "1"
  },
  "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": {
    "id": "2f2feab2026849078ba485f918791bdc",
    "description": "A description for my ruleset.",
    "kind": "root",
    "last_updated": "2000-01-01T00:00:00Z",
    "name": "My ruleset",
    "phase": "http_request_firewall_custom",
    "rules": [
      {
        "last_updated": "2000-01-01T00:00:00Z",
        "version": "1",
        "id": "id",
        "action": "action",
        "action_parameters": {
          "response": {
            "content": "{\n  \"success\": false,\n  \"error\": \"you have been blocked\"\n}",
            "content_type": "application/json",
            "status_code": 400
          }
        },
        "categories": [
          "directory-traversal"
        ],
        "description": "Block the request.",
        "enabled": true,
        "exposed_credential_check": {
          "password_expression": "url_decode(http.request.body.form[\\\"password\\\"][0])",
          "username_expression": "url_decode(http.request.body.form[\\\"username\\\"][0])"
        },
        "expression": "expression",
        "logging": {
          "enabled": true
        },
        "ratelimit": {
          "characteristics": [
            "cf.colo.id"
          ],
          "period": 60,
          "counting_expression": "http.request.body.raw eq \"abcd\"",
          "mitigation_timeout": 600,
          "requests_per_period": 1000,
          "requests_to_origin": true,
          "score_per_period": 400,
          "score_response_header_name": "my-score"
        },
        "ref": "ref"
      }
    ],
    "version": "1"
  },
  "success": true
}