Skip to main content

allow_policies

Creates, updates, deletes, gets or lists an allow_policies resource.

Overview

Nameallow_policies
TypeResource
Idcloudflare.email_security.allow_policies

Fields

The following fields are returned by SELECT queries:

Allow policy details

NameDatatypeDescription
idstring (uuid)Allow policy identifier (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415)
commentsstring (example: Trust all messages send from test@example.com)
created_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
is_acceptable_senderbooleanMessages 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_recipientbooleanMessages to this recipient will bypass all detections
is_recipientbooleanDeprecated as of July 1, 2025. Use is_exempt_recipient instead. End of life: July 1, 2026.
is_regexboolean
is_senderbooleanDeprecated as of July 1, 2025. Use is_trusted_sender instead. End of life: July 1, 2026.
is_spoofbooleanDeprecated as of July 1, 2025. Use is_acceptable_sender instead. End of life: July 1, 2026.
is_trusted_senderbooleanMessages from this sender will bypass all detections and link following
last_modifiedstring (date-time)Deprecated, use modified_at instead. End of life: November 1, 2026. (example: 2014-01-01T05:20:00.12345Z)
modified_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
patternstring (example: test@example.com)
pattern_typestringType 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: EMAIL)
verify_senderbooleanEnforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, policy_idRetrieves details for a specific allow policy including its pattern, dispositions that are exempted, and whether it applies to all detections.
listselectaccount_idpage, per_page, search, order, direction, is_exempt_recipient, is_trusted_sender, is_acceptable_sender, verify_sender, pattern_type, patternReturns 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.
createinsertaccount_id, id, created_at, last_modifiedCreates 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.
editupdateaccount_id, policy_id, id, created_at, last_modifiedUpdates an existing allow policy. Only provided fields will be modified. Changes take effect for new emails matching the pattern.
deletedeleteaccount_id, policy_idRemoves an allow policy. After deletion, emails matching this pattern will be subject to normal security scanning and disposition actions.
batchexecaccount_id, deletes, patches, puts, postsExecute multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
policy_idstringThe Access policy ID.
directionstringThe sorting direction.
is_acceptable_senderbooleanFilter to show only policies where messages from the sender are exempted from Spam, Spoof, and Bulk dispositions (not Malicious or Suspicious).
is_exempt_recipientbooleanFilter to show only policies where messages to the recipient bypass all detections.
is_trusted_senderbooleanFilter to show only policies where messages from the sender bypass all detections and link following.
orderstringField to sort by.
pageintegerCurrent page within paginated list of results.
patternstring
pattern_typestring
per_pageintegerThe number of results per page. Maximum value is 1000.
verify_senderbooleanFilter to show only policies that enforce DMARC, SPF, or DKIM authentication.

SELECT examples

Retrieves details for a specific allow policy including its pattern, dispositions that are exempted, and whether it applies to all detections.

SELECT
id,
comments,
created_at,
is_acceptable_sender,
is_exempt_recipient,
is_recipient,
is_regex,
is_sender,
is_spoof,
is_trusted_sender,
last_modified,
modified_at,
pattern,
pattern_type,
verify_sender
FROM cloudflare.email_security.allow_policies
WHERE account_id = '{{ account_id }}' -- required
AND policy_id = '{{ policy_id }}' -- required
;

INSERT examples

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.

INSERT INTO cloudflare.email_security.allow_policies (
comments,
is_acceptable_sender,
is_exempt_recipient,
is_recipient,
is_regex,
is_sender,
is_spoof,
is_trusted_sender,
pattern,
pattern_type,
verify_sender,
account_id
)
SELECT
'{{ comments }}',
{{ is_acceptable_sender }},
{{ is_exempt_recipient }},
{{ is_recipient }},
{{ is_regex }},
{{ is_sender }},
{{ is_spoof }},
{{ is_trusted_sender }},
'{{ pattern }}',
'{{ pattern_type }}',
{{ verify_sender }},
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Updates an existing allow policy. Only provided fields will be modified. Changes take effect for new emails matching the pattern.

UPDATE cloudflare.email_security.allow_policies
SET
comments = '{{ comments }}',
is_acceptable_sender = {{ is_acceptable_sender }},
is_exempt_recipient = {{ is_exempt_recipient }},
is_recipient = {{ is_recipient }},
is_regex = {{ is_regex }},
is_sender = {{ is_sender }},
is_spoof = {{ is_spoof }},
is_trusted_sender = {{ is_trusted_sender }},
pattern = '{{ pattern }}',
pattern_type = '{{ pattern_type }}',
verify_sender = {{ verify_sender }}
WHERE
account_id = '{{ account_id }}' --required
AND policy_id = '{{ policy_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Removes an allow policy. After deletion, emails matching this pattern will be subject to normal security scanning and disposition actions.

DELETE FROM cloudflare.email_security.allow_policies
WHERE account_id = '{{ account_id }}' --required
AND policy_id = '{{ policy_id }}' --required
;

Lifecycle Methods

Execute multiple operations atomically. All four operation arrays (deletes, patches, puts, posts) are required and executed in order. Send empty arrays for unused operations.

EXEC cloudflare.email_security.allow_policies.batch
@account_id='{{ account_id }}' --required
@@json=
'{
"deletes": "{{ deletes }}",
"patches": "{{ patches }}",
"posts": "{{ posts }}",
"puts": "{{ puts }}"
}'
;