---
title: "The CLI purge interactions command"
slug: "the-cli-purge-interactions-command"
abstract: "Describes the xConnect DevEx CLI purge interactions command that registers purge tasks."
---
# The CLI purge interactions command

The [xConnect DevEx CLI plugin](https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-platform/xconnect-devex-cli-plugin.html "xConnect DevEx CLI plugin") includes a `purge` command with an `interactions` subcommand. This command initiates a purge process based on the provided `StartedDaysCutoff` and conditions.

<details>
<summary><h2>Usage</h2></summary>

You can use the command as follows:

```text
sitecore xconnect purge interactions [subcommand] [options]

```

</details>

<details>
<summary><h2>Subcommands</h2></summary>

You can use the following subcommand:

| Subcommand | Description |
| --- | --- |
| `start` | Register a purge interactions task. |

</details>

<details>
<summary><h2>Options</h2></summary>

You can use the following options with the command:

> [!important]
> Combined options act as an `AND` condition. This means all the options sent to the CLI filters the data to purge.

| Option | Required? | Description |
| --- | --- | --- |
| `-c, --config` | Yes | The path to the `sitecore.json` configuration file (default: cwd). A DevEx CLI standard option. |
| `-n, --environment-name` | Yes | The Sitecore environment to use. Default: `default`. A DevEx CLI standard option. |
| `-d, --started-days-cutoff` | Yes | The `started-days-cutoff` option specifies the number of days since the interaction started. This option filters interactions based on its `StartDateTime` value. The `StartDateTime` value reflects the interaction's starting `DateTime`. For example, `-d  190`.<br><br>> [!note]<br>> This option is the only requirement with no default value.<br><br>There is a list of restrictions for the `started-days-cutoff` option:<br><br><ul><li>The `StartDateTime` value must not violate the configuration setting value for the minimum number of days for the data purge worker. The minimum available value is 180 days by default (see [Configure the Cortex Processing Engine for task registration](https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-platform/configure-the-cortex-processing-engine-for-task-registration.html)).</li><li>The value must be a positive integer.</li></ul> |
| `--sp, --start-percentile` | No | The range-bound start percentile for the data extraction. For example, `--sp 0`.<br><br>There is a list of restrictions for the `start-percentile` option:<br><br><ul><li>You must specify both the start and end percentile or none of them.</li><li>The range-bound for both is between 0 and 1.</li><li>The `start-percentile` must be lower than the `end-percentile`.</li></ul> |
| `--ep, --end-percentile` | No | The range-bound end percentile for data extraction. For example, `--ep 1`.<br><br>There is a list of restrictions for the `end-percentile` option:<br><br><ul><li>You must specify both the start and end percentile or none of them.</li><li>The range-bound for both is between 0 and 1.</li><li>The `end-percentile` must be higher than the `start-percentile`.</li></ul> |
| `--cds, --conditions` | No | A comma-separated list of additional filter conditions for an interaction purge. Conditions can be customized and registered for further data filtering. For example, `--cds AnonymousCondition`.<br><br>The task registration fails if a non-existing condition is specified. A list of unfound conditions is in the CLI output.<br><br>> [!note]<br>> See [Walkthrough: Customizing interaction purge conditions](https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-platform/walkthrough--customizing-interaction-purge-conditions.html) for more details about limits and how to create custom conditions. |
| `-b, --batch-size` | Yes | The batch size for interaction data extraction that the purge task uses. Default: 100. For example, `-b 200`. |
| `--de,
--delete-if-has-events` | No | List of existing event names or GUIDs to purge, delimited with a comma or space symbol. For example, `--de "Search" "Download"`.<br><br>> [!note]<br>> You can only provide existing events names or GUIDs. Otherwise, the task is not registered. You cannot provide the same event for skipping and deleting in one command. |
| `--se,
--skip-if-has-events` | No | List of existing event names or GUIDs to skip, delimited with a comma or space symbol. For example, `--se "Search" "Download"`.<br><br>> [!note]<br>> You can only provide existing events names or GUIDs. Otherwise, the task is not registered. You cannot provide the same event for skipping and deleting in one command. |
| `--dc,
--delete-if-has-channels` | No | List of existing channel names or GUIDs to purge, delimited with a comma or space symbol. For example, `--dc "Direct","Wiki"`.<br><br>> [!note]<br>> You can only provide existing channel names or GUIDs. Otherwise, the task is not registered. You cannot provide the same channel for skipping and deleting in one command. |
| `--sc,
--skip-if-has-channels` | No | List of existing channel names or GUIDs to skip, delimited with a comma or space symbol. For example, `--sc "f4abe068-196f-4e49-b340-3b0c41da1b77"`.<br><br>> [!note]<br>> You can only provide existing channel names or GUIDs. Otherwise, the task is not registered. You cannot provide the same channel for skipping and deleting in one command. |
| `-v, --verbose` | No | Report additional diagnostic and performance data. |
| `-t, --trace` | No | Report additional diagnostic and performance data. |
| `--confirm` | No | Confirm all prompts automatically. |
| `-?, -h, --help` | No | Help for the command. |

</details>

<details>
<summary><h2>Examples</h2></summary>

The following are examples of the `purge interactions` command use:

```

sitecore xconnect purge interactions start -d 180

sitecore xconnect purge interactions start -d 180 --sp 0 --ep 1 -b 200
--cds ChannelInteractionCondition --de Search –-se "0C179613-2073-41AB-992E-027D03D523BF"
-–dc "Email inclusion" --sc "F4ABE068-196F-4E49-B340-3B0C41DA1B77"
--trace --verbose

```

</details>

<details>
<summary><h2>Confirming or canceling task registration</h2></summary>

The `interactions start` command sends a confirmation to the end-user that this command causes data deletion.

The user can confirm task registration by entering `Y` or `y`:

A successful task registration returns a task ID that you can keep for further actions, such as getting the task [status](https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-platform/the-cli-purge-status-command.html "The CLI purge status command") or [canceling](https://doc.sitecore.com/xp/en/developers/102/sitecore-experience-platform/the-cli-purge-cancel-command.html "The CLI purge cancel command") the task.

The user can also cancel the task registration with `N` or `n`. Any other character entries lead to the cancelation of the task registration with a corresponding notification that the confirmation response was invalid.

You can use the `--confirm` option for silent confirmation of the task registration. In this case, you do not receive any prompts.

The result of the successful task registration is the task ID and sample commands for canceling and getting the status of the purge task.

</details>