# Settings # Allow Policies ## List email allow policies `client.EmailSecurity.Settings.AllowPolicies.List(ctx, params) (*V4PagePaginationArray[SettingAllowPolicyListResponse], error)` **get** `/accounts/{account_id}/email-security/settings/allow_policies` Lists, searches, and sorts an account’s email allow policies. ### Parameters - `params SettingAllowPolicyListParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Direction param.Field[SettingAllowPolicyListParamsDirection]` Query param: The sorting direction. - `const SettingAllowPolicyListParamsDirectionAsc SettingAllowPolicyListParamsDirection = "asc"` - `const SettingAllowPolicyListParamsDirectionDesc SettingAllowPolicyListParamsDirection = "desc"` - `IsAcceptableSender param.Field[bool]` Query param - `IsExemptRecipient param.Field[bool]` Query param - `IsRecipient param.Field[bool]` Query param - `IsSender param.Field[bool]` Query param - `IsSpoof param.Field[bool]` Query param - `IsTrustedSender param.Field[bool]` Query param - `Order param.Field[SettingAllowPolicyListParamsOrder]` Query param: The field to sort by. - `const SettingAllowPolicyListParamsOrderPattern SettingAllowPolicyListParamsOrder = "pattern"` - `const SettingAllowPolicyListParamsOrderCreatedAt SettingAllowPolicyListParamsOrder = "created_at"` - `Page param.Field[int64]` Query param: The page number of paginated results. - `Pattern param.Field[string]` Query param - `PatternType param.Field[SettingAllowPolicyListParamsPatternType]` Query param - `const SettingAllowPolicyListParamsPatternTypeEmail SettingAllowPolicyListParamsPatternType = "EMAIL"` - `const SettingAllowPolicyListParamsPatternTypeDomain SettingAllowPolicyListParamsPatternType = "DOMAIN"` - `const SettingAllowPolicyListParamsPatternTypeIP SettingAllowPolicyListParamsPatternType = "IP"` - `const SettingAllowPolicyListParamsPatternTypeUnknown SettingAllowPolicyListParamsPatternType = "UNKNOWN"` - `PerPage param.Field[int64]` Query param: The number of results per page. - `Search param.Field[string]` Query param: Allows searching in multiple properties of a record simultaneously. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future. - `VerifySender param.Field[bool]` Query param ### Returns - `type SettingAllowPolicyListResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsAcceptableSender bool` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `IsExemptRecipient bool` Messages to this recipient will bypass all detections. - `IsRegex bool` - `IsTrustedSender bool` Messages from this sender will bypass all detections and link following. - `LastModified Time` - `Pattern string` - `PatternType SettingAllowPolicyListResponsePatternType` - `const SettingAllowPolicyListResponsePatternTypeEmail SettingAllowPolicyListResponsePatternType = "EMAIL"` - `const SettingAllowPolicyListResponsePatternTypeDomain SettingAllowPolicyListResponsePatternType = "DOMAIN"` - `const SettingAllowPolicyListResponsePatternTypeIP SettingAllowPolicyListResponsePatternType = "IP"` - `const SettingAllowPolicyListResponsePatternTypeUnknown SettingAllowPolicyListResponsePatternType = "UNKNOWN"` - `VerifySender bool` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `Comments string` - `IsRecipient bool` - `IsSender bool` - `IsSpoof bool` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.EmailSecurity.Settings.AllowPolicies.List(context.TODO(), email_security.SettingAllowPolicyListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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_acceptable_sender": true, "is_exempt_recipient": true, "is_regex": true, "is_trusted_sender": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "verify_sender": true, "comments": "comments", "is_recipient": true, "is_sender": true, "is_spoof": true } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get an email allow policy `client.EmailSecurity.Settings.AllowPolicies.Get(ctx, policyID, query) (*SettingAllowPolicyGetResponse, error)` **get** `/accounts/{account_id}/email-security/settings/allow_policies/{policy_id}` Retrieves details for a specific email allow policy, including its matching criteria and scope. ### Parameters - `policyID int64` The unique identifier for the allow policy. - `query SettingAllowPolicyGetParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingAllowPolicyGetResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsAcceptableSender bool` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `IsExemptRecipient bool` Messages to this recipient will bypass all detections. - `IsRegex bool` - `IsTrustedSender bool` Messages from this sender will bypass all detections and link following. - `LastModified Time` - `Pattern string` - `PatternType SettingAllowPolicyGetResponsePatternType` - `const SettingAllowPolicyGetResponsePatternTypeEmail SettingAllowPolicyGetResponsePatternType = "EMAIL"` - `const SettingAllowPolicyGetResponsePatternTypeDomain SettingAllowPolicyGetResponsePatternType = "DOMAIN"` - `const SettingAllowPolicyGetResponsePatternTypeIP SettingAllowPolicyGetResponsePatternType = "IP"` - `const SettingAllowPolicyGetResponsePatternTypeUnknown SettingAllowPolicyGetResponsePatternType = "UNKNOWN"` - `VerifySender bool` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `Comments string` - `IsRecipient bool` - `IsSender bool` - `IsSpoof bool` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) allowPolicy, err := client.EmailSecurity.Settings.AllowPolicies.Get( context.TODO(), int64(2401), email_security.SettingAllowPolicyGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", allowPolicy.ID) } ``` #### Response ```json { "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_acceptable_sender": true, "is_exempt_recipient": true, "is_regex": true, "is_trusted_sender": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "verify_sender": true, "comments": "comments", "is_recipient": true, "is_sender": true, "is_spoof": true }, "success": true } ``` ## Create an email allow policy `client.EmailSecurity.Settings.AllowPolicies.New(ctx, params) (*SettingAllowPolicyNewResponse, error)` **post** `/accounts/{account_id}/email-security/settings/allow_policies` Creates a new email allow policy that permits specific senders, domains, or patterns to bypass security scanning. ### Parameters - `params SettingAllowPolicyNewParams` - `AccountID param.Field[string]` Path param: Account Identifier - `IsAcceptableSender param.Field[bool]` Body param: Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `IsExemptRecipient param.Field[bool]` Body param: Messages to this recipient will bypass all detections. - `IsRegex param.Field[bool]` Body param - `IsTrustedSender param.Field[bool]` Body param: Messages from this sender will bypass all detections and link following. - `Pattern param.Field[string]` Body param - `PatternType param.Field[SettingAllowPolicyNewParamsPatternType]` Body param - `const SettingAllowPolicyNewParamsPatternTypeEmail SettingAllowPolicyNewParamsPatternType = "EMAIL"` - `const SettingAllowPolicyNewParamsPatternTypeDomain SettingAllowPolicyNewParamsPatternType = "DOMAIN"` - `const SettingAllowPolicyNewParamsPatternTypeIP SettingAllowPolicyNewParamsPatternType = "IP"` - `const SettingAllowPolicyNewParamsPatternTypeUnknown SettingAllowPolicyNewParamsPatternType = "UNKNOWN"` - `VerifySender param.Field[bool]` Body param: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `Comments param.Field[string]` Body param - `IsRecipient param.Field[bool]` Body param - `IsSender param.Field[bool]` Body param - `IsSpoof param.Field[bool]` Body param ### Returns - `type SettingAllowPolicyNewResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsAcceptableSender bool` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `IsExemptRecipient bool` Messages to this recipient will bypass all detections. - `IsRegex bool` - `IsTrustedSender bool` Messages from this sender will bypass all detections and link following. - `LastModified Time` - `Pattern string` - `PatternType SettingAllowPolicyNewResponsePatternType` - `const SettingAllowPolicyNewResponsePatternTypeEmail SettingAllowPolicyNewResponsePatternType = "EMAIL"` - `const SettingAllowPolicyNewResponsePatternTypeDomain SettingAllowPolicyNewResponsePatternType = "DOMAIN"` - `const SettingAllowPolicyNewResponsePatternTypeIP SettingAllowPolicyNewResponsePatternType = "IP"` - `const SettingAllowPolicyNewResponsePatternTypeUnknown SettingAllowPolicyNewResponsePatternType = "UNKNOWN"` - `VerifySender bool` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `Comments string` - `IsRecipient bool` - `IsSender bool` - `IsSpoof bool` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) allowPolicy, err := client.EmailSecurity.Settings.AllowPolicies.New(context.TODO(), email_security.SettingAllowPolicyNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), IsAcceptableSender: cloudflare.F(false), IsExemptRecipient: cloudflare.F(false), IsRegex: cloudflare.F(false), IsTrustedSender: cloudflare.F(true), Pattern: cloudflare.F("test@example.com"), PatternType: cloudflare.F(email_security.SettingAllowPolicyNewParamsPatternTypeEmail), VerifySender: cloudflare.F(true), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", allowPolicy.ID) } ``` #### Response ```json { "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_acceptable_sender": true, "is_exempt_recipient": true, "is_regex": true, "is_trusted_sender": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "verify_sender": true, "comments": "comments", "is_recipient": true, "is_sender": true, "is_spoof": true }, "success": true } ``` ## Update an email allow policy `client.EmailSecurity.Settings.AllowPolicies.Edit(ctx, policyID, params) (*SettingAllowPolicyEditResponse, error)` **patch** `/accounts/{account_id}/email-security/settings/allow_policies/{policy_id}` Updates an existing email allow policy, modifying its matching criteria or scope. ### Parameters - `policyID int64` The unique identifier for the allow policy. - `params SettingAllowPolicyEditParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Comments param.Field[string]` Body param - `IsAcceptableSender param.Field[bool]` Body param: Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `IsExemptRecipient param.Field[bool]` Body param: Messages to this recipient will bypass all detections. - `IsRegex param.Field[bool]` Body param - `IsTrustedSender param.Field[bool]` Body param: Messages from this sender will bypass all detections and link following. - `Pattern param.Field[string]` Body param - `PatternType param.Field[SettingAllowPolicyEditParamsPatternType]` Body param - `const SettingAllowPolicyEditParamsPatternTypeEmail SettingAllowPolicyEditParamsPatternType = "EMAIL"` - `const SettingAllowPolicyEditParamsPatternTypeDomain SettingAllowPolicyEditParamsPatternType = "DOMAIN"` - `const SettingAllowPolicyEditParamsPatternTypeIP SettingAllowPolicyEditParamsPatternType = "IP"` - `const SettingAllowPolicyEditParamsPatternTypeUnknown SettingAllowPolicyEditParamsPatternType = "UNKNOWN"` - `VerifySender param.Field[bool]` Body param: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Returns - `type SettingAllowPolicyEditResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsAcceptableSender bool` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `IsExemptRecipient bool` Messages to this recipient will bypass all detections. - `IsRegex bool` - `IsTrustedSender bool` Messages from this sender will bypass all detections and link following. - `LastModified Time` - `Pattern string` - `PatternType SettingAllowPolicyEditResponsePatternType` - `const SettingAllowPolicyEditResponsePatternTypeEmail SettingAllowPolicyEditResponsePatternType = "EMAIL"` - `const SettingAllowPolicyEditResponsePatternTypeDomain SettingAllowPolicyEditResponsePatternType = "DOMAIN"` - `const SettingAllowPolicyEditResponsePatternTypeIP SettingAllowPolicyEditResponsePatternType = "IP"` - `const SettingAllowPolicyEditResponsePatternTypeUnknown SettingAllowPolicyEditResponsePatternType = "UNKNOWN"` - `VerifySender bool` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `Comments string` - `IsRecipient bool` - `IsSender bool` - `IsSpoof bool` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) response, err := client.EmailSecurity.Settings.AllowPolicies.Edit( context.TODO(), int64(2401), email_security.SettingAllowPolicyEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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_acceptable_sender": true, "is_exempt_recipient": true, "is_regex": true, "is_trusted_sender": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "verify_sender": true, "comments": "comments", "is_recipient": true, "is_sender": true, "is_spoof": true }, "success": true } ``` ## Delete an email allow policy `client.EmailSecurity.Settings.AllowPolicies.Delete(ctx, policyID, body) (*SettingAllowPolicyDeleteResponse, error)` **delete** `/accounts/{account_id}/email-security/settings/allow_policies/{policy_id}` Removes an email allow policy. Previously allowed senders will be subject to normal security scanning. ### Parameters - `policyID int64` The unique identifier for the allow policy. - `body SettingAllowPolicyDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingAllowPolicyDeleteResponse struct{…}` - `ID int64` The unique identifier for the allow policy. ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) allowPolicy, err := client.EmailSecurity.Settings.AllowPolicies.Delete( context.TODO(), int64(2401), email_security.SettingAllowPolicyDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", allowPolicy.ID) } ``` #### Response ```json { "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 }, "success": true } ``` # Block Senders ## List blocked email senders `client.EmailSecurity.Settings.BlockSenders.List(ctx, params) (*V4PagePaginationArray[SettingBlockSenderListResponse], error)` **get** `/accounts/{account_id}/email-security/settings/block_senders` Lists all blocked sender entries with their patterns and block reasons. ### Parameters - `params SettingBlockSenderListParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Direction param.Field[SettingBlockSenderListParamsDirection]` Query param: The sorting direction. - `const SettingBlockSenderListParamsDirectionAsc SettingBlockSenderListParamsDirection = "asc"` - `const SettingBlockSenderListParamsDirectionDesc SettingBlockSenderListParamsDirection = "desc"` - `Order param.Field[SettingBlockSenderListParamsOrder]` Query param: The field to sort by. - `const SettingBlockSenderListParamsOrderPattern SettingBlockSenderListParamsOrder = "pattern"` - `const SettingBlockSenderListParamsOrderCreatedAt SettingBlockSenderListParamsOrder = "created_at"` - `Page param.Field[int64]` Query param: The page number of paginated results. - `Pattern param.Field[string]` Query param - `PatternType param.Field[SettingBlockSenderListParamsPatternType]` Query param - `const SettingBlockSenderListParamsPatternTypeEmail SettingBlockSenderListParamsPatternType = "EMAIL"` - `const SettingBlockSenderListParamsPatternTypeDomain SettingBlockSenderListParamsPatternType = "DOMAIN"` - `const SettingBlockSenderListParamsPatternTypeIP SettingBlockSenderListParamsPatternType = "IP"` - `const SettingBlockSenderListParamsPatternTypeUnknown SettingBlockSenderListParamsPatternType = "UNKNOWN"` - `PerPage param.Field[int64]` Query param: The number of results per page. - `Search param.Field[string]` Query param: Allows searching in multiple properties of a record simultaneously. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future. ### Returns - `type SettingBlockSenderListResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsRegex bool` - `LastModified Time` - `Pattern string` - `PatternType SettingBlockSenderListResponsePatternType` - `const SettingBlockSenderListResponsePatternTypeEmail SettingBlockSenderListResponsePatternType = "EMAIL"` - `const SettingBlockSenderListResponsePatternTypeDomain SettingBlockSenderListResponsePatternType = "DOMAIN"` - `const SettingBlockSenderListResponsePatternTypeIP SettingBlockSenderListResponsePatternType = "IP"` - `const SettingBlockSenderListResponsePatternTypeUnknown SettingBlockSenderListResponsePatternType = "UNKNOWN"` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.EmailSecurity.Settings.BlockSenders.List(context.TODO(), email_security.SettingBlockSenderListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": 2402, "created_at": "2019-12-27T18:11:19.117Z", "is_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "comments": "comments" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get a blocked email sender `client.EmailSecurity.Settings.BlockSenders.Get(ctx, patternID, query) (*SettingBlockSenderGetResponse, error)` **get** `/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}` Gets information about a specific blocked sender entry, including the pattern and block reason. ### Parameters - `patternID int64` The unique identifier for the allow policy. - `query SettingBlockSenderGetParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingBlockSenderGetResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsRegex bool` - `LastModified Time` - `Pattern string` - `PatternType SettingBlockSenderGetResponsePatternType` - `const SettingBlockSenderGetResponsePatternTypeEmail SettingBlockSenderGetResponsePatternType = "EMAIL"` - `const SettingBlockSenderGetResponsePatternTypeDomain SettingBlockSenderGetResponsePatternType = "DOMAIN"` - `const SettingBlockSenderGetResponsePatternTypeIP SettingBlockSenderGetResponsePatternType = "IP"` - `const SettingBlockSenderGetResponsePatternTypeUnknown SettingBlockSenderGetResponsePatternType = "UNKNOWN"` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) blockSender, err := client.EmailSecurity.Settings.BlockSenders.Get( context.TODO(), int64(2402), email_security.SettingBlockSenderGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", blockSender.ID) } ``` #### Response ```json { "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": 2402, "created_at": "2019-12-27T18:11:19.117Z", "is_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "comments": "comments" }, "success": true } ``` ## Create a blocked email sender `client.EmailSecurity.Settings.BlockSenders.New(ctx, params) (*SettingBlockSenderNewResponse, error)` **post** `/accounts/{account_id}/email-security/settings/block_senders` Adds a sender pattern to the email block list, preventing messages from matching senders from being delivered. ### Parameters - `params SettingBlockSenderNewParams` - `AccountID param.Field[string]` Path param: Account Identifier - `IsRegex param.Field[bool]` Body param - `Pattern param.Field[string]` Body param - `PatternType param.Field[SettingBlockSenderNewParamsPatternType]` Body param - `const SettingBlockSenderNewParamsPatternTypeEmail SettingBlockSenderNewParamsPatternType = "EMAIL"` - `const SettingBlockSenderNewParamsPatternTypeDomain SettingBlockSenderNewParamsPatternType = "DOMAIN"` - `const SettingBlockSenderNewParamsPatternTypeIP SettingBlockSenderNewParamsPatternType = "IP"` - `const SettingBlockSenderNewParamsPatternTypeUnknown SettingBlockSenderNewParamsPatternType = "UNKNOWN"` - `Comments param.Field[string]` Body param ### Returns - `type SettingBlockSenderNewResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsRegex bool` - `LastModified Time` - `Pattern string` - `PatternType SettingBlockSenderNewResponsePatternType` - `const SettingBlockSenderNewResponsePatternTypeEmail SettingBlockSenderNewResponsePatternType = "EMAIL"` - `const SettingBlockSenderNewResponsePatternTypeDomain SettingBlockSenderNewResponsePatternType = "DOMAIN"` - `const SettingBlockSenderNewResponsePatternTypeIP SettingBlockSenderNewResponsePatternType = "IP"` - `const SettingBlockSenderNewResponsePatternTypeUnknown SettingBlockSenderNewResponsePatternType = "UNKNOWN"` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) blockSender, err := client.EmailSecurity.Settings.BlockSenders.New(context.TODO(), email_security.SettingBlockSenderNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), IsRegex: cloudflare.F(false), Pattern: cloudflare.F("test@example.com"), PatternType: cloudflare.F(email_security.SettingBlockSenderNewParamsPatternTypeEmail), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", blockSender.ID) } ``` #### Response ```json { "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": 2402, "created_at": "2019-12-27T18:11:19.117Z", "is_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "comments": "comments" }, "success": true } ``` ## Update a blocked email sender `client.EmailSecurity.Settings.BlockSenders.Edit(ctx, patternID, params) (*SettingBlockSenderEditResponse, error)` **patch** `/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}` Modifies a blocked sender entry, updating its pattern or block reason. ### Parameters - `patternID int64` The unique identifier for the allow policy. - `params SettingBlockSenderEditParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Comments param.Field[string]` Body param - `IsRegex param.Field[bool]` Body param - `Pattern param.Field[string]` Body param - `PatternType param.Field[SettingBlockSenderEditParamsPatternType]` Body param - `const SettingBlockSenderEditParamsPatternTypeEmail SettingBlockSenderEditParamsPatternType = "EMAIL"` - `const SettingBlockSenderEditParamsPatternTypeDomain SettingBlockSenderEditParamsPatternType = "DOMAIN"` - `const SettingBlockSenderEditParamsPatternTypeIP SettingBlockSenderEditParamsPatternType = "IP"` - `const SettingBlockSenderEditParamsPatternTypeUnknown SettingBlockSenderEditParamsPatternType = "UNKNOWN"` ### Returns - `type SettingBlockSenderEditResponse struct{…}` - `ID int64` The unique identifier for the allow policy. - `CreatedAt Time` - `IsRegex bool` - `LastModified Time` - `Pattern string` - `PatternType SettingBlockSenderEditResponsePatternType` - `const SettingBlockSenderEditResponsePatternTypeEmail SettingBlockSenderEditResponsePatternType = "EMAIL"` - `const SettingBlockSenderEditResponsePatternTypeDomain SettingBlockSenderEditResponsePatternType = "DOMAIN"` - `const SettingBlockSenderEditResponsePatternTypeIP SettingBlockSenderEditResponsePatternType = "IP"` - `const SettingBlockSenderEditResponsePatternTypeUnknown SettingBlockSenderEditResponsePatternType = "UNKNOWN"` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) response, err := client.EmailSecurity.Settings.BlockSenders.Edit( context.TODO(), int64(2402), email_security.SettingBlockSenderEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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": 2402, "created_at": "2019-12-27T18:11:19.117Z", "is_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "pattern": "x", "pattern_type": "EMAIL", "comments": "comments" }, "success": true } ``` ## Delete a blocked email sender `client.EmailSecurity.Settings.BlockSenders.Delete(ctx, patternID, body) (*SettingBlockSenderDeleteResponse, error)` **delete** `/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}` Removes a sender from the email block list, allowing their messages to be delivered normally. ### Parameters - `patternID int64` The unique identifier for the allow policy. - `body SettingBlockSenderDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingBlockSenderDeleteResponse struct{…}` - `ID int64` The unique identifier for the allow policy. ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) blockSender, err := client.EmailSecurity.Settings.BlockSenders.Delete( context.TODO(), int64(2402), email_security.SettingBlockSenderDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", blockSender.ID) } ``` #### Response ```json { "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": 2402 }, "success": true } ``` # Domains ## List protected email domains `client.EmailSecurity.Settings.Domains.List(ctx, params) (*V4PagePaginationArray[SettingDomainListResponse], error)` **get** `/accounts/{account_id}/email-security/settings/domains` Lists, searches, and sorts an account’s email domains. ### Parameters - `params SettingDomainListParams` - `AccountID param.Field[string]` Path param: Account Identifier - `ActiveDeliveryMode param.Field[SettingDomainListParamsActiveDeliveryMode]` Query param: Filters response to domains with the currently active delivery mode. - `const SettingDomainListParamsActiveDeliveryModeDirect SettingDomainListParamsActiveDeliveryMode = "DIRECT"` - `const SettingDomainListParamsActiveDeliveryModeBcc SettingDomainListParamsActiveDeliveryMode = "BCC"` - `const SettingDomainListParamsActiveDeliveryModeJournal SettingDomainListParamsActiveDeliveryMode = "JOURNAL"` - `const SettingDomainListParamsActiveDeliveryModeAPI SettingDomainListParamsActiveDeliveryMode = "API"` - `const SettingDomainListParamsActiveDeliveryModeRetroScan SettingDomainListParamsActiveDeliveryMode = "RETRO_SCAN"` - `AllowedDeliveryMode param.Field[SettingDomainListParamsAllowedDeliveryMode]` Query param: Filters response to domains with the provided delivery mode. - `const SettingDomainListParamsAllowedDeliveryModeDirect SettingDomainListParamsAllowedDeliveryMode = "DIRECT"` - `const SettingDomainListParamsAllowedDeliveryModeBcc SettingDomainListParamsAllowedDeliveryMode = "BCC"` - `const SettingDomainListParamsAllowedDeliveryModeJournal SettingDomainListParamsAllowedDeliveryMode = "JOURNAL"` - `const SettingDomainListParamsAllowedDeliveryModeAPI SettingDomainListParamsAllowedDeliveryMode = "API"` - `const SettingDomainListParamsAllowedDeliveryModeRetroScan SettingDomainListParamsAllowedDeliveryMode = "RETRO_SCAN"` - `Direction param.Field[SettingDomainListParamsDirection]` Query param: The sorting direction. - `const SettingDomainListParamsDirectionAsc SettingDomainListParamsDirection = "asc"` - `const SettingDomainListParamsDirectionDesc SettingDomainListParamsDirection = "desc"` - `Domain param.Field[[]string]` Query param: Filters results by the provided domains, allowing for multiple occurrences. - `IntegrationID param.Field[string]` Query param: Filters response to domains with the provided integration ID. - `Order param.Field[SettingDomainListParamsOrder]` Query param: The field to sort by. - `const SettingDomainListParamsOrderDomain SettingDomainListParamsOrder = "domain"` - `const SettingDomainListParamsOrderCreatedAt SettingDomainListParamsOrder = "created_at"` - `Page param.Field[int64]` Query param: The page number of paginated results. - `PerPage param.Field[int64]` Query param: The number of results per page. - `Search param.Field[string]` Query param: Allows searching in multiple properties of a record simultaneously. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future. ### Returns - `type SettingDomainListResponse struct{…}` - `ID int64` The unique identifier for the domain. - `AllowedDeliveryModes []SettingDomainListResponseAllowedDeliveryMode` - `const SettingDomainListResponseAllowedDeliveryModeDirect SettingDomainListResponseAllowedDeliveryMode = "DIRECT"` - `const SettingDomainListResponseAllowedDeliveryModeBcc SettingDomainListResponseAllowedDeliveryMode = "BCC"` - `const SettingDomainListResponseAllowedDeliveryModeJournal SettingDomainListResponseAllowedDeliveryMode = "JOURNAL"` - `const SettingDomainListResponseAllowedDeliveryModeAPI SettingDomainListResponseAllowedDeliveryMode = "API"` - `const SettingDomainListResponseAllowedDeliveryModeRetroScan SettingDomainListResponseAllowedDeliveryMode = "RETRO_SCAN"` - `CreatedAt Time` - `Domain string` - `DropDispositions []SettingDomainListResponseDropDisposition` - `const SettingDomainListResponseDropDispositionMalicious SettingDomainListResponseDropDisposition = "MALICIOUS"` - `const SettingDomainListResponseDropDispositionMaliciousBec SettingDomainListResponseDropDisposition = "MALICIOUS-BEC"` - `const SettingDomainListResponseDropDispositionSuspicious SettingDomainListResponseDropDisposition = "SUSPICIOUS"` - `const SettingDomainListResponseDropDispositionSpoof SettingDomainListResponseDropDisposition = "SPOOF"` - `const SettingDomainListResponseDropDispositionSpam SettingDomainListResponseDropDisposition = "SPAM"` - `const SettingDomainListResponseDropDispositionBulk SettingDomainListResponseDropDisposition = "BULK"` - `const SettingDomainListResponseDropDispositionEncrypted SettingDomainListResponseDropDisposition = "ENCRYPTED"` - `const SettingDomainListResponseDropDispositionExternal SettingDomainListResponseDropDisposition = "EXTERNAL"` - `const SettingDomainListResponseDropDispositionUnknown SettingDomainListResponseDropDisposition = "UNKNOWN"` - `const SettingDomainListResponseDropDispositionNone SettingDomainListResponseDropDisposition = "NONE"` - `IPRestrictions []string` - `LastModified Time` - `LookbackHops int64` - `Regions []SettingDomainListResponseRegion` - `const SettingDomainListResponseRegionGlobal SettingDomainListResponseRegion = "GLOBAL"` - `const SettingDomainListResponseRegionAu SettingDomainListResponseRegion = "AU"` - `const SettingDomainListResponseRegionDe SettingDomainListResponseRegion = "DE"` - `const SettingDomainListResponseRegionIn SettingDomainListResponseRegion = "IN"` - `const SettingDomainListResponseRegionUs SettingDomainListResponseRegion = "US"` - `Transport string` - `Authorization SettingDomainListResponseAuthorization` - `Authorized bool` - `Timestamp Time` - `StatusMessage string` - `DMARCStatus SettingDomainListResponseDMARCStatus` - `const SettingDomainListResponseDMARCStatusNone SettingDomainListResponseDMARCStatus = "none"` - `const SettingDomainListResponseDMARCStatusGood SettingDomainListResponseDMARCStatus = "good"` - `const SettingDomainListResponseDMARCStatusInvalid SettingDomainListResponseDMARCStatus = "invalid"` - `EmailsProcessed SettingDomainListResponseEmailsProcessed` - `Timestamp Time` - `TotalEmailsProcessed int64` - `TotalEmailsProcessedPrevious int64` - `Folder SettingDomainListResponseFolder` - `const SettingDomainListResponseFolderAllItems SettingDomainListResponseFolder = "AllItems"` - `const SettingDomainListResponseFolderInbox SettingDomainListResponseFolder = "Inbox"` - `InboxProvider SettingDomainListResponseInboxProvider` - `const SettingDomainListResponseInboxProviderMicrosoft SettingDomainListResponseInboxProvider = "Microsoft"` - `const SettingDomainListResponseInboxProviderGoogle SettingDomainListResponseInboxProvider = "Google"` - `IntegrationID string` - `O365TenantID string` - `RequireTLSInbound bool` - `RequireTLSOutbound bool` - `SPFStatus SettingDomainListResponseSPFStatus` - `const SettingDomainListResponseSPFStatusNone SettingDomainListResponseSPFStatus = "none"` - `const SettingDomainListResponseSPFStatusGood SettingDomainListResponseSPFStatus = "good"` - `const SettingDomainListResponseSPFStatusNeutral SettingDomainListResponseSPFStatus = "neutral"` - `const SettingDomainListResponseSPFStatusOpen SettingDomainListResponseSPFStatus = "open"` - `const SettingDomainListResponseSPFStatusInvalid SettingDomainListResponseSPFStatus = "invalid"` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.EmailSecurity.Settings.Domains.List(context.TODO(), email_security.SettingDomainListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": 2400, "allowed_delivery_modes": [ "API" ], "created_at": "2023-11-14T22:13:20Z", "domain": "example.com", "drop_dispositions": [ "MALICIOUS", "SPAM" ], "ip_restrictions": [ "string" ], "last_modified": "2023-11-14T22:13:20Z", "lookback_hops": 2, "regions": [ "GLOBAL" ], "transport": "example.com", "authorization": { "authorized": true, "timestamp": "2019-12-27T18:11:19.117Z", "status_message": "status_message" }, "dmarc_status": "good", "emails_processed": { "timestamp": "2019-12-27T18:11:19.117Z", "total_emails_processed": 0, "total_emails_processed_previous": 0 }, "folder": "Inbox", "inbox_provider": "Microsoft", "integration_id": "a5dbb180-60ea-4578-84bb-d01a5d4e50c3", "o365_tenant_id": "c3c3239d-8858-47df-9618-0e2d9bdf6aa8", "require_tls_inbound": false, "require_tls_outbound": true, "spf_status": "good" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get an email domain `client.EmailSecurity.Settings.Domains.Get(ctx, domainID, query) (*SettingDomainGetResponse, error)` **get** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Gets configuration details for a specific domain in email security. ### Parameters - `domainID int64` The unique identifier for the domain. - `query SettingDomainGetParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingDomainGetResponse struct{…}` - `ID int64` The unique identifier for the domain. - `AllowedDeliveryModes []SettingDomainGetResponseAllowedDeliveryMode` - `const SettingDomainGetResponseAllowedDeliveryModeDirect SettingDomainGetResponseAllowedDeliveryMode = "DIRECT"` - `const SettingDomainGetResponseAllowedDeliveryModeBcc SettingDomainGetResponseAllowedDeliveryMode = "BCC"` - `const SettingDomainGetResponseAllowedDeliveryModeJournal SettingDomainGetResponseAllowedDeliveryMode = "JOURNAL"` - `const SettingDomainGetResponseAllowedDeliveryModeAPI SettingDomainGetResponseAllowedDeliveryMode = "API"` - `const SettingDomainGetResponseAllowedDeliveryModeRetroScan SettingDomainGetResponseAllowedDeliveryMode = "RETRO_SCAN"` - `CreatedAt Time` - `Domain string` - `DropDispositions []SettingDomainGetResponseDropDisposition` - `const SettingDomainGetResponseDropDispositionMalicious SettingDomainGetResponseDropDisposition = "MALICIOUS"` - `const SettingDomainGetResponseDropDispositionMaliciousBec SettingDomainGetResponseDropDisposition = "MALICIOUS-BEC"` - `const SettingDomainGetResponseDropDispositionSuspicious SettingDomainGetResponseDropDisposition = "SUSPICIOUS"` - `const SettingDomainGetResponseDropDispositionSpoof SettingDomainGetResponseDropDisposition = "SPOOF"` - `const SettingDomainGetResponseDropDispositionSpam SettingDomainGetResponseDropDisposition = "SPAM"` - `const SettingDomainGetResponseDropDispositionBulk SettingDomainGetResponseDropDisposition = "BULK"` - `const SettingDomainGetResponseDropDispositionEncrypted SettingDomainGetResponseDropDisposition = "ENCRYPTED"` - `const SettingDomainGetResponseDropDispositionExternal SettingDomainGetResponseDropDisposition = "EXTERNAL"` - `const SettingDomainGetResponseDropDispositionUnknown SettingDomainGetResponseDropDisposition = "UNKNOWN"` - `const SettingDomainGetResponseDropDispositionNone SettingDomainGetResponseDropDisposition = "NONE"` - `IPRestrictions []string` - `LastModified Time` - `LookbackHops int64` - `Regions []SettingDomainGetResponseRegion` - `const SettingDomainGetResponseRegionGlobal SettingDomainGetResponseRegion = "GLOBAL"` - `const SettingDomainGetResponseRegionAu SettingDomainGetResponseRegion = "AU"` - `const SettingDomainGetResponseRegionDe SettingDomainGetResponseRegion = "DE"` - `const SettingDomainGetResponseRegionIn SettingDomainGetResponseRegion = "IN"` - `const SettingDomainGetResponseRegionUs SettingDomainGetResponseRegion = "US"` - `Transport string` - `Authorization SettingDomainGetResponseAuthorization` - `Authorized bool` - `Timestamp Time` - `StatusMessage string` - `DMARCStatus SettingDomainGetResponseDMARCStatus` - `const SettingDomainGetResponseDMARCStatusNone SettingDomainGetResponseDMARCStatus = "none"` - `const SettingDomainGetResponseDMARCStatusGood SettingDomainGetResponseDMARCStatus = "good"` - `const SettingDomainGetResponseDMARCStatusInvalid SettingDomainGetResponseDMARCStatus = "invalid"` - `EmailsProcessed SettingDomainGetResponseEmailsProcessed` - `Timestamp Time` - `TotalEmailsProcessed int64` - `TotalEmailsProcessedPrevious int64` - `Folder SettingDomainGetResponseFolder` - `const SettingDomainGetResponseFolderAllItems SettingDomainGetResponseFolder = "AllItems"` - `const SettingDomainGetResponseFolderInbox SettingDomainGetResponseFolder = "Inbox"` - `InboxProvider SettingDomainGetResponseInboxProvider` - `const SettingDomainGetResponseInboxProviderMicrosoft SettingDomainGetResponseInboxProvider = "Microsoft"` - `const SettingDomainGetResponseInboxProviderGoogle SettingDomainGetResponseInboxProvider = "Google"` - `IntegrationID string` - `O365TenantID string` - `RequireTLSInbound bool` - `RequireTLSOutbound bool` - `SPFStatus SettingDomainGetResponseSPFStatus` - `const SettingDomainGetResponseSPFStatusNone SettingDomainGetResponseSPFStatus = "none"` - `const SettingDomainGetResponseSPFStatusGood SettingDomainGetResponseSPFStatus = "good"` - `const SettingDomainGetResponseSPFStatusNeutral SettingDomainGetResponseSPFStatus = "neutral"` - `const SettingDomainGetResponseSPFStatusOpen SettingDomainGetResponseSPFStatus = "open"` - `const SettingDomainGetResponseSPFStatusInvalid SettingDomainGetResponseSPFStatus = "invalid"` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) domain, err := client.EmailSecurity.Settings.Domains.Get( context.TODO(), int64(2400), email_security.SettingDomainGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", domain.ID) } ``` #### Response ```json { "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": 2400, "allowed_delivery_modes": [ "API" ], "created_at": "2023-11-14T22:13:20Z", "domain": "example.com", "drop_dispositions": [ "MALICIOUS", "SPAM" ], "ip_restrictions": [ "string" ], "last_modified": "2023-11-14T22:13:20Z", "lookback_hops": 2, "regions": [ "GLOBAL" ], "transport": "example.com", "authorization": { "authorized": true, "timestamp": "2019-12-27T18:11:19.117Z", "status_message": "status_message" }, "dmarc_status": "good", "emails_processed": { "timestamp": "2019-12-27T18:11:19.117Z", "total_emails_processed": 0, "total_emails_processed_previous": 0 }, "folder": "Inbox", "inbox_provider": "Microsoft", "integration_id": "a5dbb180-60ea-4578-84bb-d01a5d4e50c3", "o365_tenant_id": "c3c3239d-8858-47df-9618-0e2d9bdf6aa8", "require_tls_inbound": false, "require_tls_outbound": true, "spf_status": "good" }, "success": true } ``` ## Update an email domain `client.EmailSecurity.Settings.Domains.Edit(ctx, domainID, params) (*SettingDomainEditResponse, error)` **patch** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Updates configuration for a domain in email security. ### Parameters - `domainID int64` The unique identifier for the domain. - `params SettingDomainEditParams` - `AccountID param.Field[string]` Path param: Account Identifier - `IPRestrictions param.Field[[]string]` Body param - `AllowedDeliveryModes param.Field[[]SettingDomainEditParamsAllowedDeliveryMode]` Body param - `const SettingDomainEditParamsAllowedDeliveryModeDirect SettingDomainEditParamsAllowedDeliveryMode = "DIRECT"` - `const SettingDomainEditParamsAllowedDeliveryModeBcc SettingDomainEditParamsAllowedDeliveryMode = "BCC"` - `const SettingDomainEditParamsAllowedDeliveryModeJournal SettingDomainEditParamsAllowedDeliveryMode = "JOURNAL"` - `const SettingDomainEditParamsAllowedDeliveryModeAPI SettingDomainEditParamsAllowedDeliveryMode = "API"` - `const SettingDomainEditParamsAllowedDeliveryModeRetroScan SettingDomainEditParamsAllowedDeliveryMode = "RETRO_SCAN"` - `Domain param.Field[string]` Body param - `DropDispositions param.Field[[]SettingDomainEditParamsDropDisposition]` Body param - `const SettingDomainEditParamsDropDispositionMalicious SettingDomainEditParamsDropDisposition = "MALICIOUS"` - `const SettingDomainEditParamsDropDispositionMaliciousBec SettingDomainEditParamsDropDisposition = "MALICIOUS-BEC"` - `const SettingDomainEditParamsDropDispositionSuspicious SettingDomainEditParamsDropDisposition = "SUSPICIOUS"` - `const SettingDomainEditParamsDropDispositionSpoof SettingDomainEditParamsDropDisposition = "SPOOF"` - `const SettingDomainEditParamsDropDispositionSpam SettingDomainEditParamsDropDisposition = "SPAM"` - `const SettingDomainEditParamsDropDispositionBulk SettingDomainEditParamsDropDisposition = "BULK"` - `const SettingDomainEditParamsDropDispositionEncrypted SettingDomainEditParamsDropDisposition = "ENCRYPTED"` - `const SettingDomainEditParamsDropDispositionExternal SettingDomainEditParamsDropDisposition = "EXTERNAL"` - `const SettingDomainEditParamsDropDispositionUnknown SettingDomainEditParamsDropDisposition = "UNKNOWN"` - `const SettingDomainEditParamsDropDispositionNone SettingDomainEditParamsDropDisposition = "NONE"` - `Folder param.Field[SettingDomainEditParamsFolder]` Body param - `const SettingDomainEditParamsFolderAllItems SettingDomainEditParamsFolder = "AllItems"` - `const SettingDomainEditParamsFolderInbox SettingDomainEditParamsFolder = "Inbox"` - `IntegrationID param.Field[string]` Body param - `LookbackHops param.Field[int64]` Body param - `Regions param.Field[[]SettingDomainEditParamsRegion]` Body param - `const SettingDomainEditParamsRegionGlobal SettingDomainEditParamsRegion = "GLOBAL"` - `const SettingDomainEditParamsRegionAu SettingDomainEditParamsRegion = "AU"` - `const SettingDomainEditParamsRegionDe SettingDomainEditParamsRegion = "DE"` - `const SettingDomainEditParamsRegionIn SettingDomainEditParamsRegion = "IN"` - `const SettingDomainEditParamsRegionUs SettingDomainEditParamsRegion = "US"` - `RequireTLSInbound param.Field[bool]` Body param - `RequireTLSOutbound param.Field[bool]` Body param - `Transport param.Field[string]` Body param ### Returns - `type SettingDomainEditResponse struct{…}` - `ID int64` The unique identifier for the domain. - `AllowedDeliveryModes []SettingDomainEditResponseAllowedDeliveryMode` - `const SettingDomainEditResponseAllowedDeliveryModeDirect SettingDomainEditResponseAllowedDeliveryMode = "DIRECT"` - `const SettingDomainEditResponseAllowedDeliveryModeBcc SettingDomainEditResponseAllowedDeliveryMode = "BCC"` - `const SettingDomainEditResponseAllowedDeliveryModeJournal SettingDomainEditResponseAllowedDeliveryMode = "JOURNAL"` - `const SettingDomainEditResponseAllowedDeliveryModeAPI SettingDomainEditResponseAllowedDeliveryMode = "API"` - `const SettingDomainEditResponseAllowedDeliveryModeRetroScan SettingDomainEditResponseAllowedDeliveryMode = "RETRO_SCAN"` - `CreatedAt Time` - `Domain string` - `DropDispositions []SettingDomainEditResponseDropDisposition` - `const SettingDomainEditResponseDropDispositionMalicious SettingDomainEditResponseDropDisposition = "MALICIOUS"` - `const SettingDomainEditResponseDropDispositionMaliciousBec SettingDomainEditResponseDropDisposition = "MALICIOUS-BEC"` - `const SettingDomainEditResponseDropDispositionSuspicious SettingDomainEditResponseDropDisposition = "SUSPICIOUS"` - `const SettingDomainEditResponseDropDispositionSpoof SettingDomainEditResponseDropDisposition = "SPOOF"` - `const SettingDomainEditResponseDropDispositionSpam SettingDomainEditResponseDropDisposition = "SPAM"` - `const SettingDomainEditResponseDropDispositionBulk SettingDomainEditResponseDropDisposition = "BULK"` - `const SettingDomainEditResponseDropDispositionEncrypted SettingDomainEditResponseDropDisposition = "ENCRYPTED"` - `const SettingDomainEditResponseDropDispositionExternal SettingDomainEditResponseDropDisposition = "EXTERNAL"` - `const SettingDomainEditResponseDropDispositionUnknown SettingDomainEditResponseDropDisposition = "UNKNOWN"` - `const SettingDomainEditResponseDropDispositionNone SettingDomainEditResponseDropDisposition = "NONE"` - `IPRestrictions []string` - `LastModified Time` - `LookbackHops int64` - `Regions []SettingDomainEditResponseRegion` - `const SettingDomainEditResponseRegionGlobal SettingDomainEditResponseRegion = "GLOBAL"` - `const SettingDomainEditResponseRegionAu SettingDomainEditResponseRegion = "AU"` - `const SettingDomainEditResponseRegionDe SettingDomainEditResponseRegion = "DE"` - `const SettingDomainEditResponseRegionIn SettingDomainEditResponseRegion = "IN"` - `const SettingDomainEditResponseRegionUs SettingDomainEditResponseRegion = "US"` - `Transport string` - `Authorization SettingDomainEditResponseAuthorization` - `Authorized bool` - `Timestamp Time` - `StatusMessage string` - `DMARCStatus SettingDomainEditResponseDMARCStatus` - `const SettingDomainEditResponseDMARCStatusNone SettingDomainEditResponseDMARCStatus = "none"` - `const SettingDomainEditResponseDMARCStatusGood SettingDomainEditResponseDMARCStatus = "good"` - `const SettingDomainEditResponseDMARCStatusInvalid SettingDomainEditResponseDMARCStatus = "invalid"` - `EmailsProcessed SettingDomainEditResponseEmailsProcessed` - `Timestamp Time` - `TotalEmailsProcessed int64` - `TotalEmailsProcessedPrevious int64` - `Folder SettingDomainEditResponseFolder` - `const SettingDomainEditResponseFolderAllItems SettingDomainEditResponseFolder = "AllItems"` - `const SettingDomainEditResponseFolderInbox SettingDomainEditResponseFolder = "Inbox"` - `InboxProvider SettingDomainEditResponseInboxProvider` - `const SettingDomainEditResponseInboxProviderMicrosoft SettingDomainEditResponseInboxProvider = "Microsoft"` - `const SettingDomainEditResponseInboxProviderGoogle SettingDomainEditResponseInboxProvider = "Google"` - `IntegrationID string` - `O365TenantID string` - `RequireTLSInbound bool` - `RequireTLSOutbound bool` - `SPFStatus SettingDomainEditResponseSPFStatus` - `const SettingDomainEditResponseSPFStatusNone SettingDomainEditResponseSPFStatus = "none"` - `const SettingDomainEditResponseSPFStatusGood SettingDomainEditResponseSPFStatus = "good"` - `const SettingDomainEditResponseSPFStatusNeutral SettingDomainEditResponseSPFStatus = "neutral"` - `const SettingDomainEditResponseSPFStatusOpen SettingDomainEditResponseSPFStatus = "open"` - `const SettingDomainEditResponseSPFStatusInvalid SettingDomainEditResponseSPFStatus = "invalid"` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) response, err := client.EmailSecurity.Settings.Domains.Edit( context.TODO(), int64(2400), email_security.SettingDomainEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), IPRestrictions: cloudflare.F([]string{"192.0.2.0/24", "2001:db8::/32"}), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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": 2400, "allowed_delivery_modes": [ "API" ], "created_at": "2023-11-14T22:13:20Z", "domain": "example.com", "drop_dispositions": [ "MALICIOUS", "SPAM" ], "ip_restrictions": [ "string" ], "last_modified": "2023-11-14T22:13:20Z", "lookback_hops": 2, "regions": [ "GLOBAL" ], "transport": "example.com", "authorization": { "authorized": true, "timestamp": "2019-12-27T18:11:19.117Z", "status_message": "status_message" }, "dmarc_status": "good", "emails_processed": { "timestamp": "2019-12-27T18:11:19.117Z", "total_emails_processed": 0, "total_emails_processed_previous": 0 }, "folder": "Inbox", "inbox_provider": "Microsoft", "integration_id": "a5dbb180-60ea-4578-84bb-d01a5d4e50c3", "o365_tenant_id": "c3c3239d-8858-47df-9618-0e2d9bdf6aa8", "require_tls_inbound": false, "require_tls_outbound": true, "spf_status": "good" }, "success": true } ``` ## Unprotect an email domain `client.EmailSecurity.Settings.Domains.Delete(ctx, domainID, body) (*SettingDomainDeleteResponse, error)` **delete** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Unprotect an email domain ### Parameters - `domainID int64` The unique identifier for the domain. - `body SettingDomainDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingDomainDeleteResponse struct{…}` - `ID int64` The unique identifier for the domain. ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) domain, err := client.EmailSecurity.Settings.Domains.Delete( context.TODO(), int64(2400), email_security.SettingDomainDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", domain.ID) } ``` #### Response ```json { "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": 2400 }, "success": true } ``` ## Unprotect multiple email domains `client.EmailSecurity.Settings.Domains.BulkDelete(ctx, body) (*SinglePage[SettingDomainBulkDeleteResponse], error)` **delete** `/accounts/{account_id}/email-security/settings/domains` Bulk removes multiple domains from email security configuration in a single request. ### Parameters - `body SettingDomainBulkDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingDomainBulkDeleteResponse struct{…}` - `ID int64` The unique identifier for the domain. ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.EmailSecurity.Settings.Domains.BulkDelete(context.TODO(), email_security.SettingDomainBulkDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": 2400 } ], "success": true } ``` # Impersonation Registry ## List entries in impersonation registry `client.EmailSecurity.Settings.ImpersonationRegistry.List(ctx, params) (*V4PagePaginationArray[SettingImpersonationRegistryListResponse], error)` **get** `/accounts/{account_id}/email-security/settings/impersonation_registry` Lists, searches, and sorts entries in the impersonation registry. ### Parameters - `params SettingImpersonationRegistryListParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Direction param.Field[SettingImpersonationRegistryListParamsDirection]` Query param: The sorting direction. - `const SettingImpersonationRegistryListParamsDirectionAsc SettingImpersonationRegistryListParamsDirection = "asc"` - `const SettingImpersonationRegistryListParamsDirectionDesc SettingImpersonationRegistryListParamsDirection = "desc"` - `Order param.Field[SettingImpersonationRegistryListParamsOrder]` Query param: The field to sort by. - `const SettingImpersonationRegistryListParamsOrderName SettingImpersonationRegistryListParamsOrder = "name"` - `const SettingImpersonationRegistryListParamsOrderEmail SettingImpersonationRegistryListParamsOrder = "email"` - `const SettingImpersonationRegistryListParamsOrderCreatedAt SettingImpersonationRegistryListParamsOrder = "created_at"` - `Page param.Field[int64]` Query param: The page number of paginated results. - `PerPage param.Field[int64]` Query param: The number of results per page. - `Provenance param.Field[SettingImpersonationRegistryListParamsProvenance]` Query param - `const SettingImpersonationRegistryListParamsProvenanceA1SInternal SettingImpersonationRegistryListParamsProvenance = "A1S_INTERNAL"` - `const SettingImpersonationRegistryListParamsProvenanceSnoopyCasbOffice365 SettingImpersonationRegistryListParamsProvenance = "SNOOPY-CASB_OFFICE_365"` - `const SettingImpersonationRegistryListParamsProvenanceSnoopyOffice365 SettingImpersonationRegistryListParamsProvenance = "SNOOPY-OFFICE_365"` - `const SettingImpersonationRegistryListParamsProvenanceSnoopyGoogleDirectory SettingImpersonationRegistryListParamsProvenance = "SNOOPY-GOOGLE_DIRECTORY"` - `Search param.Field[string]` Query param: Allows searching in multiple properties of a record simultaneously. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future. ### Returns - `type SettingImpersonationRegistryListResponse struct{…}` - `ID int64` - `CreatedAt Time` - `Email string` - `IsEmailRegex bool` - `LastModified Time` - `Name string` - `Comments string` - `DirectoryID int64` - `DirectoryNodeID int64` - `ExternalDirectoryNodeID string` - `Provenance string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.EmailSecurity.Settings.ImpersonationRegistry.List(context.TODO(), email_security.SettingImpersonationRegistryListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "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": 2403, "created_at": "2019-12-27T18:11:19.117Z", "email": "email", "is_email_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "name": "name", "comments": "comments", "directory_id": 0, "directory_node_id": 0, "external_directory_node_id": "external_directory_node_id", "provenance": "provenance" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get an entry in impersonation registry `client.EmailSecurity.Settings.ImpersonationRegistry.Get(ctx, displayNameID, query) (*SettingImpersonationRegistryGetResponse, error)` **get** `/accounts/{account_id}/email-security/settings/impersonation_registry/{display_name_id}` Retrieves a display name entry used for impersonation protection. ### Parameters - `displayNameID int64` - `query SettingImpersonationRegistryGetParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingImpersonationRegistryGetResponse struct{…}` - `ID int64` - `CreatedAt Time` - `Email string` - `IsEmailRegex bool` - `LastModified Time` - `Name string` - `Comments string` - `DirectoryID int64` - `DirectoryNodeID int64` - `ExternalDirectoryNodeID string` - `Provenance string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) impersonationRegistry, err := client.EmailSecurity.Settings.ImpersonationRegistry.Get( context.TODO(), int64(2403), email_security.SettingImpersonationRegistryGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", impersonationRegistry.ID) } ``` #### Response ```json { "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": 2403, "created_at": "2019-12-27T18:11:19.117Z", "email": "email", "is_email_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "name": "name", "comments": "comments", "directory_id": 0, "directory_node_id": 0, "external_directory_node_id": "external_directory_node_id", "provenance": "provenance" }, "success": true } ``` ## Create an entry in impersonation registry `client.EmailSecurity.Settings.ImpersonationRegistry.New(ctx, params) (*SettingImpersonationRegistryNewResponse, error)` **post** `/accounts/{account_id}/email-security/settings/impersonation_registry` Creates a display name entry for email security impersonation protection. ### Parameters - `params SettingImpersonationRegistryNewParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Email param.Field[string]` Body param - `IsEmailRegex param.Field[bool]` Body param - `Name param.Field[string]` Body param ### Returns - `type SettingImpersonationRegistryNewResponse struct{…}` - `ID int64` - `CreatedAt Time` - `Email string` - `IsEmailRegex bool` - `LastModified Time` - `Name string` - `Comments string` - `DirectoryID int64` - `DirectoryNodeID int64` - `ExternalDirectoryNodeID string` - `Provenance string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) impersonationRegistry, err := client.EmailSecurity.Settings.ImpersonationRegistry.New(context.TODO(), email_security.SettingImpersonationRegistryNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Email: cloudflare.F("email"), IsEmailRegex: cloudflare.F(true), Name: cloudflare.F("name"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", impersonationRegistry.ID) } ``` #### Response ```json { "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": 2403, "created_at": "2019-12-27T18:11:19.117Z", "email": "email", "is_email_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "name": "name", "comments": "comments", "directory_id": 0, "directory_node_id": 0, "external_directory_node_id": "external_directory_node_id", "provenance": "provenance" }, "success": true } ``` ## Update an entry in impersonation registry `client.EmailSecurity.Settings.ImpersonationRegistry.Edit(ctx, displayNameID, params) (*SettingImpersonationRegistryEditResponse, error)` **patch** `/accounts/{account_id}/email-security/settings/impersonation_registry/{display_name_id}` Updates a display name entry used for impersonation protection. ### Parameters - `displayNameID int64` - `params SettingImpersonationRegistryEditParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Email param.Field[string]` Body param - `IsEmailRegex param.Field[bool]` Body param - `Name param.Field[string]` Body param ### Returns - `type SettingImpersonationRegistryEditResponse struct{…}` - `ID int64` - `CreatedAt Time` - `Email string` - `IsEmailRegex bool` - `LastModified Time` - `Name string` - `Comments string` - `DirectoryID int64` - `DirectoryNodeID int64` - `ExternalDirectoryNodeID string` - `Provenance string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) response, err := client.EmailSecurity.Settings.ImpersonationRegistry.Edit( context.TODO(), int64(2403), email_security.SettingImpersonationRegistryEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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": 2403, "created_at": "2019-12-27T18:11:19.117Z", "email": "email", "is_email_regex": true, "last_modified": "2019-12-27T18:11:19.117Z", "name": "name", "comments": "comments", "directory_id": 0, "directory_node_id": 0, "external_directory_node_id": "external_directory_node_id", "provenance": "provenance" }, "success": true } ``` ## Delete an entry from impersonation registry `client.EmailSecurity.Settings.ImpersonationRegistry.Delete(ctx, displayNameID, body) (*SettingImpersonationRegistryDeleteResponse, error)` **delete** `/accounts/{account_id}/email-security/settings/impersonation_registry/{display_name_id}` Removes a display name from impersonation protection monitoring. ### Parameters - `displayNameID int64` - `body SettingImpersonationRegistryDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingImpersonationRegistryDeleteResponse struct{…}` - `ID int64` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) impersonationRegistry, err := client.EmailSecurity.Settings.ImpersonationRegistry.Delete( context.TODO(), int64(2403), email_security.SettingImpersonationRegistryDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", impersonationRegistry.ID) } ``` #### Response ```json { "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": 2403 }, "success": true } ``` # Trusted Domains ## List trusted email domains `client.EmailSecurity.Settings.TrustedDomains.List(ctx, params) (*V4PagePaginationArray[SettingTrustedDomainListResponse], error)` **get** `/accounts/{account_id}/email-security/settings/trusted_domains` Lists, searches, and sorts an account’s trusted email domains. ### Parameters - `params SettingTrustedDomainListParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Direction param.Field[SettingTrustedDomainListParamsDirection]` Query param: The sorting direction. - `const SettingTrustedDomainListParamsDirectionAsc SettingTrustedDomainListParamsDirection = "asc"` - `const SettingTrustedDomainListParamsDirectionDesc SettingTrustedDomainListParamsDirection = "desc"` - `IsRecent param.Field[bool]` Query param - `IsSimilarity param.Field[bool]` Query param - `Order param.Field[SettingTrustedDomainListParamsOrder]` Query param: The field to sort by. - `const SettingTrustedDomainListParamsOrderPattern SettingTrustedDomainListParamsOrder = "pattern"` - `const SettingTrustedDomainListParamsOrderCreatedAt SettingTrustedDomainListParamsOrder = "created_at"` - `Page param.Field[int64]` Query param: The page number of paginated results. - `Pattern param.Field[string]` Query param - `PerPage param.Field[int64]` Query param: The number of results per page. - `Search param.Field[string]` Query param: Allows searching in multiple properties of a record simultaneously. This parameter is intended for human users, not automation. Its exact behavior is intentionally left unspecified and is subject to change in the future. ### Returns - `type SettingTrustedDomainListResponse struct{…}` - `ID int64` The unique identifier for the trusted domain. - `CreatedAt Time` - `IsRecent bool` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `IsRegex bool` - `IsSimilarity bool` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `LastModified Time` - `Pattern string` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) 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) } ``` #### Response ```json { "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" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get a trusted email domain `client.EmailSecurity.Settings.TrustedDomains.Get(ctx, trustedDomainID, query) (*SettingTrustedDomainGetResponse, error)` **get** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Gets information about a specific trusted domain entry. ### Parameters - `trustedDomainID int64` The unique identifier for the trusted domain. - `query SettingTrustedDomainGetParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingTrustedDomainGetResponse struct{…}` - `ID int64` The unique identifier for the trusted domain. - `CreatedAt Time` - `IsRecent bool` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `IsRegex bool` - `IsSimilarity bool` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `LastModified Time` - `Pattern string` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) trustedDomain, err := client.EmailSecurity.Settings.TrustedDomains.Get( context.TODO(), int64(2401), email_security.SettingTrustedDomainGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", trustedDomain.ID) } ``` #### Response ```json { "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 } ``` ## Create a trusted email domain `client.EmailSecurity.Settings.TrustedDomains.New(ctx, params) (*SettingTrustedDomainNewResponseUnion, error)` **post** `/accounts/{account_id}/email-security/settings/trusted_domains` Adds a domain to the trusted domains list for email security, reducing false positive detections. ### Parameters - `params SettingTrustedDomainNewParams` - `AccountID param.Field[string]` Path param: Account Identifier - `IsRecent param.Field[bool]` Body param: Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `IsRegex param.Field[bool]` Body param - `IsSimilarity param.Field[bool]` Body param: Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `Pattern param.Field[string]` Body param - `Comments param.Field[string]` Body param ### Returns - `type SettingTrustedDomainNewResponseUnion interface{…}` - `type SettingTrustedDomainNewResponseEmailSecurityTrustedDomain struct{…}` - `ID int64` The unique identifier for the trusted domain. - `CreatedAt Time` - `IsRecent bool` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `IsRegex bool` - `IsSimilarity bool` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `LastModified Time` - `Pattern string` - `Comments string` - `type SettingTrustedDomainNewResponseArray []SettingTrustedDomainNewResponseArrayItem` - `ID int64` The unique identifier for the trusted domain. - `CreatedAt Time` - `IsRecent bool` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `IsRegex bool` - `IsSimilarity bool` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `LastModified Time` - `Pattern string` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) trustedDomain, err := client.EmailSecurity.Settings.TrustedDomains.New(context.TODO(), email_security.SettingTrustedDomainNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Body: email_security.SettingTrustedDomainNewParamsBodyEmailSecurityCreateTrustedDomain{ IsRecent: cloudflare.F(true), IsRegex: cloudflare.F(false), IsSimilarity: cloudflare.F(false), Pattern: cloudflare.F("example.com"), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", trustedDomain) } ``` #### Response ```json { "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 } ``` ## Update a trusted email domain `client.EmailSecurity.Settings.TrustedDomains.Edit(ctx, trustedDomainID, params) (*SettingTrustedDomainEditResponse, error)` **patch** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Modifies a trusted domain entry's configuration. ### Parameters - `trustedDomainID int64` The unique identifier for the trusted domain. - `params SettingTrustedDomainEditParams` - `AccountID param.Field[string]` Path param: Account Identifier - `Comments param.Field[string]` Body param - `IsRecent param.Field[bool]` Body param: Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `IsRegex param.Field[bool]` Body param - `IsSimilarity param.Field[bool]` Body param: Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `Pattern param.Field[string]` Body param ### Returns - `type SettingTrustedDomainEditResponse struct{…}` - `ID int64` The unique identifier for the trusted domain. - `CreatedAt Time` - `IsRecent bool` Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `IsRegex bool` - `IsSimilarity bool` Select for partner or other approved domains that have similar spelling to your connected domains. Prevents listed domains from triggering a Spoof disposition. - `LastModified Time` - `Pattern string` - `Comments string` ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) response, err := client.EmailSecurity.Settings.TrustedDomains.Edit( context.TODO(), int64(2401), email_security.SettingTrustedDomainEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.ID) } ``` #### Response ```json { "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 } ``` ## Delete a trusted email domain `client.EmailSecurity.Settings.TrustedDomains.Delete(ctx, trustedDomainID, body) (*SettingTrustedDomainDeleteResponse, error)` **delete** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Removes a domain from the trusted domains list, subjecting it to normal security scanning. ### Parameters - `trustedDomainID int64` The unique identifier for the trusted domain. - `body SettingTrustedDomainDeleteParams` - `AccountID param.Field[string]` Account Identifier ### Returns - `type SettingTrustedDomainDeleteResponse struct{…}` - `ID int64` The unique identifier for the trusted domain. ### Example ```go 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.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) trustedDomain, err := client.EmailSecurity.Settings.TrustedDomains.Delete( context.TODO(), int64(2401), email_security.SettingTrustedDomainDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", trustedDomain.ID) } ``` #### Response ```json { "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 }, "success": true } ```