Skip to content
Start here

Create impersonation registry entry

client.EmailSecurity.Settings.ImpersonationRegistry.New(ctx, params) (*SettingImpersonationRegistryNewResponse, error)
POST/accounts/{account_id}/email-security/settings/impersonation_registry

Creates a new entry in the impersonation registry to protect against impersonation. Emails attempting to impersonate this identity will be flagged. Supports regex patterns for flexible email matching.

Security
API Token

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

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

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

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

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

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Cloud Email Security: Write
ParametersExpand Collapse
params SettingImpersonationRegistryNewParams
AccountID param.Field[string]

Path param: Identifier.

maxLength32
Email param.Field[string]

Body param

IsEmailRegex param.Field[bool]

Body param

Name param.Field[string]

Body param

maxLength1024
Comments param.Field[string]Optional

Body param

DirectoryID param.Field[int64]Optional

Body param

DirectoryNodeID param.Field[int64]Optional

Body param

DeprecatedExternalDirectoryNodeID param.Field[string]Optional

Body param

Provenance param.Field[SettingImpersonationRegistryNewParamsProvenance]Optional

Body param

const SettingImpersonationRegistryNewParamsProvenanceA1SInternal SettingImpersonationRegistryNewParamsProvenance = "A1S_INTERNAL"
const SettingImpersonationRegistryNewParamsProvenanceSnoopyCasbOffice365 SettingImpersonationRegistryNewParamsProvenance = "SNOOPY-CASB_OFFICE_365"
const SettingImpersonationRegistryNewParamsProvenanceSnoopyOffice365 SettingImpersonationRegistryNewParamsProvenance = "SNOOPY-OFFICE_365"
const SettingImpersonationRegistryNewParamsProvenanceSnoopyGoogleDirectory SettingImpersonationRegistryNewParamsProvenance = "SNOOPY-GOOGLE_DIRECTORY"
ReturnsExpand Collapse
type SettingImpersonationRegistryNewResponse struct{…}

An impersonation registry entry

ID stringOptional

Impersonation registry entry identifier

formatuuid
Comments stringOptional
CreatedAt TimeOptional
formatdate-time
DirectoryID int64Optional
DirectoryNodeID int64Optional
Email stringOptional
DeprecatedExternalDirectoryNodeID stringOptional
IsEmailRegex boolOptional
DeprecatedLastModified TimeOptional

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

formatdate-time
ModifiedAt TimeOptional
formatdate-time
Name stringOptional
maxLength1024
Provenance SettingImpersonationRegistryNewResponseProvenanceOptional
One of the following:
const SettingImpersonationRegistryNewResponseProvenanceA1SInternal SettingImpersonationRegistryNewResponseProvenance = "A1S_INTERNAL"
const SettingImpersonationRegistryNewResponseProvenanceSnoopyCasbOffice365 SettingImpersonationRegistryNewResponseProvenance = "SNOOPY-CASB_OFFICE_365"
const SettingImpersonationRegistryNewResponseProvenanceSnoopyOffice365 SettingImpersonationRegistryNewResponseProvenance = "SNOOPY-OFFICE_365"
const SettingImpersonationRegistryNewResponseProvenanceSnoopyGoogleDirectory SettingImpersonationRegistryNewResponseProvenance = "SNOOPY-GOOGLE_DIRECTORY"

Create impersonation registry entry

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  impersonationRegistry, err := client.EmailSecurity.Settings.ImpersonationRegistry.New(context.TODO(), email_security.SettingImpersonationRegistryNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
    Email: cloudflare.F("john.doe@example.com"),
    IsEmailRegex: cloudflare.F(false),
    Name: cloudflare.F("John Doe"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", impersonationRegistry.ID)
}
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
    "comments": "comments",
    "created_at": "2014-01-01T05:20:00.12345Z",
    "directory_id": 0,
    "directory_node_id": 0,
    "email": "john.doe@example.com",
    "external_directory_node_id": "external_directory_node_id",
    "is_email_regex": false,
    "last_modified": "2014-01-01T05:20:00.12345Z",
    "modified_at": "2014-01-01T05:20:00.12345Z",
    "name": "John Doe",
    "provenance": "A1S_INTERNAL"
  }
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "id": "f174e90a-fafe-4643-bbbc-4a0ed4fc8415",
    "comments": "comments",
    "created_at": "2014-01-01T05:20:00.12345Z",
    "directory_id": 0,
    "directory_node_id": 0,
    "email": "john.doe@example.com",
    "external_directory_node_id": "external_directory_node_id",
    "is_email_regex": false,
    "last_modified": "2014-01-01T05:20:00.12345Z",
    "modified_at": "2014-01-01T05:20:00.12345Z",
    "name": "John Doe",
    "provenance": "A1S_INTERNAL"
  }
}