# Settings # Allow Policies ## List email allow policies `client.emailSecurity.settings.allowPolicies.list(AllowPolicyListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/email-security/settings/allow_policies` Lists, searches, and sorts an account’s email allow policies. ### Parameters - `params: AllowPolicyListParams` - `account_id: string` Path param: Account Identifier - `direction?: "asc" | "desc"` Query param: The sorting direction. - `"asc"` - `"desc"` - `is_acceptable_sender?: boolean` Query param - `is_exempt_recipient?: boolean` Query param - `is_recipient?: boolean` Query param - `is_sender?: boolean` Query param - `is_spoof?: boolean` Query param - `is_trusted_sender?: boolean` Query param - `order?: "pattern" | "created_at"` Query param: The field to sort by. - `"pattern"` - `"created_at"` - `page?: number` Query param: The page number of paginated results. - `pattern?: string` Query param - `pattern_type?: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` Query param - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `per_page?: number` Query param: The number of results per page. - `search?: 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. - `verify_sender?: boolean` Query param ### Returns - `AllowPolicyListResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Example ```node 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 }); // Automatically fetches more pages as needed. for await (const allowPolicyListResponse of client.emailSecurity.settings.allowPolicies.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(allowPolicyListResponse.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 } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get an email allow policy `client.emailSecurity.settings.allowPolicies.get(numberpolicyId, AllowPolicyGetParamsparams, RequestOptionsoptions?): AllowPolicyGetResponse` **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: number` The unique identifier for the allow policy. - `params: AllowPolicyGetParams` - `account_id: string` Account Identifier ### Returns - `AllowPolicyGetResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Example ```node 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 allowPolicy = await client.emailSecurity.settings.allowPolicies.get(2401, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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.create(AllowPolicyCreateParamsparams, RequestOptionsoptions?): AllowPolicyCreateResponse` **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: AllowPolicyCreateParams` - `account_id: string` Path param: Account Identifier - `is_acceptable_sender: boolean` 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. - `is_exempt_recipient: boolean` Body param: Messages to this recipient will bypass all detections. - `is_regex: boolean` Body param - `is_trusted_sender: boolean` Body param: Messages from this sender will bypass all detections and link following. - `pattern: string` Body param - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` Body param - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Body param: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` Body param - `is_recipient?: boolean` Body param - `is_sender?: boolean` Body param - `is_spoof?: boolean` Body param ### Returns - `AllowPolicyCreateResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Example ```node 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 allowPolicy = await client.emailSecurity.settings.allowPolicies.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', is_acceptable_sender: false, is_exempt_recipient: false, is_regex: false, is_trusted_sender: true, pattern: 'test@example.com', pattern_type: 'EMAIL', verify_sender: true, }); console.log(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(numberpolicyId, AllowPolicyEditParamsparams, RequestOptionsoptions?): AllowPolicyEditResponse` **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: number` The unique identifier for the allow policy. - `params: AllowPolicyEditParams` - `account_id: string` Path param: Account Identifier - `comments?: string | null` Body param - `is_acceptable_sender?: boolean | null` 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. - `is_exempt_recipient?: boolean | null` Body param: Messages to this recipient will bypass all detections. - `is_regex?: boolean | null` Body param - `is_trusted_sender?: boolean | null` Body param: Messages from this sender will bypass all detections and link following. - `pattern?: string | null` Body param - `pattern_type?: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN" | null` Body param - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender?: boolean | null` Body param: Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. ### Returns - `AllowPolicyEditResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Example ```node 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 response = await client.emailSecurity.settings.allowPolicies.edit(2401, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(numberpolicyId, AllowPolicyDeleteParamsparams, RequestOptionsoptions?): AllowPolicyDeleteResponse` **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: number` The unique identifier for the allow policy. - `params: AllowPolicyDeleteParams` - `account_id: string` Account Identifier ### Returns - `AllowPolicyDeleteResponse` - `id: number` The unique identifier for the allow policy. ### Example ```node 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 allowPolicy = await client.emailSecurity.settings.allowPolicies.delete(2401, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 } ``` ## Domain Types ### Allow Policy List Response - `AllowPolicyListResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Allow Policy Get Response - `AllowPolicyGetResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Allow Policy Create Response - `AllowPolicyCreateResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Allow Policy Edit Response - `AllowPolicyEditResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_acceptable_sender: boolean` Messages from this sender will be exempted from Spam, Spoof and Bulk dispositions. Note: This will not exempt messages with Malicious or Suspicious dispositions. - `is_exempt_recipient: boolean` Messages to this recipient will bypass all detections. - `is_regex: boolean` - `is_trusted_sender: boolean` Messages from this sender will bypass all detections and link following. - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `verify_sender: boolean` Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors policies that pass authentication. - `comments?: string | null` - `is_recipient?: boolean` - `is_sender?: boolean` - `is_spoof?: boolean` ### Allow Policy Delete Response - `AllowPolicyDeleteResponse` - `id: number` The unique identifier for the allow policy. # Block Senders ## List blocked email senders `client.emailSecurity.settings.blockSenders.list(BlockSenderListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/email-security/settings/block_senders` Lists all blocked sender entries with their patterns and block reasons. ### Parameters - `params: BlockSenderListParams` - `account_id: string` Path param: Account Identifier - `direction?: "asc" | "desc"` Query param: The sorting direction. - `"asc"` - `"desc"` - `order?: "pattern" | "created_at"` Query param: The field to sort by. - `"pattern"` - `"created_at"` - `page?: number` Query param: The page number of paginated results. - `pattern?: string` Query param - `pattern_type?: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` Query param - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `per_page?: number` Query param: The number of results per page. - `search?: 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 - `BlockSenderListResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Example ```node 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 }); // Automatically fetches more pages as needed. for await (const blockSenderListResponse of client.emailSecurity.settings.blockSenders.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(blockSenderListResponse.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" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get a blocked email sender `client.emailSecurity.settings.blockSenders.get(numberpatternId, BlockSenderGetParamsparams, RequestOptionsoptions?): BlockSenderGetResponse` **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: number` The unique identifier for the allow policy. - `params: BlockSenderGetParams` - `account_id: string` Account Identifier ### Returns - `BlockSenderGetResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Example ```node 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 blockSender = await client.emailSecurity.settings.blockSenders.get(2402, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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.create(BlockSenderCreateParamsparams, RequestOptionsoptions?): BlockSenderCreateResponse` **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: BlockSenderCreateParams` - `account_id: string` Path param: Account Identifier - `is_regex: boolean` Body param - `pattern: string` Body param - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` Body param - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` Body param ### Returns - `BlockSenderCreateResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Example ```node 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 blockSender = await client.emailSecurity.settings.blockSenders.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', is_regex: false, pattern: 'test@example.com', pattern_type: 'EMAIL', }); console.log(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(numberpatternId, BlockSenderEditParamsparams, RequestOptionsoptions?): BlockSenderEditResponse` **patch** `/accounts/{account_id}/email-security/settings/block_senders/{pattern_id}` Modifies a blocked sender entry, updating its pattern or block reason. ### Parameters - `patternId: number` The unique identifier for the allow policy. - `params: BlockSenderEditParams` - `account_id: string` Path param: Account Identifier - `comments?: string | null` Body param - `is_regex?: boolean | null` Body param - `pattern?: string | null` Body param - `pattern_type?: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN" | null` Body param - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` ### Returns - `BlockSenderEditResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Example ```node 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 response = await client.emailSecurity.settings.blockSenders.edit(2402, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(numberpatternId, BlockSenderDeleteParamsparams, RequestOptionsoptions?): BlockSenderDeleteResponse` **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: number` The unique identifier for the allow policy. - `params: BlockSenderDeleteParams` - `account_id: string` Account Identifier ### Returns - `BlockSenderDeleteResponse` - `id: number` The unique identifier for the allow policy. ### Example ```node 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 blockSender = await client.emailSecurity.settings.blockSenders.delete(2402, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 } ``` ## Domain Types ### Block Sender List Response - `BlockSenderListResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Block Sender Get Response - `BlockSenderGetResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Block Sender Create Response - `BlockSenderCreateResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Block Sender Edit Response - `BlockSenderEditResponse` - `id: number` The unique identifier for the allow policy. - `created_at: string` - `is_regex: boolean` - `last_modified: string` - `pattern: string` - `pattern_type: "EMAIL" | "DOMAIN" | "IP" | "UNKNOWN"` - `"EMAIL"` - `"DOMAIN"` - `"IP"` - `"UNKNOWN"` - `comments?: string | null` ### Block Sender Delete Response - `BlockSenderDeleteResponse` - `id: number` The unique identifier for the allow policy. # Domains ## List protected email domains `client.emailSecurity.settings.domains.list(DomainListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/email-security/settings/domains` Lists, searches, and sorts an account’s email domains. ### Parameters - `params: DomainListParams` - `account_id: string` Path param: Account Identifier - `active_delivery_mode?: "DIRECT" | "BCC" | "JOURNAL" | 2 more` Query param: Filters response to domains with the currently active delivery mode. - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `allowed_delivery_mode?: "DIRECT" | "BCC" | "JOURNAL" | 2 more` Query param: Filters response to domains with the provided delivery mode. - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `direction?: "asc" | "desc"` Query param: The sorting direction. - `"asc"` - `"desc"` - `domain?: Array` Query param: Filters results by the provided domains, allowing for multiple occurrences. - `integration_id?: string` Query param: Filters response to domains with the provided integration ID. - `order?: "domain" | "created_at"` Query param: The field to sort by. - `"domain"` - `"created_at"` - `page?: number` Query param: The page number of paginated results. - `per_page?: number` Query param: The number of results per page. - `search?: 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 - `DomainListResponse` - `id: number` The unique identifier for the domain. - `allowed_delivery_modes: Array<"DIRECT" | "BCC" | "JOURNAL" | 2 more>` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `created_at: string` - `domain: string` - `drop_dispositions: Array<"MALICIOUS" | "MALICIOUS-BEC" | "SUSPICIOUS" | 7 more>` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `ip_restrictions: Array` - `last_modified: string` - `lookback_hops: number` - `regions: Array<"GLOBAL" | "AU" | "DE" | 2 more>` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `transport: string` - `authorization?: Authorization | null` - `authorized: boolean` - `timestamp: string` - `status_message?: string | null` - `dmarc_status?: "none" | "good" | "invalid" | null` - `"none"` - `"good"` - `"invalid"` - `emails_processed?: EmailsProcessed | null` - `timestamp: string` - `total_emails_processed: number` - `total_emails_processed_previous: number` - `folder?: "AllItems" | "Inbox" | null` - `"AllItems"` - `"Inbox"` - `inbox_provider?: "Microsoft" | "Google" | null` - `"Microsoft"` - `"Google"` - `integration_id?: string | null` - `o365_tenant_id?: string | null` - `require_tls_inbound?: boolean | null` - `require_tls_outbound?: boolean | null` - `spf_status?: "none" | "good" | "neutral" | 2 more | null` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` ### Example ```node 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 }); // Automatically fetches more pages as needed. for await (const domainListResponse of client.emailSecurity.settings.domains.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(domainListResponse.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" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get an email domain `client.emailSecurity.settings.domains.get(numberdomainId, DomainGetParamsparams, RequestOptionsoptions?): DomainGetResponse` **get** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Gets configuration details for a specific domain in email security. ### Parameters - `domainId: number` The unique identifier for the domain. - `params: DomainGetParams` - `account_id: string` Account Identifier ### Returns - `DomainGetResponse` - `id: number` The unique identifier for the domain. - `allowed_delivery_modes: Array<"DIRECT" | "BCC" | "JOURNAL" | 2 more>` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `created_at: string` - `domain: string` - `drop_dispositions: Array<"MALICIOUS" | "MALICIOUS-BEC" | "SUSPICIOUS" | 7 more>` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `ip_restrictions: Array` - `last_modified: string` - `lookback_hops: number` - `regions: Array<"GLOBAL" | "AU" | "DE" | 2 more>` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `transport: string` - `authorization?: Authorization | null` - `authorized: boolean` - `timestamp: string` - `status_message?: string | null` - `dmarc_status?: "none" | "good" | "invalid" | null` - `"none"` - `"good"` - `"invalid"` - `emails_processed?: EmailsProcessed | null` - `timestamp: string` - `total_emails_processed: number` - `total_emails_processed_previous: number` - `folder?: "AllItems" | "Inbox" | null` - `"AllItems"` - `"Inbox"` - `inbox_provider?: "Microsoft" | "Google" | null` - `"Microsoft"` - `"Google"` - `integration_id?: string | null` - `o365_tenant_id?: string | null` - `require_tls_inbound?: boolean | null` - `require_tls_outbound?: boolean | null` - `spf_status?: "none" | "good" | "neutral" | 2 more | null` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` ### Example ```node 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 domain = await client.emailSecurity.settings.domains.get(2400, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(numberdomainId, DomainEditParamsparams, RequestOptionsoptions?): DomainEditResponse` **patch** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Updates configuration for a domain in email security. ### Parameters - `domainId: number` The unique identifier for the domain. - `params: DomainEditParams` - `account_id: string` Path param: Account Identifier - `ip_restrictions: Array` Body param - `allowed_delivery_modes?: Array<"DIRECT" | "BCC" | "JOURNAL" | 2 more>` Body param - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `domain?: string` Body param - `drop_dispositions?: Array<"MALICIOUS" | "MALICIOUS-BEC" | "SUSPICIOUS" | 7 more>` Body param - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `folder?: "AllItems" | "Inbox"` Body param - `"AllItems"` - `"Inbox"` - `integration_id?: string` Body param - `lookback_hops?: number` Body param - `regions?: Array<"GLOBAL" | "AU" | "DE" | 2 more>` Body param - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `require_tls_inbound?: boolean` Body param - `require_tls_outbound?: boolean` Body param - `transport?: string` Body param ### Returns - `DomainEditResponse` - `id: number` The unique identifier for the domain. - `allowed_delivery_modes: Array<"DIRECT" | "BCC" | "JOURNAL" | 2 more>` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `created_at: string` - `domain: string` - `drop_dispositions: Array<"MALICIOUS" | "MALICIOUS-BEC" | "SUSPICIOUS" | 7 more>` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `ip_restrictions: Array` - `last_modified: string` - `lookback_hops: number` - `regions: Array<"GLOBAL" | "AU" | "DE" | 2 more>` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `transport: string` - `authorization?: Authorization | null` - `authorized: boolean` - `timestamp: string` - `status_message?: string | null` - `dmarc_status?: "none" | "good" | "invalid" | null` - `"none"` - `"good"` - `"invalid"` - `emails_processed?: EmailsProcessed | null` - `timestamp: string` - `total_emails_processed: number` - `total_emails_processed_previous: number` - `folder?: "AllItems" | "Inbox" | null` - `"AllItems"` - `"Inbox"` - `inbox_provider?: "Microsoft" | "Google" | null` - `"Microsoft"` - `"Google"` - `integration_id?: string | null` - `o365_tenant_id?: string | null` - `require_tls_inbound?: boolean | null` - `require_tls_outbound?: boolean | null` - `spf_status?: "none" | "good" | "neutral" | 2 more | null` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` ### Example ```node 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 response = await client.emailSecurity.settings.domains.edit(2400, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', ip_restrictions: ['192.0.2.0/24', '2001:db8::/32'], }); console.log(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(numberdomainId, DomainDeleteParamsparams, RequestOptionsoptions?): DomainDeleteResponse` **delete** `/accounts/{account_id}/email-security/settings/domains/{domain_id}` Unprotect an email domain ### Parameters - `domainId: number` The unique identifier for the domain. - `params: DomainDeleteParams` - `account_id: string` Account Identifier ### Returns - `DomainDeleteResponse` - `id: number` The unique identifier for the domain. ### Example ```node 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 domain = await client.emailSecurity.settings.domains.delete(2400, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(DomainBulkDeleteParamsparams, RequestOptionsoptions?): SinglePage` **delete** `/accounts/{account_id}/email-security/settings/domains` Bulk removes multiple domains from email security configuration in a single request. ### Parameters - `params: DomainBulkDeleteParams` - `account_id: string` Account Identifier ### Returns - `DomainBulkDeleteResponse` - `id: number` The unique identifier for the domain. ### Example ```node 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 }); // Automatically fetches more pages as needed. for await (const domainBulkDeleteResponse of client.emailSecurity.settings.domains.bulkDelete({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(domainBulkDeleteResponse.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 } ``` ## Domain Types ### Domain List Response - `DomainListResponse` - `id: number` The unique identifier for the domain. - `allowed_delivery_modes: Array<"DIRECT" | "BCC" | "JOURNAL" | 2 more>` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `created_at: string` - `domain: string` - `drop_dispositions: Array<"MALICIOUS" | "MALICIOUS-BEC" | "SUSPICIOUS" | 7 more>` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `ip_restrictions: Array` - `last_modified: string` - `lookback_hops: number` - `regions: Array<"GLOBAL" | "AU" | "DE" | 2 more>` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `transport: string` - `authorization?: Authorization | null` - `authorized: boolean` - `timestamp: string` - `status_message?: string | null` - `dmarc_status?: "none" | "good" | "invalid" | null` - `"none"` - `"good"` - `"invalid"` - `emails_processed?: EmailsProcessed | null` - `timestamp: string` - `total_emails_processed: number` - `total_emails_processed_previous: number` - `folder?: "AllItems" | "Inbox" | null` - `"AllItems"` - `"Inbox"` - `inbox_provider?: "Microsoft" | "Google" | null` - `"Microsoft"` - `"Google"` - `integration_id?: string | null` - `o365_tenant_id?: string | null` - `require_tls_inbound?: boolean | null` - `require_tls_outbound?: boolean | null` - `spf_status?: "none" | "good" | "neutral" | 2 more | null` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` ### Domain Get Response - `DomainGetResponse` - `id: number` The unique identifier for the domain. - `allowed_delivery_modes: Array<"DIRECT" | "BCC" | "JOURNAL" | 2 more>` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `created_at: string` - `domain: string` - `drop_dispositions: Array<"MALICIOUS" | "MALICIOUS-BEC" | "SUSPICIOUS" | 7 more>` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `ip_restrictions: Array` - `last_modified: string` - `lookback_hops: number` - `regions: Array<"GLOBAL" | "AU" | "DE" | 2 more>` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `transport: string` - `authorization?: Authorization | null` - `authorized: boolean` - `timestamp: string` - `status_message?: string | null` - `dmarc_status?: "none" | "good" | "invalid" | null` - `"none"` - `"good"` - `"invalid"` - `emails_processed?: EmailsProcessed | null` - `timestamp: string` - `total_emails_processed: number` - `total_emails_processed_previous: number` - `folder?: "AllItems" | "Inbox" | null` - `"AllItems"` - `"Inbox"` - `inbox_provider?: "Microsoft" | "Google" | null` - `"Microsoft"` - `"Google"` - `integration_id?: string | null` - `o365_tenant_id?: string | null` - `require_tls_inbound?: boolean | null` - `require_tls_outbound?: boolean | null` - `spf_status?: "none" | "good" | "neutral" | 2 more | null` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` ### Domain Edit Response - `DomainEditResponse` - `id: number` The unique identifier for the domain. - `allowed_delivery_modes: Array<"DIRECT" | "BCC" | "JOURNAL" | 2 more>` - `"DIRECT"` - `"BCC"` - `"JOURNAL"` - `"API"` - `"RETRO_SCAN"` - `created_at: string` - `domain: string` - `drop_dispositions: Array<"MALICIOUS" | "MALICIOUS-BEC" | "SUSPICIOUS" | 7 more>` - `"MALICIOUS"` - `"MALICIOUS-BEC"` - `"SUSPICIOUS"` - `"SPOOF"` - `"SPAM"` - `"BULK"` - `"ENCRYPTED"` - `"EXTERNAL"` - `"UNKNOWN"` - `"NONE"` - `ip_restrictions: Array` - `last_modified: string` - `lookback_hops: number` - `regions: Array<"GLOBAL" | "AU" | "DE" | 2 more>` - `"GLOBAL"` - `"AU"` - `"DE"` - `"IN"` - `"US"` - `transport: string` - `authorization?: Authorization | null` - `authorized: boolean` - `timestamp: string` - `status_message?: string | null` - `dmarc_status?: "none" | "good" | "invalid" | null` - `"none"` - `"good"` - `"invalid"` - `emails_processed?: EmailsProcessed | null` - `timestamp: string` - `total_emails_processed: number` - `total_emails_processed_previous: number` - `folder?: "AllItems" | "Inbox" | null` - `"AllItems"` - `"Inbox"` - `inbox_provider?: "Microsoft" | "Google" | null` - `"Microsoft"` - `"Google"` - `integration_id?: string | null` - `o365_tenant_id?: string | null` - `require_tls_inbound?: boolean | null` - `require_tls_outbound?: boolean | null` - `spf_status?: "none" | "good" | "neutral" | 2 more | null` - `"none"` - `"good"` - `"neutral"` - `"open"` - `"invalid"` ### Domain Delete Response - `DomainDeleteResponse` - `id: number` The unique identifier for the domain. ### Domain Bulk Delete Response - `DomainBulkDeleteResponse` - `id: number` The unique identifier for the domain. # Impersonation Registry ## List entries in impersonation registry `client.emailSecurity.settings.impersonationRegistry.list(ImpersonationRegistryListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/email-security/settings/impersonation_registry` Lists, searches, and sorts entries in the impersonation registry. ### Parameters - `params: ImpersonationRegistryListParams` - `account_id: string` Path param: Account Identifier - `direction?: "asc" | "desc"` Query param: The sorting direction. - `"asc"` - `"desc"` - `order?: "name" | "email" | "created_at"` Query param: The field to sort by. - `"name"` - `"email"` - `"created_at"` - `page?: number` Query param: The page number of paginated results. - `per_page?: number` Query param: The number of results per page. - `provenance?: "A1S_INTERNAL" | "SNOOPY-CASB_OFFICE_365" | "SNOOPY-OFFICE_365" | "SNOOPY-GOOGLE_DIRECTORY"` Query param - `"A1S_INTERNAL"` - `"SNOOPY-CASB_OFFICE_365"` - `"SNOOPY-OFFICE_365"` - `"SNOOPY-GOOGLE_DIRECTORY"` - `search?: 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 - `ImpersonationRegistryListResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Example ```node 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 }); // Automatically fetches more pages as needed. for await (const impersonationRegistryListResponse of client.emailSecurity.settings.impersonationRegistry.list( { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(impersonationRegistryListResponse.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" } ], "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(numberdisplayNameId, ImpersonationRegistryGetParamsparams, RequestOptionsoptions?): ImpersonationRegistryGetResponse` **get** `/accounts/{account_id}/email-security/settings/impersonation_registry/{display_name_id}` Retrieves a display name entry used for impersonation protection. ### Parameters - `displayNameId: number` - `params: ImpersonationRegistryGetParams` - `account_id: string` Account Identifier ### Returns - `ImpersonationRegistryGetResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Example ```node 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 impersonationRegistry = await client.emailSecurity.settings.impersonationRegistry.get(2403, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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.create(ImpersonationRegistryCreateParamsparams, RequestOptionsoptions?): ImpersonationRegistryCreateResponse` **post** `/accounts/{account_id}/email-security/settings/impersonation_registry` Creates a display name entry for email security impersonation protection. ### Parameters - `params: ImpersonationRegistryCreateParams` - `account_id: string` Path param: Account Identifier - `email: string` Body param - `is_email_regex: boolean` Body param - `name: string` Body param ### Returns - `ImpersonationRegistryCreateResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Example ```node 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 impersonationRegistry = await client.emailSecurity.settings.impersonationRegistry.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', email: 'email', is_email_regex: true, name: 'name', }); console.log(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(numberdisplayNameId, ImpersonationRegistryEditParamsparams, RequestOptionsoptions?): ImpersonationRegistryEditResponse` **patch** `/accounts/{account_id}/email-security/settings/impersonation_registry/{display_name_id}` Updates a display name entry used for impersonation protection. ### Parameters - `displayNameId: number` - `params: ImpersonationRegistryEditParams` - `account_id: string` Path param: Account Identifier - `email?: string | null` Body param - `is_email_regex?: boolean | null` Body param - `name?: string | null` Body param ### Returns - `ImpersonationRegistryEditResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Example ```node 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 response = await client.emailSecurity.settings.impersonationRegistry.edit(2403, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(numberdisplayNameId, ImpersonationRegistryDeleteParamsparams, RequestOptionsoptions?): ImpersonationRegistryDeleteResponse` **delete** `/accounts/{account_id}/email-security/settings/impersonation_registry/{display_name_id}` Removes a display name from impersonation protection monitoring. ### Parameters - `displayNameId: number` - `params: ImpersonationRegistryDeleteParams` - `account_id: string` Account Identifier ### Returns - `ImpersonationRegistryDeleteResponse` - `id: number` ### Example ```node 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 impersonationRegistry = await client.emailSecurity.settings.impersonationRegistry.delete( 2403, { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(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 } ``` ## Domain Types ### Impersonation Registry List Response - `ImpersonationRegistryListResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Impersonation Registry Get Response - `ImpersonationRegistryGetResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Impersonation Registry Create Response - `ImpersonationRegistryCreateResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Impersonation Registry Edit Response - `ImpersonationRegistryEditResponse` - `id: number` - `created_at: string` - `email: string` - `is_email_regex: boolean` - `last_modified: string` - `name: string` - `comments?: string | null` - `directory_id?: number | null` - `directory_node_id?: number | null` - `external_directory_node_id?: string | null` - `provenance?: string | null` ### Impersonation Registry Delete Response - `ImpersonationRegistryDeleteResponse` - `id: number` # Trusted Domains ## List trusted email domains `client.emailSecurity.settings.trustedDomains.list(TrustedDomainListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/email-security/settings/trusted_domains` Lists, searches, and sorts an account’s trusted email domains. ### Parameters - `params: TrustedDomainListParams` - `account_id: string` Path param: Account Identifier - `direction?: "asc" | "desc"` Query param: The sorting direction. - `"asc"` - `"desc"` - `is_recent?: boolean` Query param - `is_similarity?: boolean` Query param - `order?: "pattern" | "created_at"` Query param: The field to sort by. - `"pattern"` - `"created_at"` - `page?: number` Query param: The page number of paginated results. - `pattern?: string` Query param - `per_page?: number` Query param: The number of results per page. - `search?: 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 - `TrustedDomainListResponse` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Example ```node 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 }); // Automatically fetches more pages as needed. for await (const trustedDomainListResponse of client.emailSecurity.settings.trustedDomains.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(trustedDomainListResponse.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" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 }, "success": true } ``` ## Get a trusted email domain `client.emailSecurity.settings.trustedDomains.get(numbertrustedDomainId, TrustedDomainGetParamsparams, RequestOptionsoptions?): TrustedDomainGetResponse` **get** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Gets information about a specific trusted domain entry. ### Parameters - `trustedDomainId: number` The unique identifier for the trusted domain. - `params: TrustedDomainGetParams` - `account_id: string` Account Identifier ### Returns - `TrustedDomainGetResponse` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Example ```node 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.get(2401, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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.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. ### Parameters - `TrustedDomainCreateParams = EmailSecurityCreateTrustedDomain | Variant1` - `TrustedDomainCreateParamsBase` - `EmailSecurityCreateTrustedDomain extends TrustedDomainCreateParamsBase` - `Variant1 extends TrustedDomainCreateParamsBase` ### Returns - `TrustedDomainCreateResponse = EmailSecurityTrustedDomain | Array` - `EmailSecurityTrustedDomain` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` - `Array` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Example ```node 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); ``` #### 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(numbertrustedDomainId, TrustedDomainEditParamsparams, RequestOptionsoptions?): TrustedDomainEditResponse` **patch** `/accounts/{account_id}/email-security/settings/trusted_domains/{trusted_domain_id}` Modifies a trusted domain entry's configuration. ### Parameters - `trustedDomainId: number` The unique identifier for the trusted domain. - `params: TrustedDomainEditParams` - `account_id: string` Path param: Account Identifier - `comments?: string` Body param - `is_recent?: boolean` Body param: Select to prevent recently registered domains from triggering a Suspicious or Malicious disposition. - `is_regex?: boolean` Body param - `is_similarity?: boolean` 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?: string` Body param ### Returns - `TrustedDomainEditResponse` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Example ```node 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 response = await client.emailSecurity.settings.trustedDomains.edit(2401, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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(numbertrustedDomainId, TrustedDomainDeleteParamsparams, RequestOptionsoptions?): TrustedDomainDeleteResponse` **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: number` The unique identifier for the trusted domain. - `params: TrustedDomainDeleteParams` - `account_id: string` Account Identifier ### Returns - `TrustedDomainDeleteResponse` - `id: number` The unique identifier for the trusted domain. ### Example ```node 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.delete(2401, { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(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 } ``` ## Domain Types ### Trusted Domain List Response - `TrustedDomainListResponse` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Trusted Domain Get Response - `TrustedDomainGetResponse` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Trusted Domain Create Response - `TrustedDomainCreateResponse = EmailSecurityTrustedDomain | Array` - `EmailSecurityTrustedDomain` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` - `Array` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Trusted Domain Edit Response - `TrustedDomainEditResponse` - `id: number` The unique identifier for the trusted domain. - `created_at: string` - `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` - `pattern: string` - `comments?: string | null` ### Trusted Domain Delete Response - `TrustedDomainDeleteResponse` - `id: number` The unique identifier for the trusted domain.