---
title: "Register a purge contacts API task"
slug: "register-a-purge-contacts-api-task"
abstract: "How to register contact purge tasks with the xConnect purging tool Web API."
---
# Register a purge contacts API task

You can use the [xConnect Web API](https://doc.sitecore.com/xp/en/developers/101/sitecore-experience-platform/web-api-for-xconnect-data-tools.html "Web API for xConnect Data Tools") to remove unwanted data from your contacts. To do this, you must register a [purge](https://doc.sitecore.com/xp/en/developers/101/sitecore-experience-platform/xconnect-purging-tool.html "xConnect purging tool") task.

To register a task:

- Use the following API:

    ```text
    <instance>/sitecore/api/datatools/purge/tasks/contacts
    ```

    The successful task registration request returns the task ID used for status monitoring, for example:

    ```csharp
    {
        "TaskId": "049cd8b3-b120-4949-a42f-cdc2fe4f3086"
    }
    ```

## Parameters

The following describes the POST parameters that you can send to the Web API to register a purge task:

| Parameter | Optional | Default | Type | Description |
| --- | --- | --- | --- | --- |
| `BatchSize` | Yes | 100 | Integer | The data extraction batch size of contacts.<br><br>The `BatchSize` system parameter controls the amount of data extracted from the collection database for each cursor read.<br><br>> [!important]<br>> Use a small batch size for the purging process to not overload the system too much, and so it can cancel tasks with less impact. Task cancellation is not an immediate process and does not cancel an ongoing batch. |
| `DefaultSplitItemCount` | Yes | 100 | Integer | Contact data extraction cursor split count.<br><br>The `DefaultSplitItemCount` system parameter controls the split process of contact data extraction. |
| `ExpiresAfterHours` | Yes | 24 | Integer | The expiration of the task in the final state.<br><br>The final task status is either successful or failed and removed from the system after the expiration period. |
| `CutoffDays` | No | - | Nullable Integer | The last contact activity must be greater or equal to the specified amount of days. The range restriction is 0 to the `int.MaxValue`.<br><br>The `CutoffDays` parameter specifies the number of days the contact is not interacting with the brand.<br><br>The data extraction process uses this parameter to filter contacts based on the `LastModified` value. The `LastModified` date-time reflects the last interaction of the contact. |
| `StartPercentile` | Yes | Null | Nullable Double | The start sampling range value. The range restriction is 0 to 1.<br><br>The percentile range specifies the subset of data to extract. Use this parameter to perform the purging in small batches to avoid stressing the system too much.<br><br>The data extraction process filters contacts based on the percentile range and the `CutOffDays` parameter. |
| `EndPercentile` | Yes | Null | Nullable Double | The end sampling range value. The range restriction is 0 to 1.<br><br>The percentile range specifies the subset of data to extract. Use this parameter to perform the purging in small batches to avoid stressing the system too much.<br><br>The data extraction process filters contacts based on the percentile range and the `CutOffDays` parameter. |
| `Conditions` | Yes | "" | String | List of condition names. Multiple conditions run with the AND logical operator.<br><br>The `Conditions` parameters let you specify custom condition keys used to identify contacts for purging. You must register custom conditions in the Cortex Processing Engine.<br><br>You delimit `Conditions` IDs with a comma.<br><br>The total length of the parameter must be less than 2019 characters.<br><br>The filtering with conditions is performed in-memory, not at the database level. If the contact passes all the conditions, then the purging tool can purge the contact. |