PHP Client for Cloudflare API
Accounts

Access Rules

IP Access rules defined at the account level, applying to every zone in the account.

IP Access rules defined at the account level, applying to every zone in the account.

List

List, search, sort and filter an account's IP Access rules.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
paramsarrayNo[]Query Parameters: `mode`, `configuration.target`, `configuration.value`, `notes`, `match`, `page`, `per_page`, `order` and `direction`.
php
$response = $client->accounts()->accessRules()->list('ACCOUNT_ID', []);
View this operation on the Cloudflare API Reference

Create

Create an IP Access rule for every zone in an account.

$client->accounts()->accessRules()->create('ACCOUNT_ID', [
    'mode' => 'block',
    'configuration' => ['target' => 'ip', 'value' => '198.51.100.4'],
    'notes' => 'Blocked for abuse',
]);
ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
valuesarrayYes`mode`, one of `block`, `challenge`, `whitelist`, `js_challenge` or `managed_challenge`, and `configuration` with its `target` (`ip`, `ip_range`, `asn` or `country`) and `value`. `notes` is optional.
php
$response = $client->accounts()->accessRules()->create('ACCOUNT_ID', []);
View this operation on the Cloudflare API Reference

Get

Get a single IP Access rule defined at the account level.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
ruleIdstringYesIP Access Rule Identifier.
php
$response = $client->accounts()->accessRules()->get('ACCOUNT_ID', 'RULE_ID');
View this operation on the Cloudflare API Reference

Edit

Apply changes to an IP Access rule, overwriting only the supplied properties.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
ruleIdstringYesIP Access Rule Identifier.
valuesarrayYesValues to set on the IP Access rule, e.g. `mode`, `notes`.
php
$response = $client->accounts()->accessRules()->edit('ACCOUNT_ID', 'RULE_ID', []);
View this operation on the Cloudflare API Reference

Delete

Delete an IP Access rule defined at the account level.

ParamTypeRequiredDefaultDescription
accountIdstringYesAccount Identifier.
ruleIdstringYesIP Access Rule Identifier.
php
$response = $client->accounts()->accessRules()->delete('ACCOUNT_ID', 'RULE_ID');
View this operation on the Cloudflare API Reference
Copyright © 2026