---
title: Update outreach policy rules
description: Upsert the outreach automation state of detection rules.
breadcrumbs: Docs > API > Update outreach policy rules
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Update outreach policy rules

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in preview and is subject to change.
To request access, contact [Datadog support](https://docs.datadoghq.com/help.md) or your Customer Success Manager.
{% /alert %}

| Datadog site      | API endpoint                                                                                       |
| ----------------- | -------------------------------------------------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/security_monitoring/security_agent/outreach_policy/rules     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/security_monitoring/security_agent/outreach_policy/rules |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/security_monitoring/security_agent/outreach_policy/rules |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/security_monitoring/security_agent/outreach_policy/rules      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/security_monitoring/security_agent/outreach_policy/rules |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/security_monitoring/security_agent/outreach_policy/rules |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/security_monitoring/security_agent/outreach_policy/rules |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/security_monitoring/security_agent/outreach_policy/rules      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/security_monitoring/security_agent/outreach_policy/rules  |

### Overview

Upsert the outreach automation state of detection rules. Each rule in the request gets the given state;
rules not in the request keep their state. A rule with `is_enabled: true` auto-sends automated interviews
in `automated` mode.

This endpoint requires the `bits_security_analyst_config_write` permission.

OAuth apps require the `bits_security_analyst_config_write` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#bits-security-analyst) to access this endpoint.

### Request

#### Body Data (required)

The rules to upsert.

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                   | Type     | Description                                                                                                                                    |
| ------------ | ----------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object   | The rules to upsert.                                                                                                                           |
| data         | attributes [*required*] | object   | Attributes of an outreach policy rules update request.                                                                                         |
| attributes   | rules [*required*]      | [object] | The rules to upsert, at least one.                                                                                                             |
| rules        | is_enabled [*required*] | boolean  | Whether the rule auto-sends automated interviews in `automated` mode. Required.                                                                |
| rules        | rule_id [*required*]    | string   | ID of the detection rule. Must be non-empty.                                                                                                   |
| data         | type [*required*]       | enum     | Type of an outreach policy rules update request. Allowed enum values: `outreach_policy_rules_update`. Default: `outreach_policy_rules_update`. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "rules": [
        {
          "is_enabled": true,
          "rule_id": "abc-def-ghi"
        }
      ]
    },
    "type": "outreach_policy_rules_update"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response with the organization's outreach policy.

| Parent field | Field                   | Type     | Description                                                                                                                                                                                                                                                                               |
| ------------ | ----------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object   | The organization's outreach policy.                                                                                                                                                                                                                                                       |
| data         | attributes [*required*] | object   | Attributes of the organization's outreach policy.                                                                                                                                                                                                                                         |
| attributes   | allowed_domains         | [string] | Email domains user outreach can be sent to, at most 20. `null` when none are allowed.                                                                                                                                                                                                     |
| attributes   | mode [*required*]       | enum     | The organization's outreach mode. `off` disables user outreach. `manual` only sends outreach an analyst triggers. `automated` auto-sends automated interviews for rules with outreach enabled, to users whose email domain is allowed. Allowed enum values: `off`, `manual`, `automated`. |
| attributes   | rules                   | [object] | The stored per-rule automation state, including rules that are explicitly disabled. `null` when the organization has no stored rule state.                                                                                                                                                |
| rules        | is_enabled [*required*] | boolean  | Whether the rule auto-sends automated interviews in `automated` mode.                                                                                                                                                                                                                     |
| rules        | rule_id [*required*]    | string   | ID of the detection rule.                                                                                                                                                                                                                                                                 |
| attributes   | suggested_domains       | [string] | Domains the caller could allow next: their own email domain when it is not allowed yet and is not a consumer mailbox provider. Read-only, never stored. `null` when there is no suggestion.                                                                                               |
| data         | id [*required*]         | string   | The organization ID.                                                                                                                                                                                                                                                                      |
| data         | type [*required*]       | enum     | Type of the outreach policy resource. Allowed enum values: `outreach_policy`. Default: `outreach_policy`.                                                                                                                                                                                 |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "allowed_domains": [
        "example.com"
      ],
      "mode": "automated",
      "rules": [
        {
          "is_enabled": true,
          "rule_id": "abc-def-ghi"
        }
      ],
      "suggested_domains": [
        "acme.com"
      ]
    },
    "id": "1234567",
    "type": "outreach_policy"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="409" %}
Conflict

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/security_monitoring/security_agent/outreach_policy/rules" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "rules": [
        {
          "is_enabled": true,
          "rule_id": "abc-def-ghi"
        },
        {
          "is_enabled": false,
          "rule_id": "jkl-mno-pqr"
        }
      ]
    },
    "type": "outreach_policy_rules_update"
  }
}
EOF
```
{% /tab %}
{% /tabs %}
