Skip to content
Start here

Create a trusted email domain

client.emailSecurity.settings.trustedDomains.create(TrustedDomainCreateParamsparams, RequestOptionsoptions?): TrustedDomainCreateResponse
POST/accounts/{account_id}/email-security/settings/trusted_domains

Adds a domain to the trusted domains list for email security, reducing false positive detections.

Security

API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Cloud Email Security: Write
ParametersExpand Collapse
TrustedDomainCreateParams = EmailSecurityCreateTrustedDomain | Variant1
TrustedDomainCreateParamsBase
EmailSecurityCreateTrustedDomain extends TrustedDomainCreateParamsBase
Variant1 extends TrustedDomainCreateParamsBase
ReturnsExpand Collapse
TrustedDomainCreateResponse = EmailSecurityTrustedDomain { id, created_at, is_recent, 5 more } | Array<UnionMember1>
One of the following:
EmailSecurityTrustedDomain { id, created_at, is_recent, 5 more }
id: number

The unique identifier for the trusted domain.

formatint32
created_at: string
formatdate-time
is_recent: boolean

Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.

is_regex: boolean
is_similarity: boolean

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: string
formatdate-time
pattern: string
maxLength1024
minLength1
comments?: string | null
maxLength1024
Array<UnionMember1>
id: number

The unique identifier for the trusted domain.

formatint32
created_at: string
formatdate-time
is_recent: boolean

Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition.

is_regex: boolean
is_similarity: boolean

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: string
formatdate-time
pattern: string
maxLength1024
minLength1
comments?: string | null
maxLength1024

Create a trusted email domain

import Cloudflare from 'cloudflare';

const client = new Cloudflare({
  apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted
  apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted
});

const trustedDomain = await client.emailSecurity.settings.trustedDomains.create({
  account_id: '023e105f4ecef8ad9ca31a8372d0c353',
  is_recent: true,
  is_regex: false,
  is_similarity: false,
  pattern: 'example.com',
});

console.log(trustedDomain);
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": 2401,
    "created_at": "2019-12-27T18:11:19.117Z",
    "is_recent": true,
    "is_regex": true,
    "is_similarity": true,
    "last_modified": "2019-12-27T18:11:19.117Z",
    "pattern": "x",
    "comments": "comments"
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": 2401,
    "created_at": "2019-12-27T18:11:19.117Z",
    "is_recent": true,
    "is_regex": true,
    "is_similarity": true,
    "last_modified": "2019-12-27T18:11:19.117Z",
    "pattern": "x",
    "comments": "comments"
  },
  "success": true
}