Skip to content
Start here

Update Page Shield settings

page_shield.update(PageShieldUpdateParams**kwargs) -> PageShieldUpdateResponse
PUT/zones/{zone_id}/page_shield

Updates Page Shield settings.

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Page ShieldDomain Page ShieldZone Settings Write
ParametersExpand Collapse
zone_id: str

Identifier

maxLength32
enabled: Optional[bool]

When true, indicates that Page Shield is enabled.

use_cloudflare_reporting_endpoint: Optional[bool]
use_connection_url_path: Optional[bool]

When true, the paths associated with connections URLs will also be analyzed.

ReturnsExpand Collapse
class PageShieldUpdateResponse:
enabled: bool

When true, indicates that Page Shield is enabled.

updated_at: str

The timestamp of when Page Shield was last updated.

use_cloudflare_reporting_endpoint: bool
use_connection_url_path: bool

When true, the paths associated with connections URLs will also be analyzed.

Update Page Shield settings

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_email=os.environ.get("CLOUDFLARE_EMAIL"),  # This is the default and can be omitted
    api_key=os.environ.get("CLOUDFLARE_API_KEY"),  # This is the default and can be omitted
)
page_shield = client.page_shield.update(
    zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(page_shield.enabled)
{
  "success": true,
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "enabled": true,
    "updated_at": "2022-10-12T17:56:52.083582+01:00",
    "use_cloudflare_reporting_endpoint": true,
    "use_connection_url_path": true
  }
}
Returns Examples
{
  "success": true,
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "enabled": true,
    "updated_at": "2022-10-12T17:56:52.083582+01:00",
    "use_cloudflare_reporting_endpoint": true,
    "use_connection_url_path": true
  }
}