Skip to content
Start here

Update a blocked email sender

email_security.settings.block_senders.edit(intpattern_id, BlockSenderEditParams**kwargs) -> BlockSenderEditResponse
PATCH/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}

Modifies a blocked sender entry, updating its pattern or block reason.

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)
Cloud Email Security: Write
ParametersExpand Collapse
account_id: str

Account Identifier

maxLength32
minLength32
pattern_id: int

The unique identifier for the allow policy.

formatint32
comments: Optional[str]
is_regex: Optional[bool]
pattern: Optional[str]
minLength1
pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]
One of the following:
"EMAIL"
"DOMAIN"
"IP"
"UNKNOWN"
ReturnsExpand Collapse
class BlockSenderEditResponse:
id: int

The unique identifier for the allow policy.

formatint32
created_at: datetime
formatdate-time
is_regex: bool
last_modified: datetime
formatdate-time
pattern: str
maxLength1024
minLength1
pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]
One of the following:
"EMAIL"
"DOMAIN"
"IP"
"UNKNOWN"
comments: Optional[str]
maxLength1024

Update a blocked email sender

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
)
response = client.email_security.settings.block_senders.edit(
    pattern_id=2402,
    account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
print(response.id)
{
  "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": {
    "id": 2402,
    "created_at": "2019-12-27T18:11:19.117Z",
    "is_regex": true,
    "last_modified": "2019-12-27T18:11:19.117Z",
    "pattern": "x",
    "pattern_type": "EMAIL",
    "comments": "comments"
  },
  "success": true
}
Returns Examples
{
  "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": {
    "id": 2402,
    "created_at": "2019-12-27T18:11:19.117Z",
    "is_regex": true,
    "last_modified": "2019-12-27T18:11:19.117Z",
    "pattern": "x",
    "pattern_type": "EMAIL",
    "comments": "comments"
  },
  "success": true
}