PHP Client for Cloudflare API
Rulesets

Versions

Every change to a ruleset creates a new version of it, and the old versions stay readable — useful for seeing what a ruleset looked like before a change, or for recovering a rule that was removed.

Every change to a ruleset creates a new version of it, and the old versions stay readable — useful for seeing what a ruleset looked like before a change, or for recovering a rule that was removed.

List

Fetches the versions of a ruleset.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
rulesetIdstringYesRuleset Identifier.
php
$response = $client->rulesets()->versions()->list('ACCOUNT_ID', 'ZONE_ID', 'RULESET_ID');
View this operation on the Cloudflare API Reference

Get

Fetches a specific version of a ruleset.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
rulesetIdstringYesRuleset Identifier.
versionstringYesVersion of the ruleset.
php
$response = $client->rulesets()->versions()->get('ACCOUNT_ID', 'ZONE_ID', 'RULESET_ID', 'VERSION');
View this operation on the Cloudflare API Reference

Delete

Deletes an existing version of a ruleset.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
rulesetIdstringYesRuleset Identifier.
versionstringYesVersion of the ruleset.
php
$response = $client->rulesets()->versions()->delete('ACCOUNT_ID', 'ZONE_ID', 'RULESET_ID', 'VERSION');
View this operation on the Cloudflare API Reference

By Tag

Fetches the rules of a ruleset version that carry a given tag, such as wordpress or the CVE a managed rule addresses.

ParamTypeRequiredDefaultDescription
accountIdstring|nullYesAccount Identifier. Provide exactly one of $accountId or $zoneId.
zoneIdstring|nullYesZone Identifier. Provide exactly one of $accountId or $zoneId.
rulesetIdstringYesRuleset Identifier.
versionstringYesVersion of the ruleset.
tagstringYesTag the rules carry.
php
$response = $client->rulesets()->versions()->byTag('ACCOUNT_ID', 'ZONE_ID', 'RULESET_ID', 'VERSION', 'TAG');
Copyright © 2026