Skip to main content

block_senders

Creates, updates, deletes, gets or lists a block_senders resource.

Overview​

Nameblock_senders
TypeResource
Idcloudflare.email_security.block_senders

Fields​

The following fields are returned by SELECT queries:

Blocked sender details

NameDatatypeDescription
idstring (uuid)Blocked sender pattern identifier (example: f174e90a-fafe-4643-bbbc-4a0ed4fc8415)
commentsstring (example: Block sender with email test@example.com)
created_atstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
is_regexboolean
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)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, pattern_idRetrieves details for a specific blocked sender pattern including its pattern type, value, and metadata.
listselectaccount_idpage, per_page, search, order, direction, pattern_type, patternReturns 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.
createinsertaccount_idCreates 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.
editupdateaccount_id, pattern_idUpdates an existing blocked sender pattern. Only provided fields will be modified. The pattern will continue blocking emails until deleted.
deletedeleteaccount_id, pattern_idRemoves a blocked sender pattern. After deletion, emails from this sender will no longer be automatically blocked based on this rule.
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.
pattern_idstring (uuid)
directionstringThe sorting direction.
orderstringField to sort by.
pageintegerCurrent page within paginated list of results.
patternstringFilter by pattern value.
pattern_typestringFilter by pattern type.
per_pageintegerThe number of results per page. Maximum value is 1000.

SELECT examples​

Retrieves details for a specific blocked sender pattern including its pattern type, value, and metadata.

SELECT
id,
comments,
created_at,
is_regex,
last_modified,
modified_at,
pattern,
pattern_type
FROM cloudflare.email_security.block_senders
WHERE account_id = '{{ account_id }}' -- required
AND pattern_id = '{{ pattern_id }}' -- required
;

INSERT examples​

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.

INSERT INTO cloudflare.email_security.block_senders (
comments,
is_regex,
pattern,
pattern_type,
account_id
)
SELECT
'{{ comments }}',
{{ is_regex }},
'{{ pattern }}',
'{{ pattern_type }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples​

Updates an existing blocked sender pattern. Only provided fields will be modified. The pattern will continue blocking emails until deleted.

UPDATE cloudflare.email_security.block_senders
SET
comments = '{{ comments }}',
is_regex = {{ is_regex }},
pattern = '{{ pattern }}',
pattern_type = '{{ pattern_type }}'
WHERE
account_id = '{{ account_id }}' --required
AND pattern_id = '{{ pattern_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples​

Removes a blocked sender pattern. After deletion, emails from this sender will no longer be automatically blocked based on this rule.

DELETE FROM cloudflare.email_security.block_senders
WHERE account_id = '{{ account_id }}' --required
AND pattern_id = '{{ pattern_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.block_senders.batch
@account_id='{{ account_id }}' --required
@@json=
'{
"deletes": "{{ deletes }}",
"patches": "{{ patches }}",
"posts": "{{ posts }}",
"puts": "{{ puts }}"
}'
;