PHP Client for Cloudflare API
Client Reference

Rulesets

The Cloudflare Ruleset Engine allows you to create and deploy rules and rulesets in different Cloudflare products using the same basic syntax.

The Cloudflare Ruleset Engine allows you to create and deploy rules and rulesets in different Cloudflare products using the same basic syntax.

List

Fetches all rulesets.

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

Create

Creates a ruleset.

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

Get

Fetches the latest 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.
php
$response = $client->rulesets()->get('ACCOUNT_ID', 'ZONE_ID', 'RULESET_ID');
View this operation on the Cloudflare API Reference

Delete

Deletes all versions of an existing 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()->delete('ACCOUNT_ID', 'ZONE_ID', 'RULESET_ID');
View this operation on the Cloudflare API Reference
Copyright © 2026