Create a Page Shield policy

Create a Page Shield policy.

/zones/{zone_id}/page_shield/policies

post

Page Shield

page-shield-create-a-page-shield-policy

Debug "planAvailability"

{
  "business": true,
  "enterprise": true,
  "free": false,
  "pro": true
}

Debug "tokenPermissions"

null

Debug "parameters"

[
  {
    "in": "path",
    "name": "zone_id",
    "required": true,
    "schema": {
      "description": "Identifier",
      "example": "023e105f4ecef8ad9ca31a8372d0c353",
      "maxLength": 32,
      "readOnly": true,
      "type": "string"
    }
  }
]

Debug "requestBody"

{
  "content": {
    "application/json": {
      "schema": {
        "properties": {
          "action": {
            "description": "The action to take if the expression matches",
            "enum": [
              "allow",
              "log"
            ],
            "example": "allow",
            "type": "string"
          },
          "description": {
            "description": "A description for the policy",
            "example": "Checkout page CSP policy",
            "type": "string"
          },
          "enabled": {
            "description": "Whether the policy is enabled",
            "example": true,
            "type": "boolean"
          },
          "expression": {
            "description": "The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax",
            "example": "ends_with(http.request.uri.path, \"/checkout\")",
            "type": "string"
          },
          "value": {
            "description": "The policy which will be applied",
            "example": "script-src 'none';",
            "type": "string"
          }
        }
      }
    }
  },
  "required": true
}

Debug "responses"

{
  "200": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "properties": {
                "action": {
                  "description": "The action to take if the expression matches",
                  "enum": [
                    "allow",
                    "log"
                  ],
                  "example": "allow",
                  "type": "string"
                },
                "description": {
                  "description": "A description for the policy",
                  "example": "Checkout page CSP policy",
                  "type": "string"
                },
                "enabled": {
                  "description": "Whether the policy is enabled",
                  "example": true,
                  "type": "boolean"
                },
                "expression": {
                  "description": "The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax",
                  "example": "ends_with(http.request.uri.path, \"/checkout\")",
                  "type": "string"
                },
                "id": {
                  "description": "The ID of the policy",
                  "example": "c9ef84a6bf5e47138c75d95e2f933e8f",
                  "type": "string"
                },
                "value": {
                  "description": "The policy which will be applied",
                  "example": "script-src 'none';",
                  "type": "string"
                }
              }
            }
          ]
        }
      }
    },
    "description": "Create a Page Shield policy response"
  },
  "4XX": {
    "content": {
      "application/json": {
        "schema": {
          "allOf": [
            {
              "allOf": [
                {
                  "properties": {
                    "action": {
                      "description": "The action to take if the expression matches",
                      "enum": [
                        "allow",
                        "log"
                      ],
                      "example": "allow",
                      "type": "string"
                    },
                    "description": {
                      "description": "A description for the policy",
                      "example": "Checkout page CSP policy",
                      "type": "string"
                    },
                    "enabled": {
                      "description": "Whether the policy is enabled",
                      "example": true,
                      "type": "boolean"
                    },
                    "expression": {
                      "description": "The expression which must match for the policy to be applied, using the Cloudflare Firewall rule expression syntax",
                      "example": "ends_with(http.request.uri.path, \"/checkout\")",
                      "type": "string"
                    },
                    "id": {
                      "description": "The ID of the policy",
                      "example": "c9ef84a6bf5e47138c75d95e2f933e8f",
                      "type": "string"
                    },
                    "value": {
                      "description": "The policy which will be applied",
                      "example": "script-src 'none';",
                      "type": "string"
                    }
                  }
                }
              ]
            },
            {
              "properties": {
                "errors": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": [
                    {
                      "code": 7003,
                      "message": "No route for the URI"
                    }
                  ],
                  "minLength": 1
                },
                "messages": {
                  "allOf": [
                    {
                      "example": [],
                      "items": {
                        "properties": {
                          "code": {
                            "minimum": 1000,
                            "type": "integer"
                          },
                          "message": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "code",
                          "message"
                        ],
                        "type": "object",
                        "uniqueItems": true
                      },
                      "type": "array"
                    }
                  ],
                  "example": []
                },
                "result": {
                  "enum": [
                    null
                  ],
                  "nullable": true,
                  "type": "object"
                },
                "success": {
                  "description": "Whether the API call was successful",
                  "enum": [
                    false
                  ],
                  "example": false,
                  "type": "boolean"
                }
              },
              "required": [
                "success",
                "errors",
                "messages",
                "result"
              ],
              "type": "object"
            }
          ]
        }
      }
    },
    "description": "Create a Page Shield policy response failure"
  }
}

Debug "security"

[
  {
    "api_email": [],
    "api_key": []
  }
]