Skip to main content

subdomains

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

Overview

Namesubdomains
TypeResource
Idcloudflare.email_sending.subdomains

Fields

The following fields are returned by SELECT queries:

Get a sending subdomain response

NameDatatypeDescription
errorsarray
messagesarray
resultobject
successbooleanWhether the API call was successful. (true)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectsubdomain_id, zone_idGets information for a specific sending subdomain.
listselectzone_idLists all sending-enabled subdomains for the zone.
createinsertzone_id, nameCreates a new sending subdomain or re-enables sending on an existing subdomain that had it disabled. If zone-level Email Sending has not been enabled yet, the zone flag is automatically set when the entitlement is present.
deletedeletesubdomain_id, zone_idDisables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.
previewexeczone_id, nameReturns the DNS records that would be created for a sending subdomain, flags which records are missing, and reports any conflicts with existing DNS records. This is a read-only dry-run — no records are created or modified. Use before or after creating a subdomain to check DNS status.

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
subdomain_idstring
zone_idstringThe Cloudflare zone ID.

SELECT examples

Gets information for a specific sending subdomain.

SELECT
errors,
messages,
result,
success
FROM cloudflare.email_sending.subdomains
WHERE subdomain_id = '{{ subdomain_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;

INSERT examples

Creates a new sending subdomain or re-enables sending on an existing subdomain that had it disabled. If zone-level Email Sending has not been enabled yet, the zone flag is automatically set when the entitlement is present.

INSERT INTO cloudflare.email_sending.subdomains (
name,
zone_id
)
SELECT
'{{ name }}' /* required */,
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;

DELETE examples

Disables sending on a subdomain and removes its DNS records. If routing is still active on the subdomain, only sending is disabled.

DELETE FROM cloudflare.email_sending.subdomains
WHERE subdomain_id = '{{ subdomain_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;

Lifecycle Methods

Returns the DNS records that would be created for a sending subdomain, flags which records are missing, and reports any conflicts with existing DNS records. This is a read-only dry-run — no records are created or modified. Use before or after creating a subdomain to check DNS status.

EXEC cloudflare.email_sending.subdomains.preview
@zone_id='{{ zone_id }}' --required
@@json=
'{
"name": "{{ name }}"
}'
;