Phases
Each phase of the Ruleset Engine runs one entry point ruleset, which is where
your own rules for that phase live — http_request_firewall_custom for custom
firewall rules, http_request_transform for URL rewrites, and so on.
Get
Fetches the latest version of the entry point ruleset for a phase.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string|null | Yes | Account Identifier. Provide exactly one of $accountId or $zoneId. | |
zoneId | string|null | Yes | Zone Identifier. Provide exactly one of $accountId or $zoneId. | |
phase | string | Yes | The phase of the ruleset, e.g. `http_request_firewall_custom`. |
$response = $client->rulesets()->phases()->get('ACCOUNT_ID', 'ZONE_ID', 'PHASE');
Update
Updates the entry point ruleset for a phase, creating it if the phase has none yet.
The rules given replace the ones the entry point holds, so send the full set, not just the ones that changed.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string|null | Yes | Account Identifier. Provide exactly one of $accountId or $zoneId. | |
zoneId | string|null | Yes | Zone Identifier. Provide exactly one of $accountId or $zoneId. | |
phase | string | Yes | The phase of the ruleset, e.g. `http_request_firewall_custom`. | |
values | Ruleset|array | Yes | A ruleset object. |
$response = $client->rulesets()->phases()->update('ACCOUNT_ID', 'ZONE_ID', 'PHASE', $values);
Versions
Fetches the versions of the entry point ruleset for a phase.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string|null | Yes | Account Identifier. Provide exactly one of $accountId or $zoneId. | |
zoneId | string|null | Yes | Zone Identifier. Provide exactly one of $accountId or $zoneId. | |
phase | string | Yes | The phase of the ruleset, e.g. `http_request_firewall_custom`. |
$response = $client->rulesets()->phases()->versions('ACCOUNT_ID', 'ZONE_ID', 'PHASE');
Version
Fetches a specific version of the entry point ruleset for a phase.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
accountId | string|null | Yes | Account Identifier. Provide exactly one of $accountId or $zoneId. | |
zoneId | string|null | Yes | Zone Identifier. Provide exactly one of $accountId or $zoneId. | |
phase | string | Yes | The phase of the ruleset, e.g. `http_request_firewall_custom`. | |
version | string | Yes | Version of the ruleset. |
$response = $client->rulesets()->phases()->version('ACCOUNT_ID', 'ZONE_ID', 'PHASE', 'VERSION');
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.
Firewall
The firewall tools Cloudflare groups together: IP Access rules, Zone Lockdown and User Agent Blocking.

