Firewall
Lockdowns
Lockdowns endpoint reference.
List
Fetches Zone Lockdown rules. You can filter the results using several optional parameters.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
params | array | No | [] | Query Parameters |
php
$response = $client->firewall()->lockdowns()->list('ZONE_ID', []);
Create
Creates a new Zone Lockdown rule.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
values | array | Yes | `urls` and `configurations` are required. Each configuration is `['target' => …, 'value' => …]`, where the target is `ip`, `ip_range`, `asn` or `country`. `description`, `priority` and `paused` are optional. |
php
$response = $client->firewall()->lockdowns()->create('ZONE_ID', []);
::callout{icon="i-simple-icons-cloudflare" to="https://developers.cloudflare.com/api/resources/firewall/subresources/lockdowns/methods/create/ ```php $client->firewall()->lockdowns()->create('ZONE_ID', 'urls' => 'example.com/admin*', 'configurations' => [ 'target' => 'ip', 'value' => '198.51.100.4', 'target' => 'country', 'value' => 'US', ], 'description' => 'Admin area', );
View this operation on the Cloudflare API Reference
::
## Get
Fetches the details of a Zone Lockdown rule.
::params-table
---
params:
- name: "zoneId"
type: "string"
required: true
description: "Zone Identifier."
- name: "lockdownId"
type: "string"
required: true
description: "Lockdown identifier ."
---
::
```php [php]
$response = $client->firewall()->lockdowns()->get('ZONE_ID', 'LOCKDOWN_ID');
Update
Updates an existing Zone Lockdown rule.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
lockdownId | string | Yes | Lockdown identifier | |
values | array | Yes | `urls` and `configurations` are required, in the same shape as `create()`. |
php
$response = $client->firewall()->lockdowns()->update('ZONE_ID', 'LOCKDOWN_ID', []);
Delete
Deletes an existing Zone Lockdown rule.
| Param | Type | Required | Default | Description |
|---|---|---|---|---|
zoneId | string | Yes | Zone Identifier. | |
lockdownId | string | Yes | Lockdown identifier |
php
$response = $client->firewall()->lockdowns()->delete('ZONE_ID', 'LOCKDOWN_ID');

