Rulesets

rulesets

Methods

Create An Account Or Zone Ruleset -> Envelope<{ id, kind, last_updated, 5 more... }>
post/{account_or_zone}/{account_or_zone_id}/rulesets

Creates a ruleset.

Delete An Account Or Zone Ruleset ->
delete/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}

Deletes all versions of an existing account or zone ruleset.

Get An Account Or Zone Ruleset -> Envelope<{ id, kind, last_updated, 5 more... }>
get/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}

Fetches the latest version of an account or zone ruleset.

List Account Or Zone Rulesets -> SinglePage<{ id, kind, last_updated, 4 more... }>
get/{account_or_zone}/{account_or_zone_id}/rulesets

Fetches all rulesets.

Security

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

Example: Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY

Accepted Permissions (at least one required)

Mass URL Redirects Read Magic Firewall Read L4 DDoS Managed Ruleset Read Transform Rules Read Select Configuration Read Account WAF Read Account Rulesets Read Logs Read

Parameters
account_id: string
Optional

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

zone_id: string
Optional

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

Response fields
errors: Array<{ message, code, source }>

A list of error messages.

messages: Array<{ message, code, source }>

A list of warning messages.

result: Array<{ id, kind, last_updated, 4 more... }>

A list of rulesets. The returned information will not include the rules in each ruleset.

success: true

Whether the API call was successful.

Request example
200Example
Update An Account Or Zone Ruleset -> Envelope<{ id, kind, last_updated, 5 more... }>
put/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}

Updates an account or zone ruleset, creating a new version.

Domain types

Kind = "managed" | "custom" | "root" | 1 more...
Phase = "ddos_l4" | "ddos_l7" | "http_config_settings" | 20 more...
Ruleset = { id, last_updated, version, 2 more... }
Rulesets

Phases

rulesets.phases

Methods

Get An Account Or Zone Entry Point Ruleset -> Envelope<{ id, kind, last_updated, 5 more... }>
get/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint

Fetches the latest version of the account or zone entry point ruleset for a given phase.

Update An Account Or Zone Entry Point Ruleset -> Envelope<{ id, kind, last_updated, 5 more... }>
put/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint

Updates an account or zone entry point ruleset, creating a new version.

rulesets.phases.versions

Methods

Get An Account Or Zone Entry Point Ruleset Version -> Envelope<{ id, kind, last_updated, 5 more... }>
get/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions/{ruleset_version}

Fetches a specific version of an account or zone entry point ruleset.

List An Account Or Zone Entry Point Ruleset S Versions -> SinglePage<{ id, kind, last_updated, 4 more... }>
get/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions

Fetches the versions of an account or zone entry point ruleset.

rulesets.rules

Methods

Create An Account Or Zone Ruleset Rule -> Envelope<{ id, kind, last_updated, 5 more... }>
post/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules

Adds a new rule to an account or zone ruleset. The rule will be added to the end of the existing list of rules in the ruleset by default.

Delete An Account Or Zone Ruleset Rule -> Envelope<{ id, kind, last_updated, 5 more... }>
delete/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}

Deletes an existing rule from an account or zone ruleset.

Update An Account Or Zone Ruleset Rule -> Envelope<{ id, kind, last_updated, 5 more... }>
patch/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/rules/{rule_id}

Updates an existing rule in an account or zone ruleset.

Domain types

BlockRule = { last_updated, version, id, 10 more... }
CompressResponseRule = { last_updated, version, id, 10 more... }
DDoSDynamicRule = { last_updated, version, id, 10 more... }
ExecuteRule = { last_updated, version, id, 10 more... }
ForceConnectionCloseRule = { last_updated, version, id, 10 more... }
LogCustomFieldRule = { last_updated, version, id, 10 more... }
LogRule = { last_updated, version, id, 10 more... }
Logging = { enabled }
ManagedChallengeRule = { last_updated, version, id, 10 more... }
RedirectRule = { last_updated, version, id, 10 more... }
RewriteRule = { last_updated, version, id, 10 more... }
RewriteURIPart = { value } | { expression }
RouteRule = { last_updated, version, id, 10 more... }
RulesetRule = { last_updated, version, id, 10 more... }
ScoreRule = { last_updated, version, id, 10 more... }
ServeErrorRule = { last_updated, version, id, 10 more... }
SetCacheSettingsRule = { last_updated, version, id, 10 more... }
SetConfigRule = { last_updated, version, id, 10 more... }
SkipRule = { last_updated, version, id, 10 more... }
Rulesets

Versions

rulesets.versions

Methods

Delete An Account Or Zone Ruleset Version ->
delete/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions/{ruleset_version}

Deletes an existing version of an account or zone ruleset.

Get An Account Or Zone Ruleset Version -> Envelope<{ id, kind, last_updated, 5 more... }>
get/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions/{ruleset_version}

Fetches a specific version of an account or zone ruleset.

List An Account Or Zone Ruleset S Versions -> SinglePage<{ id, kind, last_updated, 4 more... }>
get/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions

Fetches the versions of an account or zone ruleset.