Skip to content
Start here

List trusted email domains

client.EmailSecurity.Settings.TrustedDomains.List(ctx, params) (*V4PagePaginationArray[SettingTrustedDomainListResponse], error)
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.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
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: WriteCloud Email Security: Read
ParametersExpand Collapse
params SettingTrustedDomainListParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32
Direction param.Field[SettingTrustedDomainListParamsDirection]Optional

Query param: The sorting direction.

const SettingTrustedDomainListParamsDirectionAsc SettingTrustedDomainListParamsDirection = "asc"
const SettingTrustedDomainListParamsDirectionDesc SettingTrustedDomainListParamsDirection = "desc"
IsRecent param.Field[bool]Optional

Query param: Filter to show only recently registered domains that are trusted to prevent triggering Suspicious or Malicious dispositions.

IsSimilarity param.Field[bool]Optional

Query param: Filter to show only proximity domains (partner or approved domains with similar spelling to connected domains) that prevent Spoof dispositions.

Order param.Field[SettingTrustedDomainListParamsOrder]Optional

Query param: Field to sort by.

const SettingTrustedDomainListParamsOrderPattern SettingTrustedDomainListParamsOrder = "pattern"
const SettingTrustedDomainListParamsOrderCreatedAt SettingTrustedDomainListParamsOrder = "created_at"
Page param.Field[int64]Optional

Query param: Current page within paginated list of results.

minimum1
Pattern param.Field[string]Optional

Query param

PerPage param.Field[int64]Optional

Query param: The number of results per page. Maximum value is 1000.

maximum1000
minimum1
ReturnsExpand Collapse
type SettingTrustedDomainListResponse struct{…}

A trusted email domain

ID stringOptional

Trusted domain identifier

formatuuid
Comments stringOptional
maxLength1024
CreatedAt TimeOptional
formatdate-time
IsRecent boolOptional

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

IsRegex boolOptional
IsSimilarity boolOptional

Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition.

DeprecatedLastModified TimeOptional

Deprecated, use modified_at instead. End of life: November 1, 2026.

formatdate-time
ModifiedAt TimeOptional
formatdate-time
Pattern stringOptional
maxLength1024
minLength1

List trusted email domains

package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/email_security"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  page, err := client.EmailSecurity.Settings.TrustedDomains.List(context.TODO(), email_security.SettingTrustedDomainListParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "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
  }
}
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"
      }
    }
  ],
  "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
  }
}