Skip to content
Start here

Create mapping

client.ZeroTrust.DLP.Email.AccountMapping.New(ctx, params) (*DLPEmailAccountMappingNewResponse, error)
POST/accounts/{account_id}/dlp/email/account_mapping

Creates a mapping between a Cloudflare account and an email provider for DLP email scanning integration.

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)
Zero Trust Write
ParametersExpand Collapse
params DLPEmailAccountMappingNewParams
AccountID param.Field[string]

Path param

Body param

type DLPEmailAccountMappingNewParamsAuthRequirementsObject struct{…}
AllowedMicrosoftOrganizations []string
Type DLPEmailAccountMappingNewParamsAuthRequirementsObjectType
type DLPEmailAccountMappingNewParamsAuthRequirementsType struct{…}
Type DLPEmailAccountMappingNewParamsAuthRequirementsTypeType
ReturnsExpand Collapse
type DLPEmailAccountMappingNewResponse struct{…}
AddinIdentifierToken string
formatuuid
AuthRequirements DLPEmailAccountMappingNewResponseAuthRequirements
One of the following:
type DLPEmailAccountMappingNewResponseAuthRequirementsObject struct{…}
AllowedMicrosoftOrganizations []string
Type DLPEmailAccountMappingNewResponseAuthRequirementsObjectType
type DLPEmailAccountMappingNewResponseAuthRequirementsType struct{…}
Type DLPEmailAccountMappingNewResponseAuthRequirementsTypeType

Create mapping

package main

import (
  "context"
  "fmt"

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

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  accountMapping, err := client.ZeroTrust.DLP.Email.AccountMapping.New(context.TODO(), zero_trust.DLPEmailAccountMappingNewParams{
    AccountID: cloudflare.F("account_id"),
    AuthRequirements: cloudflare.F[zero_trust.DLPEmailAccountMappingNewParamsAuthRequirementsUnion](zero_trust.DLPEmailAccountMappingNewParamsAuthRequirementsObject{
      AllowedMicrosoftOrganizations: cloudflare.F([]string{"string"}),
      Type: cloudflare.F(zero_trust.DLPEmailAccountMappingNewParamsAuthRequirementsObjectTypeOrg),
    }),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", accountMapping.AddinIdentifierToken)
}
{
  "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": {
    "addin_identifier_token": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "auth_requirements": {
      "allowed_microsoft_organizations": [
        "string"
      ],
      "type": "Org"
    }
  }
}
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": {
    "addin_identifier_token": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "auth_requirements": {
      "allowed_microsoft_organizations": [
        "string"
      ],
      "type": "Org"
    }
  }
}