PHP Client for Cloudflare API
User

Access Rules

IP Access rules defined at the user level, applying to every zone the authenticated user owns.

IP Access rules defined at the user level, applying to every zone the authenticated user owns.

List

List, search, sort and filter the user's IP Access rules.

ParamTypeRequiredDefaultDescription
paramsarrayNo[]Query Parameters: `mode`, `configuration.target`, `configuration.value`, `notes`, `match`, `page`, `per_page`, `order` and `direction`.
php
$response = $client->user()->accessRules()->list([]);

Create

Create an IP Access rule for every zone the user owns.

$client->user()->accessRules()->create([
    'mode' => 'block',
    'configuration' => ['target' => 'ip', 'value' => '198.51.100.4'],
    'notes' => 'Blocked for abuse',
]);
ParamTypeRequiredDefaultDescription
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->user()->accessRules()->create([]);

Get

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

ParamTypeRequiredDefaultDescription
ruleIdstringYesIP Access Rule Identifier.
php
$response = $client->user()->accessRules()->get('RULE_ID');

Edit

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

ParamTypeRequiredDefaultDescription
ruleIdstringYesIP Access Rule Identifier.
valuesarrayYesValues to set on the IP Access rule, e.g. `mode`, `notes`.
php
$response = $client->user()->accessRules()->edit('RULE_ID', []);

Delete

Delete an IP Access rule defined at the user level.

ParamTypeRequiredDefaultDescription
ruleIdstringYesIP Access Rule Identifier.
php
$response = $client->user()->accessRules()->delete('RULE_ID');
Copyright © 2026