Skip to content
Start here

Update email scanner rule

PUT/accounts/{account_id}/dlp/email/rules/{rule_id}

Update email scanner rule

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
Path ParametersExpand Collapse
account_id: string
rule_id: string
formatuuid
Body ParametersJSONExpand Collapse
action: { action, message }
action: "Block"
message: optional string
conditions: array of { operator, selector, value }

Triggered if all conditions match.

operator: "InList" or "NotInList" or "MatchRegex" or "NotMatchRegex"
One of the following:
"InList"
"NotInList"
"MatchRegex"
"NotMatchRegex"
selector: "Recipients" or "Sender" or "DLPProfiles"
One of the following:
"Recipients"
"Sender"
"DLPProfiles"
value: array of string or string
One of the following:
array of string
string
enabled: boolean
name: string
description: optional string
ReturnsExpand Collapse
errors: array of { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional { pointer }
pointer: optional string
messages: array of { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional { pointer }
pointer: optional string
success: true

Whether the API call was successful.

result: optional { action, conditions, created_at, 6 more }
action: { action, message }
action: "Block"
message: optional string
conditions: array of { operator, selector, value }

Triggered if all conditions match.

operator: "InList" or "NotInList" or "MatchRegex" or "NotMatchRegex"
One of the following:
"InList"
"NotInList"
"MatchRegex"
"NotMatchRegex"
selector: "Recipients" or "Sender" or "DLPProfiles"
One of the following:
"Recipients"
"Sender"
"DLPProfiles"
value: array of string or string
One of the following:
array of string
string
created_at: string
formatdate-time
enabled: boolean
name: string
priority: number
formatint32
minimum0
rule_id: string
formatuuid
updated_at: string
formatdate-time
description: optional string

Update email scanner rule

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/dlp/email/rules/$RULE_ID \
    -X PUT \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "action": {
            "action": "Block"
          },
          "conditions": [
            {
              "operator": "InList",
              "selector": "Recipients",
              "value": [
                "string"
              ]
            }
          ],
          "enabled": true,
          "name": "name"
        }'
{
  "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": {
    "action": {
      "action": "Block",
      "message": "message"
    },
    "conditions": [
      {
        "operator": "InList",
        "selector": "Recipients",
        "value": [
          "string"
        ]
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "enabled": true,
    "name": "name",
    "priority": 0,
    "rule_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "updated_at": "2019-12-27T18:11:19.117Z",
    "description": "description"
  }
}
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": {
    "action": {
      "action": "Block",
      "message": "message"
    },
    "conditions": [
      {
        "operator": "InList",
        "selector": "Recipients",
        "value": [
          "string"
        ]
      }
    ],
    "created_at": "2019-12-27T18:11:19.117Z",
    "enabled": true,
    "name": "name",
    "priority": 0,
    "rule_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    "updated_at": "2019-12-27T18:11:19.117Z",
    "description": "description"
  }
}