Security settings configure data redaction and data retention. For example,
these settings control how data is redacted in [Cloud logging](https://docs.cloud.google.com/dialogflow/cx/docs/concept/logging.md.txt)
and the [Conversation history](https://docs.cloud.google.com/dialogflow/cx/docs/concept/conversation-history.md.txt).

Security settings are set at the project level. If you have
[access](https://docs.cloud.google.com/dialogflow/cx/docs/concept/access-control.md.txt#df-console) to an agent in a
project, you can view project-level security settings. To update project-level
security settings, you must have the
[`dialogflow.securitySettings.update` permission](https://docs.cloud.google.com/iam/docs/roles-permissions/dialogflow.md.txt#dialogflow.admin).
Dialogflow can take up to one hour to implement security settings
updates.

> [!NOTE]
> **Note:** For more information about other redaction options, see [parameter redaction](https://docs.cloud.google.com/dialogflow/cx/docs/concept/parameter.md.txt#redact).

The following table summarizes the settings. For more information about the
settings, see the [SecuritySettings RPC reference](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3.md.txt#google.cloud.dialogflow.cx.v3.SecuritySettings).

| Security Setting | Description |
|---|---|
| `redaction_strategy` | `RedactionStrategy`: Defines how we do redaction. |
| `redaction_scope` | `RedactionScope`: Defines the data for which Dialogflow applies redaction. Dialogflow does not redact data that it does not have access to -- for example, Cloud logging. |
| `inspect_template` | `string` [Sensitive Data Protection](https://cloud.google.com/dlp/docs): The inspect template name. Use this template to define inspect base settings. The `The DLP Inspect Templates Reader` role is needed on the Dialogflow service identity service account for your agent's project. If empty, we use the default Sensitive Data Protection inspect config. The template name will have one of the following formats: `projects//locations//inspectTemplates/` OR `organizations//locations//inspectTemplates/` Note: `inspect_template` must be located in the same region as the `SecuritySettings`. |
| `deidentify_template` | `string` [Sensitive Data Protection](https://cloud.google.com/dlp/docs): The deidentify template name. Use this template to define deidentification configuration for the content. The `DLP Deidentify Templates Reader` role is needed on the Dialogflow service identity service account for your agent's project. If empty, Dialogflow replaces sensitive info with `[redacted]` text. The template name will have one of the following formats: `projects//locations//deidentifyTemplates/` OR `organizations//locations//deidentifyTemplates/` Note: `deidentify_template` must be located in the same region as the `SecuritySettings`. |
| `purge_data_types[]` | `PurgeDataType`: A list of types of data to be removed when retention settings triggers purge. |
| `audio_export_settings` | `AudioExportSettings`: Controls audio export settings for sessions and conversations (including `DetectIntent`, `StreamingDetectIntent`, `AnalyzeContent`, `StreamingAnalyzeContent`, and `BidiStreamingAnalyzeContent`). If `audio_export_settings.gcs_bucket` is configured, audio is recorded and saved to the configured bucket, subject to the lifecycle and retention policy of the bucket. If `audio_export_settings.gcs_bucket` is empty, audio export is disabled. For more information, see [Audio export](https://docs.cloud.google.com/dialogflow/cx/docs/concept/audio-export.md.txt). |
| `insights_export_settings` | `InsightsExportSettings`: Controls conversation exporting settings to Insights after conversation is completed. If `retention_strategy` is set to `REMOVE_AFTER_CONVERSATION`, Insights export is disabled no matter what you configure here. |
| `data_retention` | The union field that specifies how data is retained. Even if data is purged because of a retention policy, it might remain in backup storage for a few days without allowing direct access. `data_retention` can be only one of the following: --- `retention_window_days` (`int32`): Retains data for the specified number of days. You must set a value lower than Dialogflow's default 365-day TTL (30 days for Agent Assist traffic); higher values are ignored and the default is used. Setting a value higher than the default is ignored. A missing value or a setting of `0` also uses the default TTL. When data retention configuration is changed, it only applies to data created after the change; the TTL of existing data created before the change remains intact. --- `retention_strategy`: Specifies the retention behavior defined by `SecuritySettings.RetentionStrategy`. |

You can configure multiple security settings in each
[location](https://docs.cloud.google.com/dialogflow/cx/docs/concept/region.md.txt). Each agent specifies the
security settings to apply, and you can apply each setting to multiple agents
in the same project and location. For more information about data application
levels, see [data application levels](https://docs.cloud.google.com/dialogflow/cx/docs/concept/data-level.md.txt).

If you don't specify security settings in an agent, Dialogflow doesn't
apply redaction.

## Create a security settings resource

To create a security settings resource in a particular location:

### Console

1. Go to the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).
2. Select your Google Cloud project.
3. Select your agent.
4. Click **Agent Settings**.
5. Click the **Security** tab.
6. Click **Manage security settings**. The CCAI console opens in a new tab.
7. Click **Create security settings** in the CCAI console.
8. Enter security settings configuration.
9. Click **Create**.

### API

For information about the `create` method, see the `SecuritySettings` type.


<button class="devsite-dialog-button cloud-button cloud-button--primary" style="display: block; padding: 10px; margin-top: 10px; margin-bottom: 10px;" data-modal-dialog-id="cx-agent-reference-dialog-SecuritySettings">Go to the SecuritySettings API reference</button>
**Select a protocol and version for the SecuritySettings reference:**

| Protocol | V3 | V3beta1 |
|---|---|---|
| REST | [SecuritySettings resource](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.securitySettings.md.txt) | [SecuritySettings resource](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.securitySettings.md.txt) |
| RPC | [SecuritySettings interface](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3.md.txt#google.cloud.dialogflow.cx.v3.SecuritySettings) | [SecuritySettings interface](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3beta1.md.txt#google.cloud.dialogflow.cx.v3beta1.SecuritySettings) |
| C++ | [SecuritySettingssClient](https://googleapis.dev/cpp/google-cloud-dialogflow_cx/latest/classgoogle_1_1cloud_1_1dialogflow__cx_1_1SecuritySettingsServiceClient.html) | Not available |
| C# | [SecuritySettingssClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.Cx.V3/latest/Google.Cloud.Dialogflow.Cx.V3.SecuritySettingsClient) | Not available |
| Go | [SecuritySettingssClient](https://docs.cloud.google.com/go/docs/reference/cloud.google.com/go/dialogflow/latest/cx/apiv3.md.txt#cloud_google_com_go_dialogflow_cx_apiv3_SecuritySettingsClient) | Not available |
| Java | [SecuritySettingssClient](https://docs.cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClient.md.txt) | [SecuritySettingssClient](https://docs.cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3beta1.SecuritySettingsServiceClient.md.txt) |
| Node.js | [SecuritySettingssClient](https://googleapis.dev/nodejs/dialogflow-cx/latest/v3.SecuritySettingsServiceClient.html) | [SecuritySettingssClient](https://googleapis.dev/nodejs/dialogflow-cx/latest/v3beta1.SecuritySettingsServiceClient.html) |
| PHP | Not available | Not available |
| Python | [SecuritySettingssClient](https://docs.cloud.google.com/python/docs/reference/dialogflow-cx/latest/google.cloud.dialogflowcx_v3.services.security_settings_service.SecuritySettingsServiceClient.md.txt) | [SecuritySettingssClient](https://docs.cloud.google.com/python/docs/reference/dialogflow-cx/latest/google.cloud.dialogflowcx_v3beta1.services.security_settings_service.SecuritySettingsServiceClient.md.txt) |
| Ruby | Not available | Not available |

<button class="devsite-dialog-close">Close</button>

<br />

## Specify a security setting in agent

To specify a security setting in agent:

### Console

1. Go to the [Dialogflow CX console](https://dialogflow.cloud.google.com/cx/projects).
2. Select your Google Cloud project.
3. Select your agent.
4. Click **Agent Settings**.
5. Click the **Security** tab.
6. Select settings in the **Security settings** drop-down menu.
7. Click **Save**.

### API

For information about the `patch` and `update` methods, see the `Agent` type.


<button class="devsite-dialog-button cloud-button cloud-button--primary" style="display: block; padding: 10px; margin-top: 10px; margin-bottom: 10px;" data-modal-dialog-id="cx-agent-reference-dialog-Agent">Go to the Agent API reference</button>
**Select a protocol and version for the Agent reference:**

| Protocol | V3 | V3beta1 |
|---|---|---|
| REST | [Agent resource](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.md.txt) | [Agent resource](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rest/v3beta1/projects.locations.agents.md.txt) |
| RPC | [Agent interface](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3.md.txt#google.cloud.dialogflow.cx.v3.Agents) | [Agent interface](https://docs.cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3beta1.md.txt#google.cloud.dialogflow.cx.v3beta1.Agents) |
| C++ | [AgentsClient](https://googleapis.dev/cpp/google-cloud-dialogflow_cx/latest/classgoogle_1_1cloud_1_1dialogflow__cx_1_1AgentsClient.html) | Not available |
| C# | [AgentsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Dialogflow.Cx.V3/latest/Google.Cloud.Dialogflow.Cx.V3.AgentsClient.md.txt) | Not available |
| Go | [AgentsClient](https://docs.cloud.google.com/go/docs/reference/cloud.google.com/go/dialogflow/latest/cx/apiv3.md.txt#cloud_google_com_go_dialogflow_cx_apiv3_AgentsClient) | Not available |
| Java | [AgentsClient](https://docs.cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.AgentsClient.md.txt) | [AgentsClient](https://docs.cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3beta1.AgentsClient.md.txt) |
| Node.js | [AgentsClient](https://googleapis.dev/nodejs/dialogflow-cx/latest/v3.AgentsClient.html) | [AgentsClient](https://googleapis.dev/nodejs/dialogflow-cx/latest/v3beta1.AgentsClient.html) |
| PHP | Not available | Not available |
| Python | [AgentsClient](https://docs.cloud.google.com/python/docs/reference/dialogflow-cx/latest/google.cloud.dialogflowcx_v3.services.agents.AgentsClient.md.txt) | [AgentsClient](https://docs.cloud.google.com/python/docs/reference/dialogflow-cx/latest/google.cloud.dialogflowcx_v3beta1.services.agents.AgentsClient.md.txt) |
| Ruby | Not available | Not available |

<button class="devsite-dialog-close">Close</button>

<br />

> [!CAUTION]
> **Caution:** If the Sensitive Data Protection inspect template is not defined, a default template is used. The default template only has some of the [infoType detectors](https://docs.cloud.google.com/sensitive-data-protection/docs/concepts-infotypes.md.txt) enabled and might be unreliable for identifying and removing types according to end-user requirements. Always [create](https://console.cloud.google.com/security/dlp/create/template) a Sensitive Data Protection template whenever possible.