Page Rules

PageRules

Methods

list(, ):
get/zones/{zone_id}/pagerules

Fetches Page Rules in a zone.

get(, , ):
get/zones/{zone_id}/pagerules/{pagerule_id}

Fetches the details of a Page Rule.

Security

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example: Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY

Accepted Permissions (at least one required)

Trust and Safety Write Trust and Safety Read Zero Trust: PII Read Zaraz Edit Zaraz Read Zaraz Admin Access: Apps and Policies Revoke Access: Apps and Policies Write Access: Apps and Policies Read Access: Apps and Policies Revoke Access: Mutual TLS Certificates Write Access: Organizations, Identity Providers, and Groups Write Zone Settings Write Zone Settings Read Zone Read DNS Read Workers Scripts Write Workers Scripts Read Zone Write Workers Routes Write Workers Routes Read Stream Write Stream Read SSL and Certificates Write SSL and Certificates Read Logs Write Logs Read Cache Purge Page Rules Write Page Rules Read Load Balancers Write Load Balancers Read Firewall Services Write Firewall Services Read DNS Write Apps Write Analytics Read Access: Apps and Policies Write Access: Apps and Policies Read

Parameters
pageruleId: string
(maxLength: 32)

Identifier.

zone_id: string
(maxLength: 32)

Identifier.

Returns
id: string
(maxLength: 32)

Identifier.

actions: Array< | | | 31 more...>

The set of actions to perform if the targets of this rule match the request. Actions can redirect to another URL or override settings, but not both.

created_on: string
(format: date-time)

The timestamp of when the Page Rule was created.

modified_on: string
(format: date-time)

The timestamp of when the Page Rule was last modified.

priority: number
(default: 1)

The priority of the rule, used to define which Page Rule is processed over another. A higher number indicates a higher priority. For example, if you have a catch-all Page Rule (rule A: /images/*) but want a more specific Page Rule to take precedence (rule B: /images/special/*), specify a higher priority for rule B so it overrides rule A.

status: "active" | "disabled"
(default: "disabled")

The status of the Page Rule.

targets: Array<>

The rule targets to evaluate on each request.

Request example
200Example
create(, ):
post/zones/{zone_id}/pagerules

Creates a new Page Rule.

update(, , ):
put/zones/{zone_id}/pagerules/{pagerule_id}

Replaces the configuration of an existing Page Rule. The configuration of the updated Page Rule will exactly match the data passed in the API request.

edit(, , ):
patch/zones/{zone_id}/pagerules/{pagerule_id}

Updates one or more fields of an existing Page Rule.

delete(, , ): | null
delete/zones/{zone_id}/pagerules/{pagerule_id}

Deletes an existing Page Rule.

Domain types

PageRule{…}
Target{…}

URL target.