# Settings # Allow Policies ## List email allow policies `email_security.settings.allow_policies.list(AllowPolicyListParams**kwargs) -> SyncV4PagePaginationArray[AllowPolicyListResponse]` **get** `/accounts/{account_id}/email-security/settings/allow_policies` Returns a paginated list of email allow policies. These policies exempt matching emails from security detection, allowing them to bypass disposition actions. Supports filtering by pattern type and policy attributes. ### Parameters - `account_id: str` Identifier. - `direction: Optional[Literal["asc", "desc"]]` The sorting direction. - `"asc"` - `"desc"` - `is_acceptable_sender: Optional[bool]` Filter to show only policies where messages from the sender are exempted from Spam, Spoof, and Bulk dispositions (not Malicious or Suspicious). - `is_exempt_recipient: Optional[bool]` Filter to show only policies where messages to the recipient bypass all detections. - `is_trusted_sender: Optional[bool]` Filter to show only policies where messages from the sender bypass all detections and link following. - `order: Optional[Literal["pattern", "created_at"]]` Field to sort by. - `"pattern"` - `"created_at"` - `page: Optional[int]` Current page within paginated list of results. - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `per_page: Optional[int]` The number of results per page. Maximum value is 1000. - `search: Optional[str]` Search term for filtering records. Behavior may change. - `verify_sender: Optional[bool]` Filter to show only policies that enforce DMARC, SPF, or DKIM authentication. ### Returns - `class AllowPolicyListResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.email_security.settings.allow_policies.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "last_modified": "2014-01-01T05:20:00.12345Z", "comments": "Trust all messages send from test@example.com", "is_acceptable_sender": false, "is_exempt_recipient": false, "is_recipient": false, "is_regex": false, "is_sender": true, "is_spoof": false, "is_trusted_sender": true, "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL", "verify_sender": true } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get an email allow policy `email_security.settings.allow_policies.get(strpolicy_id, AllowPolicyGetParams**kwargs) -> AllowPolicyGetResponse` **get** `/accounts/{account_id}/email-security/settings/allow_policies/{policy_id}` Retrieves details for a specific allow policy including its pattern, dispositions that are exempted, and whether it applies to all detections. ### Parameters - `account_id: str` Identifier. - `policy_id: str` Allow policy identifier ### Returns - `class AllowPolicyGetResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) allow_policy = client.email_security.settings.allow_policies.get( policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(allow_policy.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "last_modified": "2014-01-01T05:20:00.12345Z", "comments": "Trust all messages send from test@example.com", "is_acceptable_sender": false, "is_exempt_recipient": false, "is_recipient": false, "is_regex": false, "is_sender": true, "is_spoof": false, "is_trusted_sender": true, "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL", "verify_sender": true } } ``` ## Create email allow policy `email_security.settings.allow_policies.create(AllowPolicyCreateParams**kwargs) -> AllowPolicyCreateResponse` **post** `/accounts/{account_id}/email-security/settings/allow_policies` Creates a new allow policy that exempts matching emails from security detections. Use with caution as this bypasses email security scanning. Policies can match on sender patterns and apply to specific detections or all detections. ### Parameters - `account_id: str` Identifier. - `is_acceptable_sender: bool` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: bool` Messages to this recipient will bypass all detections - `is_regex: bool` - `is_trusted_sender: bool` Messages from this sender will bypass all detections and link following - `pattern: str` - `pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: bool` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments: Optional[str]` - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. ### Returns - `class AllowPolicyCreateResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) allow_policy = client.email_security.settings.allow_policies.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_acceptable_sender=False, is_exempt_recipient=False, is_regex=False, is_trusted_sender=True, pattern="test@example.com", pattern_type="EMAIL", verify_sender=True, ) print(allow_policy.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "last_modified": "2014-01-01T05:20:00.12345Z", "comments": "Trust all messages send from test@example.com", "is_acceptable_sender": false, "is_exempt_recipient": false, "is_recipient": false, "is_regex": false, "is_sender": true, "is_spoof": false, "is_trusted_sender": true, "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL", "verify_sender": true } } ``` ## Update an email allow policy `email_security.settings.allow_policies.edit(strpolicy_id, AllowPolicyEditParams**kwargs) -> AllowPolicyEditResponse` **patch** `/accounts/{account_id}/email-security/settings/allow_policies/{policy_id}` Updates an existing allow policy. Only provided fields will be modified. Changes take effect for new emails matching the pattern. ### Parameters - `account_id: str` Identifier. - `policy_id: str` Allow policy identifier - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Returns - `class AllowPolicyEditResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.email_security.settings.allow_policies.edit( policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "created_at": "2014-01-01T05:20:00.12345Z", "last_modified": "2014-01-01T05:20:00.12345Z", "comments": "Trust all messages send from test@example.com", "is_acceptable_sender": false, "is_exempt_recipient": false, "is_recipient": false, "is_regex": false, "is_sender": true, "is_spoof": false, "is_trusted_sender": true, "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL", "verify_sender": true } } ``` ## Delete an email allow policy `email_security.settings.allow_policies.delete(strpolicy_id, AllowPolicyDeleteParams**kwargs) -> AllowPolicyDeleteResponse` **delete** `/accounts/{account_id}/email-security/settings/allow_policies/{policy_id}` Removes an allow policy. After deletion, emails matching this pattern will be subject to normal security scanning and disposition actions. ### Parameters - `account_id: str` Identifier. - `policy_id: str` Allow policy identifier ### Returns - `class AllowPolicyDeleteResponse: …` - `id: str` Allow policy identifier ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) allow_policy = client.email_security.settings.allow_policies.delete( policy_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(allow_policy.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } } ``` ## Domain Types ### Allow Policy List Response - `class AllowPolicyListResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Allow Policy Get Response - `class AllowPolicyGetResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Allow Policy Create Response - `class AllowPolicyCreateResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Allow Policy Edit Response - `class AllowPolicyEditResponse: …` An email allow policy - `id: str` Allow policy identifier - `created_at: datetime` - `last_modified: datetime` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `comments: Optional[str]` - `is_acceptable_sender: Optional[bool]` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note - This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: Optional[bool]` Messages to this recipient will bypass all detections - `is_recipient: Optional[bool]` Deprecated as of July 1, 2025. Use `is_exempt_recipient` instead. End of life: July 1, 2026. - `is_regex: Optional[bool]` - `is_sender: Optional[bool]` Deprecated as of July 1, 2025. Use `is_trusted_sender` instead. End of life: July 1, 2026. - `is_spoof: Optional[bool]` Deprecated as of July 1, 2025. Use `is_acceptable_sender` instead. End of life: July 1, 2026. - `is_trusted_sender: Optional[bool]` Messages from this sender will bypass all detections and link following - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: Optional[bool]` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Allow Policy Delete Response - `class AllowPolicyDeleteResponse: …` - `id: str` Allow policy identifier # Block Senders ## List blocked email senders `email_security.settings.block_senders.list(BlockSenderListParams**kwargs) -> SyncV4PagePaginationArray[BlockSenderListResponse]` **get** `/accounts/{account_id}/email-security/settings/block_senders` Returns a paginated list of blocked email sender patterns. These patterns prevent emails from matching senders from being delivered. Supports filtering by pattern type and searching across patterns. ### Parameters - `account_id: str` Identifier. - `direction: Optional[Literal["asc", "desc"]]` The sorting direction. - `"asc"` - `"desc"` - `order: Optional[Literal["pattern", "created_at"]]` Field to sort by. - `"pattern"` - `"created_at"` - `page: Optional[int]` Current page within paginated list of results. - `pattern: Optional[str]` Filter by pattern value. - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Filter by pattern type. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `per_page: Optional[int]` The number of results per page. Maximum value is 1000. - `search: Optional[str]` Search term for filtering records. Behavior may change. ### Returns - `class BlockSenderListResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.email_security.settings.block_senders.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Block sender with email test@example.com", "created_at": "2014-01-01T05:20:00.12345Z", "is_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get a blocked email sender `email_security.settings.block_senders.get(strpattern_id, BlockSenderGetParams**kwargs) -> BlockSenderGetResponse` **get** `/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}` Retrieves details for a specific blocked sender pattern including its pattern type, value, and metadata. ### Parameters - `account_id: str` Identifier. - `pattern_id: str` Blocked sender pattern identifier ### Returns - `class BlockSenderGetResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) block_sender = client.email_security.settings.block_senders.get( pattern_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(block_sender.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Block sender with email test@example.com", "created_at": "2014-01-01T05:20:00.12345Z", "is_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL" } } ``` ## Create blocked email sender `email_security.settings.block_senders.create(BlockSenderCreateParams**kwargs) -> BlockSenderCreateResponse` **post** `/accounts/{account_id}/email-security/settings/block_senders` Creates a new blocked sender pattern. Emails matching this pattern will be blocked from delivery. Patterns can be email addresses, domains, or IP addresses, and support regular expressions. ### Parameters - `account_id: str` Identifier. - `is_regex: bool` - `pattern: str` - `pattern_type: Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments: Optional[str]` ### Returns - `class BlockSenderCreateResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) block_sender = client.email_security.settings.block_senders.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_regex=False, pattern="test@example.com", pattern_type="EMAIL", ) print(block_sender.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Block sender with email test@example.com", "created_at": "2014-01-01T05:20:00.12345Z", "is_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL" } } ``` ## Update a blocked email sender `email_security.settings.block_senders.edit(strpattern_id, BlockSenderEditParams**kwargs) -> BlockSenderEditResponse` **patch** `/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}` Updates an existing blocked sender pattern. Only provided fields will be modified. The pattern will continue blocking emails until deleted. ### Parameters - `account_id: str` Identifier. - `pattern_id: str` Blocked sender pattern identifier - `comments: Optional[str]` - `is_regex: Optional[bool]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Returns - `class BlockSenderEditResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.email_security.settings.block_senders.edit( pattern_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Block sender with email test@example.com", "created_at": "2014-01-01T05:20:00.12345Z", "is_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "test@example.com", "pattern_type": "EMAIL" } } ``` ## Delete a blocked email sender `email_security.settings.block_senders.delete(strpattern_id, BlockSenderDeleteParams**kwargs) -> BlockSenderDeleteResponse` **delete** `/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}` Removes a blocked sender pattern. After deletion, emails from this sender will no longer be automatically blocked based on this rule. ### Parameters - `account_id: str` Identifier. - `pattern_id: str` Blocked sender pattern identifier ### Returns - `class BlockSenderDeleteResponse: …` - `id: str` Blocked sender pattern identifier ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) block_sender = client.email_security.settings.block_senders.delete( pattern_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(block_sender.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } } ``` ## Domain Types ### Block Sender List Response - `class BlockSenderListResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Block Sender Get Response - `class BlockSenderGetResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Block Sender Create Response - `class BlockSenderCreateResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Block Sender Edit Response - `class BlockSenderEditResponse: …` A blocked sender pattern - `id: Optional[str]` Blocked sender pattern identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` - `pattern_type: Optional[Literal["EMAIL", "DOMAIN", "IP", "UNKNOWN"]]` Type of pattern matching. Note: UNKNOWN is deprecated and cannot be used when creating or updating policies, but may be returned for existing entries. - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Block Sender Delete Response - `class BlockSenderDeleteResponse: …` - `id: str` Blocked sender pattern identifier # Domains ## List protected email domains `email_security.settings.domains.list(DomainListParams**kwargs) -> SyncV4PagePaginationArray[DomainListResponse]` **get** `/accounts/{account_id}/email-security/settings/domains` Returns a paginated list of email domains protected by Email Security. Includes domain configuration, delivery modes, and authorization status. Supports filtering by delivery mode and integration ID. ### Parameters - `account_id: str` Identifier. - `active_delivery_mode: Optional[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]` Currently active delivery mode to filter by. - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `allowed_delivery_mode: Optional[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]` Delivery mode to filter by. - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `direction: Optional[Literal["asc", "desc"]]` The sorting direction. - `"asc"` - `"desc"` - `domain: Optional[Sequence[str]]` Domain names to filter by. - `integration_id: Optional[str]` Integration ID to filter by. - `order: Optional[Literal["domain", "created_at"]]` Field to sort by. - `"domain"` - `"created_at"` - `page: Optional[int]` Current page within paginated list of results. - `per_page: Optional[int]` The number of results per page. Maximum value is 1000. - `search: Optional[str]` Search term for filtering records. Behavior may change. - `status: Optional[Literal["pending", "active", "failed", "timeout"]]` Filters response to domains with the provided status. - `"pending"` - `"active"` - `"failed"` - `"timeout"` ### Returns - `class DomainListResponse: …` - `id: Optional[str]` Domain identifier - `allowed_delivery_modes: Optional[List[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]]` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `authorization: Optional[Authorization]` - `authorized: bool` - `timestamp: datetime` - `status_message: Optional[str]` - `created_at: Optional[datetime]` - `dmarc_status: Optional[Literal["none", "good", "invalid"]]` - `"none"` - `"good"` - `"invalid"` - `domain: Optional[str]` - `drop_dispositions: Optional[List[Literal["MALICIOUS", "MALICIOUS-BEC", "SUSPICIOUS", 7 more]]]` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `emails_processed: Optional[EmailsProcessed]` - `timestamp: datetime` - `total_emails_processed: int` - `total_emails_processed_previous: int` - `folder: Optional[Literal["AllItems", "Inbox"]]` - `"AllItems"` - `"Inbox"` - `inbox_provider: Optional[Literal["Microsoft", "Google"]]` - `"Microsoft"` - `"Google"` - `integration_id: Optional[str]` - `ip_restrictions: Optional[List[str]]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `lookback_hops: Optional[int]` - `modified_at: Optional[datetime]` - `o365_tenant_id: Optional[str]` - `regions: Optional[List[Literal["GLOBAL", "AU", "DE", 2 more]]]` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound: Optional[bool]` - `require_tls_outbound: Optional[bool]` - `spf_status: Optional[Literal["none", "good", "neutral", 2 more]]` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` - `status: Optional[Literal["pending", "active", "failed", "timeout"]]` - `"pending"` - `"active"` - `"failed"` - `"timeout"` - `transport: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.email_security.settings.domains.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "allowed_delivery_modes": [ "DIRECT" ], "authorization": { "authorized": true, "timestamp": "2019-12-27T18:11:19.117Z", "status_message": "status_message" }, "created_at": "2014-01-01T05:20:00.12345Z", "dmarc_status": "none", "domain": "example.com", "drop_dispositions": [ "MALICIOUS" ], "emails_processed": { "timestamp": "2019-12-27T18:11:19.117Z", "total_emails_processed": 0, "total_emails_processed_previous": 0 }, "folder": "AllItems", "inbox_provider": "Microsoft", "integration_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "ip_restrictions": [ "192.0.2.0/24", "2001:db8::/32" ], "last_modified": "2014-01-01T05:20:00.12345Z", "lookback_hops": 0, "modified_at": "2014-01-01T05:20:00.12345Z", "o365_tenant_id": "o365_tenant_id", "regions": [ "GLOBAL" ], "require_tls_inbound": true, "require_tls_outbound": true, "spf_status": "none", "status": "pending", "transport": "transport" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get an email domain `email_security.settings.domains.get(strdomain_id, DomainGetParams**kwargs) -> DomainGetResponse` **get** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Retrieves detailed information for a specific protected email domain including its delivery configuration, SPF/DMARC status, and authorization state. ### Parameters - `account_id: str` Identifier. - `domain_id: str` Domain identifier ### Returns - `class DomainGetResponse: …` - `id: Optional[str]` Domain identifier - `allowed_delivery_modes: Optional[List[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]]` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `authorization: Optional[Authorization]` - `authorized: bool` - `timestamp: datetime` - `status_message: Optional[str]` - `created_at: Optional[datetime]` - `dmarc_status: Optional[Literal["none", "good", "invalid"]]` - `"none"` - `"good"` - `"invalid"` - `domain: Optional[str]` - `drop_dispositions: Optional[List[Literal["MALICIOUS", "MALICIOUS-BEC", "SUSPICIOUS", 7 more]]]` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `emails_processed: Optional[EmailsProcessed]` - `timestamp: datetime` - `total_emails_processed: int` - `total_emails_processed_previous: int` - `folder: Optional[Literal["AllItems", "Inbox"]]` - `"AllItems"` - `"Inbox"` - `inbox_provider: Optional[Literal["Microsoft", "Google"]]` - `"Microsoft"` - `"Google"` - `integration_id: Optional[str]` - `ip_restrictions: Optional[List[str]]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `lookback_hops: Optional[int]` - `modified_at: Optional[datetime]` - `o365_tenant_id: Optional[str]` - `regions: Optional[List[Literal["GLOBAL", "AU", "DE", 2 more]]]` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound: Optional[bool]` - `require_tls_outbound: Optional[bool]` - `spf_status: Optional[Literal["none", "good", "neutral", 2 more]]` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` - `status: Optional[Literal["pending", "active", "failed", "timeout"]]` - `"pending"` - `"active"` - `"failed"` - `"timeout"` - `transport: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) domain = client.email_security.settings.domains.get( domain_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(domain.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "allowed_delivery_modes": [ "DIRECT" ], "authorization": { "authorized": true, "timestamp": "2019-12-27T18:11:19.117Z", "status_message": "status_message" }, "created_at": "2014-01-01T05:20:00.12345Z", "dmarc_status": "none", "domain": "example.com", "drop_dispositions": [ "MALICIOUS" ], "emails_processed": { "timestamp": "2019-12-27T18:11:19.117Z", "total_emails_processed": 0, "total_emails_processed_previous": 0 }, "folder": "AllItems", "inbox_provider": "Microsoft", "integration_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "ip_restrictions": [ "192.0.2.0/24", "2001:db8::/32" ], "last_modified": "2014-01-01T05:20:00.12345Z", "lookback_hops": 0, "modified_at": "2014-01-01T05:20:00.12345Z", "o365_tenant_id": "o365_tenant_id", "regions": [ "GLOBAL" ], "require_tls_inbound": true, "require_tls_outbound": true, "spf_status": "none", "status": "pending", "transport": "transport" } } ``` ## Update an email domain `email_security.settings.domains.edit(strdomain_id, DomainEditParams**kwargs) -> DomainEditResponse` **patch** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Updates configuration for a protected email domain. Only provided fields will be modified. Changes affect delivery mode, security settings, and regional processing. ### Parameters - `account_id: str` Identifier. - `domain_id: str` Domain identifier - `allowed_delivery_modes: Optional[List[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]]` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `domain: Optional[str]` - `drop_dispositions: Optional[List[Literal["MALICIOUS", "MALICIOUS-BEC", "SUSPICIOUS", 7 more]]]` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `folder: Optional[Literal["AllItems", "Inbox"]]` - `"AllItems"` - `"Inbox"` - `integration_id: Optional[str]` - `ip_restrictions: Optional[Sequence[str]]` - `lookback_hops: Optional[int]` - `regions: Optional[List[Literal["GLOBAL", "AU", "DE", 2 more]]]` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound: Optional[bool]` - `require_tls_outbound: Optional[bool]` - `transport: Optional[str]` ### Returns - `class DomainEditResponse: …` - `id: Optional[str]` Domain identifier - `allowed_delivery_modes: Optional[List[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]]` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `authorization: Optional[Authorization]` - `authorized: bool` - `timestamp: datetime` - `status_message: Optional[str]` - `created_at: Optional[datetime]` - `dmarc_status: Optional[Literal["none", "good", "invalid"]]` - `"none"` - `"good"` - `"invalid"` - `domain: Optional[str]` - `drop_dispositions: Optional[List[Literal["MALICIOUS", "MALICIOUS-BEC", "SUSPICIOUS", 7 more]]]` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `emails_processed: Optional[EmailsProcessed]` - `timestamp: datetime` - `total_emails_processed: int` - `total_emails_processed_previous: int` - `folder: Optional[Literal["AllItems", "Inbox"]]` - `"AllItems"` - `"Inbox"` - `inbox_provider: Optional[Literal["Microsoft", "Google"]]` - `"Microsoft"` - `"Google"` - `integration_id: Optional[str]` - `ip_restrictions: Optional[List[str]]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `lookback_hops: Optional[int]` - `modified_at: Optional[datetime]` - `o365_tenant_id: Optional[str]` - `regions: Optional[List[Literal["GLOBAL", "AU", "DE", 2 more]]]` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound: Optional[bool]` - `require_tls_outbound: Optional[bool]` - `spf_status: Optional[Literal["none", "good", "neutral", 2 more]]` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` - `status: Optional[Literal["pending", "active", "failed", "timeout"]]` - `"pending"` - `"active"` - `"failed"` - `"timeout"` - `transport: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.email_security.settings.domains.edit( domain_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "allowed_delivery_modes": [ "DIRECT" ], "authorization": { "authorized": true, "timestamp": "2019-12-27T18:11:19.117Z", "status_message": "status_message" }, "created_at": "2014-01-01T05:20:00.12345Z", "dmarc_status": "none", "domain": "example.com", "drop_dispositions": [ "MALICIOUS" ], "emails_processed": { "timestamp": "2019-12-27T18:11:19.117Z", "total_emails_processed": 0, "total_emails_processed_previous": 0 }, "folder": "AllItems", "inbox_provider": "Microsoft", "integration_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", "ip_restrictions": [ "192.0.2.0/24", "2001:db8::/32" ], "last_modified": "2014-01-01T05:20:00.12345Z", "lookback_hops": 0, "modified_at": "2014-01-01T05:20:00.12345Z", "o365_tenant_id": "o365_tenant_id", "regions": [ "GLOBAL" ], "require_tls_inbound": true, "require_tls_outbound": true, "spf_status": "none", "status": "pending", "transport": "transport" } } ``` ## Unprotect an email domain `email_security.settings.domains.delete(strdomain_id, DomainDeleteParams**kwargs) -> DomainDeleteResponse` **delete** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Removes email security protection from a domain. After deletion, emails for this domain will no longer be processed by Email Security. This action cannot be undone. ### Parameters - `account_id: str` Identifier. - `domain_id: str` Domain identifier ### Returns - `class DomainDeleteResponse: …` - `id: str` Domain identifier ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) domain = client.email_security.settings.domains.delete( domain_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(domain.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } } ``` ## Domain Types ### Domain List Response - `class DomainListResponse: …` - `id: Optional[str]` Domain identifier - `allowed_delivery_modes: Optional[List[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]]` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `authorization: Optional[Authorization]` - `authorized: bool` - `timestamp: datetime` - `status_message: Optional[str]` - `created_at: Optional[datetime]` - `dmarc_status: Optional[Literal["none", "good", "invalid"]]` - `"none"` - `"good"` - `"invalid"` - `domain: Optional[str]` - `drop_dispositions: Optional[List[Literal["MALICIOUS", "MALICIOUS-BEC", "SUSPICIOUS", 7 more]]]` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `emails_processed: Optional[EmailsProcessed]` - `timestamp: datetime` - `total_emails_processed: int` - `total_emails_processed_previous: int` - `folder: Optional[Literal["AllItems", "Inbox"]]` - `"AllItems"` - `"Inbox"` - `inbox_provider: Optional[Literal["Microsoft", "Google"]]` - `"Microsoft"` - `"Google"` - `integration_id: Optional[str]` - `ip_restrictions: Optional[List[str]]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `lookback_hops: Optional[int]` - `modified_at: Optional[datetime]` - `o365_tenant_id: Optional[str]` - `regions: Optional[List[Literal["GLOBAL", "AU", "DE", 2 more]]]` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound: Optional[bool]` - `require_tls_outbound: Optional[bool]` - `spf_status: Optional[Literal["none", "good", "neutral", 2 more]]` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` - `status: Optional[Literal["pending", "active", "failed", "timeout"]]` - `"pending"` - `"active"` - `"failed"` - `"timeout"` - `transport: Optional[str]` ### Domain Get Response - `class DomainGetResponse: …` - `id: Optional[str]` Domain identifier - `allowed_delivery_modes: Optional[List[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]]` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `authorization: Optional[Authorization]` - `authorized: bool` - `timestamp: datetime` - `status_message: Optional[str]` - `created_at: Optional[datetime]` - `dmarc_status: Optional[Literal["none", "good", "invalid"]]` - `"none"` - `"good"` - `"invalid"` - `domain: Optional[str]` - `drop_dispositions: Optional[List[Literal["MALICIOUS", "MALICIOUS-BEC", "SUSPICIOUS", 7 more]]]` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `emails_processed: Optional[EmailsProcessed]` - `timestamp: datetime` - `total_emails_processed: int` - `total_emails_processed_previous: int` - `folder: Optional[Literal["AllItems", "Inbox"]]` - `"AllItems"` - `"Inbox"` - `inbox_provider: Optional[Literal["Microsoft", "Google"]]` - `"Microsoft"` - `"Google"` - `integration_id: Optional[str]` - `ip_restrictions: Optional[List[str]]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `lookback_hops: Optional[int]` - `modified_at: Optional[datetime]` - `o365_tenant_id: Optional[str]` - `regions: Optional[List[Literal["GLOBAL", "AU", "DE", 2 more]]]` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound: Optional[bool]` - `require_tls_outbound: Optional[bool]` - `spf_status: Optional[Literal["none", "good", "neutral", 2 more]]` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` - `status: Optional[Literal["pending", "active", "failed", "timeout"]]` - `"pending"` - `"active"` - `"failed"` - `"timeout"` - `transport: Optional[str]` ### Domain Edit Response - `class DomainEditResponse: …` - `id: Optional[str]` Domain identifier - `allowed_delivery_modes: Optional[List[Literal["DIRECT", "BCC", "JOURNAL", 2 more]]]` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `authorization: Optional[Authorization]` - `authorized: bool` - `timestamp: datetime` - `status_message: Optional[str]` - `created_at: Optional[datetime]` - `dmarc_status: Optional[Literal["none", "good", "invalid"]]` - `"none"` - `"good"` - `"invalid"` - `domain: Optional[str]` - `drop_dispositions: Optional[List[Literal["MALICIOUS", "MALICIOUS-BEC", "SUSPICIOUS", 7 more]]]` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `emails_processed: Optional[EmailsProcessed]` - `timestamp: datetime` - `total_emails_processed: int` - `total_emails_processed_previous: int` - `folder: Optional[Literal["AllItems", "Inbox"]]` - `"AllItems"` - `"Inbox"` - `inbox_provider: Optional[Literal["Microsoft", "Google"]]` - `"Microsoft"` - `"Google"` - `integration_id: Optional[str]` - `ip_restrictions: Optional[List[str]]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `lookback_hops: Optional[int]` - `modified_at: Optional[datetime]` - `o365_tenant_id: Optional[str]` - `regions: Optional[List[Literal["GLOBAL", "AU", "DE", 2 more]]]` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound: Optional[bool]` - `require_tls_outbound: Optional[bool]` - `spf_status: Optional[Literal["none", "good", "neutral", 2 more]]` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` - `status: Optional[Literal["pending", "active", "failed", "timeout"]]` - `"pending"` - `"active"` - `"failed"` - `"timeout"` - `transport: Optional[str]` ### Domain Delete Response - `class DomainDeleteResponse: …` - `id: str` Domain identifier # Impersonation Registry ## List entries in impersonation registry `email_security.settings.impersonation_registry.list(ImpersonationRegistryListParams**kwargs) -> SyncV4PagePaginationArray[ImpersonationRegistryListResponse]` **get** `/accounts/{account_id}/email-security/settings/impersonation_registry` Returns a paginated list of protected identities in the impersonation registry. These entries define identities and email addresses to protect from impersonation attacks. Can be manually added or automatically synced from directory integrations. ### Parameters - `account_id: str` Identifier. - `direction: Optional[Literal["asc", "desc"]]` The sorting direction. - `"asc"` - `"desc"` - `order: Optional[Literal["name", "email", "created_at"]]` Field to sort by. - `"name"` - `"email"` - `"created_at"` - `page: Optional[int]` Current page within paginated list of results. - `per_page: Optional[int]` The number of results per page. Maximum value is 1000. - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` - `search: Optional[str]` Search term for filtering records. Behavior may change. ### Returns - `class ImpersonationRegistryListResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.email_security.settings.impersonation_registry.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "comments", "created_at": "2014-01-01T05:20:00.12345Z", "directory_id": 0, "directory_node_id": 0, "email": "john.doe@example.com", "external_directory_node_id": "external_directory_node_id", "is_email_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "name": "John Doe", "provenance": "A1S_INTERNAL" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get an impersonation registry entry `email_security.settings.impersonation_registry.get(strimpersonation_registry_id, ImpersonationRegistryGetParams**kwargs) -> ImpersonationRegistryGetResponse` **get** `/accounts/{account_id}/email-security/settings/impersonation_registry/{impersonation_registry_id}` Retrieves details for a specific impersonation registry entry including the protected identity, email pattern, and synchronization source if directory-synced. ### Parameters - `account_id: str` Identifier. - `impersonation_registry_id: str` Impersonation registry entry identifier ### Returns - `class ImpersonationRegistryGetResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) impersonation_registry = client.email_security.settings.impersonation_registry.get( impersonation_registry_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(impersonation_registry.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "comments", "created_at": "2014-01-01T05:20:00.12345Z", "directory_id": 0, "directory_node_id": 0, "email": "john.doe@example.com", "external_directory_node_id": "external_directory_node_id", "is_email_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "name": "John Doe", "provenance": "A1S_INTERNAL" } } ``` ## Create impersonation registry entry `email_security.settings.impersonation_registry.create(ImpersonationRegistryCreateParams**kwargs) -> ImpersonationRegistryCreateResponse` **post** `/accounts/{account_id}/email-security/settings/impersonation_registry` Creates a new entry in the impersonation registry to protect against impersonation. Emails attempting to impersonate this identity will be flagged. Supports regex patterns for flexible email matching. ### Parameters - `account_id: str` Identifier. - `email: str` - `is_email_regex: bool` - `name: str` - `comments: Optional[str]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `external_directory_node_id: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Returns - `class ImpersonationRegistryCreateResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) impersonation_registry = client.email_security.settings.impersonation_registry.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", email="john.doe@example.com", is_email_regex=False, name="John Doe", ) print(impersonation_registry.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "comments", "created_at": "2014-01-01T05:20:00.12345Z", "directory_id": 0, "directory_node_id": 0, "email": "john.doe@example.com", "external_directory_node_id": "external_directory_node_id", "is_email_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "name": "John Doe", "provenance": "A1S_INTERNAL" } } ``` ## Update an impersonation registry entry `email_security.settings.impersonation_registry.edit(strimpersonation_registry_id, ImpersonationRegistryEditParams**kwargs) -> ImpersonationRegistryEditResponse` **patch** `/accounts/{account_id}/email-security/settings/impersonation_registry/{impersonation_registry_id}` Updates an existing impersonation registry entry. Only provided fields will be modified. Directory-synced entries can't be updated. ### Parameters - `account_id: str` Identifier. - `impersonation_registry_id: str` Impersonation registry entry identifier - `comments: Optional[str]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Returns - `class ImpersonationRegistryEditResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.email_security.settings.impersonation_registry.edit( impersonation_registry_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "comments", "created_at": "2014-01-01T05:20:00.12345Z", "directory_id": 0, "directory_node_id": 0, "email": "john.doe@example.com", "external_directory_node_id": "external_directory_node_id", "is_email_regex": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "name": "John Doe", "provenance": "A1S_INTERNAL" } } ``` ## Delete an impersonation registry entry `email_security.settings.impersonation_registry.delete(strimpersonation_registry_id, ImpersonationRegistryDeleteParams**kwargs) -> ImpersonationRegistryDeleteResponse` **delete** `/accounts/{account_id}/email-security/settings/impersonation_registry/{impersonation_registry_id}` Removes an entry from the impersonation registry. After deletion, this identity will no longer be protected from impersonation. ### Parameters - `account_id: str` Identifier. - `impersonation_registry_id: str` Impersonation registry entry identifier ### Returns - `class ImpersonationRegistryDeleteResponse: …` - `id: str` Impersonation registry entry identifier ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) impersonation_registry = client.email_security.settings.impersonation_registry.delete( impersonation_registry_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(impersonation_registry.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } } ``` ## Domain Types ### Impersonation Registry List Response - `class ImpersonationRegistryListResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Impersonation Registry Get Response - `class ImpersonationRegistryGetResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Impersonation Registry Create Response - `class ImpersonationRegistryCreateResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Impersonation Registry Edit Response - `class ImpersonationRegistryEditResponse: …` An impersonation registry entry - `id: Optional[str]` Impersonation registry entry identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `directory_id: Optional[int]` - `directory_node_id: Optional[int]` - `email: Optional[str]` - `external_directory_node_id: Optional[str]` - `is_email_regex: Optional[bool]` - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `name: Optional[str]` - `provenance: Optional[Literal["A1S_INTERNAL", "SNOOPY-CASB_OFFICE_365", "SNOOPY-OFFICE_365", "SNOOPY-GOOGLE_DIRECTORY"]]` - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` ### Impersonation Registry Delete Response - `class ImpersonationRegistryDeleteResponse: …` - `id: str` Impersonation registry entry identifier # Trusted Domains ## List trusted email domains `email_security.settings.trusted_domains.list(TrustedDomainListParams**kwargs) -> SyncV4PagePaginationArray[TrustedDomainListResponse]` **get** `/accounts/{account_id}/email-security/settings/trusted_domains` Returns a paginated list of trusted domain patterns. Trusted domains prevent false positives for recently registered domains and lookalike domain detections. Patterns can use regular expressions for flexible matching. ### Parameters - `account_id: str` Identifier. - `direction: Optional[Literal["asc", "desc"]]` The sorting direction. - `"asc"` - `"desc"` - `is_recent: Optional[bool]` Filter to show only recently registered domains that are trusted to prevent triggering Suspicious or Malicious dispositions. - `is_similarity: Optional[bool]` Filter to show only proximity domains (partner or approved domains with similar spelling to connected domains) that prevent Spoof dispositions. - `order: Optional[Literal["pattern", "created_at"]]` Field to sort by. - `"pattern"` - `"created_at"` - `page: Optional[int]` Current page within paginated list of results. - `pattern: Optional[str]` - `per_page: Optional[int]` The number of results per page. Maximum value is 1000. - `search: Optional[str]` Search term for filtering records. Behavior may change. ### Returns - `class TrustedDomainListResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) page = client.email_security.settings.trusted_domains.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Trusted partner domain", "created_at": "2014-01-01T05:20:00.12345Z", "is_recent": true, "is_regex": false, "is_similarity": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "example.com" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get a trusted email domain `email_security.settings.trusted_domains.get(strtrusted_domain_id, TrustedDomainGetParams**kwargs) -> TrustedDomainGetResponse` **get** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Retrieves details for a specific trusted domain pattern including its pattern value, whether it uses regex matching, and which detection types it affects. ### Parameters - `account_id: str` Identifier. - `trusted_domain_id: str` Trusted domain identifier ### Returns - `class TrustedDomainGetResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) trusted_domain = client.email_security.settings.trusted_domains.get( trusted_domain_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(trusted_domain.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Trusted partner domain", "created_at": "2014-01-01T05:20:00.12345Z", "is_recent": true, "is_regex": false, "is_similarity": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "example.com" } } ``` ## Create trusted email domain `email_security.settings.trusted_domains.create(TrustedDomainCreateParams**kwargs) -> TrustedDomainCreateResponse` **post** `/accounts/{account_id}/email-security/settings/trusted_domains` Creates a new trusted domain pattern. Use for partner domains or approved senders that should bypass recent domain registration and similarity checks. Configure whether it prevents recent domain or spoof dispositions. ### Parameters - `account_id: str` Identifier. - `is_recent: bool` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: bool` - `is_similarity: bool` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `pattern: str` - `comments: Optional[str]` ### Returns - `class TrustedDomainCreateResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) trusted_domain = client.email_security.settings.trusted_domains.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", is_recent=True, is_regex=False, is_similarity=False, pattern="example.com", ) print(trusted_domain.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Trusted partner domain", "created_at": "2014-01-01T05:20:00.12345Z", "is_recent": true, "is_regex": false, "is_similarity": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "example.com" } } ``` ## Update a trusted email domain `email_security.settings.trusted_domains.edit(strtrusted_domain_id, TrustedDomainEditParams**kwargs) -> TrustedDomainEditResponse` **patch** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Updates an existing trusted domain pattern. Only provided fields will be modified. Changes take effect for new emails matching the pattern. ### Parameters - `account_id: str` Identifier. - `trusted_domain_id: str` Trusted domain identifier - `comments: Optional[str]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `pattern: Optional[str]` ### Returns - `class TrustedDomainEditResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) response = client.email_security.settings.trusted_domains.edit( trusted_domain_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(response.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415", "comments": "Trusted partner domain", "created_at": "2014-01-01T05:20:00.12345Z", "is_recent": true, "is_regex": false, "is_similarity": false, "last_modified": "2014-01-01T05:20:00.12345Z", "modified_at": "2014-01-01T05:20:00.12345Z", "pattern": "example.com" } } ``` ## Delete a trusted email domain `email_security.settings.trusted_domains.delete(strtrusted_domain_id, TrustedDomainDeleteParams**kwargs) -> TrustedDomainDeleteResponse` **delete** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Removes a trusted domain pattern. After deletion, emails from this domain will be subject to normal recent domain and similarity checks. ### Parameters - `account_id: str` Identifier. - `trusted_domain_id: str` Trusted domain identifier ### Returns - `class TrustedDomainDeleteResponse: …` - `id: str` Trusted domain identifier ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted ) trusted_domain = client.email_security.settings.trusted_domains.delete( trusted_domain_id="f174e90a-fafe-4643-bbbc-4a0ed4fc8415", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(trusted_domain.id) ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415" } } ``` ## Domain Types ### Trusted Domain List Response - `class TrustedDomainListResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Trusted Domain Get Response - `class TrustedDomainGetResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Trusted Domain Create Response - `class TrustedDomainCreateResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Trusted Domain Edit Response - `class TrustedDomainEditResponse: …` A trusted email domain - `id: Optional[str]` Trusted domain identifier - `comments: Optional[str]` - `created_at: Optional[datetime]` - `is_recent: Optional[bool]` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex: Optional[bool]` - `is_similarity: Optional[bool]` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `last_modified: Optional[datetime]` Deprecated, use `modified_at` instead. End of life: November 1, 2026. - `modified_at: Optional[datetime]` - `pattern: Optional[str]` ### Trusted Domain Delete Response - `class TrustedDomainDeleteResponse: …` - `id: str` Trusted domain identifier