> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/setup-and-monitor/collect-and-manage-your-data/clean-and-delete-data/delete-user-data.md).

# Delete user data

Remove a person's data - a single UserPoint, a device point, or many at once.

## Your goal

Delete the data the platform holds about a specific person, on request, without waiting for a retention rule to expire it.

## Expected outcome

The UserPoint and every document related to it are gone, and you can say so with confidence.

## Choose the right operation

Three different things can be deleted, and they are not interchangeable.

| You want to remove               | Operation                          | Effect on the UserPoint                                                                                                                                             |
| -------------------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **A person's whole record**      | UserPoint deletion - API or import | The UserPoint and all related documents are deleted.                                                                                                                |
| **A device and its identifiers** | Device point deletion import       | The device point and its identifiers go; **the UserPoint stays**.                                                                                                   |
| **One identifier**               | Identifier deletion import         | The identifier goes; **the UserPoint stays**. See [Import identifiers](/setup-and-monitor/collect-and-manage-your-data/import-data-in-batch/import-identifiers.md). |

## Delete one UserPoint, by API

Deleting a UserPoint removes it and all related documents - user identifiers, activities, profiles, and the rest. Any identifier can be used to select it:

{% tabs %}
{% tab title="By UserPoint ID" %}

```
DELETE https://api.mediarithmics.com/v1/datamarts/:datamartId/user_points/:userPointId
```

{% endtab %}

{% tab title="By email hash" %}

```
DELETE https://api.mediarithmics.com/v1/datamarts/:datamartId/user_points/email_hash=:emailHash
```

{% endtab %}

{% tab title="By account ID" %}

```
DELETE https://api.mediarithmics.com/v1/datamarts/:datamartId/user_points/compartment_id=:compartmentId,user_account_id=:userAccountId
```

{% endtab %}

{% tab title="By user agent ID" %}

```
DELETE https://api.mediarithmics.com/v1/datamarts/:datamartId/user_points/user_agent_id=:userAgentId
```

The user agent ID looks like `vec:xxx`.
{% endtab %}
{% endtabs %}

These operations can be performed manually, or automated from your centralised systems through the API.

{% hint style="info" %}
Before deleting, you may need to **retrieve** the data first - for an access request, for instance. See [Explore a user profile](/setup-and-monitor/operate-and-monitor/explore-a-user-profile.md) and [Exercise rights of the user](/setup-and-monitor/ensure-privacy-and-compliance/exercise-rights-of-the-user.md).
{% endhint %}

## Delete UserPoints in bulk

Use a document import when you have a list.

{% hint style="info" %}
UserPoint deletion imports are only supported for datamarts using a UserPoint system version of `v202205` or later.
{% endhint %}

{% stepper %}
{% step %}

### Create the document import

Document type `USER_POINTS_DELETION`, mime type `APPLICATION_X_NDJSON`. Only `ndjson` is supported.

```bash
curl -X POST \
  https://api.mediarithmics.com/v1/datamarts/<DATAMART_ID>/document_imports \
  -H 'Authorization: <YOUR_API_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
    "document_type": "USER_POINTS_DELETION",
    "mime_type": "APPLICATION_X_NDJSON",
    "encoding": "utf-8",
    "name": "<YOUR_DOCUMENT_IMPORT_NAME>"
}'
```

{% endstep %}

{% step %}

### Create an execution with one identifier per line

Each line is an identifier linked to a UserPoint, or a UserPoint ID directly. For each one, the job finds the associated UserPoint and deletes it, along with all of its identifiers, segments, scenarios, and its profile.

```bash
curl -X POST \
  https://api.mediarithmics.com/v1/datamarts/<DATAMART_ID>/document_imports/<DOCUMENT_IMPORT_ID>/executions \
  -H 'Authorization: <API_TOKEN>' \
  -H 'Content-Type: application/x-ndjson' \
  -d '
    { "type": "USER_ACCOUNT", "compartment_id": "1000", "user_account_id": "8541254132" }
    { "type": "USER_EMAIL", "hash": "<EMAIL_HASH>" }
    { "type": "USER_AGENT", "user_agent_id": "vec:89998434" }
    { "type": "USER_AGENT", "user_agent_id": "udp:987654" }
    { "type": "USER_POINT", "user_point_id": "95772db3-e762-45da-8cf1-4893debffae7" }
  '
```

The command shapes are the ones described in [Import identifiers](/setup-and-monitor/collect-and-manage-your-data/import-data-in-batch/import-identifiers.md), plus `USER_POINT` with a `user_point_id`.
{% endstep %}

{% step %}

### Read the result

Check `total_success`, `total_failure`, and the error file. See [reading the result](/setup-and-monitor/collect-and-manage-your-data/import-data-in-batch.md#reading-the-result).
{% endstep %}
{% endstepper %}

## Delete device points in bulk

Use this when a device must go but the person's record must stay.

{% hint style="info" %}
Device point deletion is only supported for datamarts using a UserPoint system version of `v202205` or later. **It only deletes the device point and its identifiers, not the associated UserPoint.**
{% endhint %}

Create a document import with document type `USER_DEVICE_POINT_DELETION` and mime type `APPLICATION_X_NDJSON`, then send one user agent per line:

```bash
curl -X POST \
  https://api.mediarithmics.com/v1/datamarts/<DATAMART_ID>/document_imports/<DOCUMENT_IMPORT_ID>/executions \
  -H 'Authorization: <API_TOKEN>' \
  -H 'Content-Type: application/x-ndjson' \
  -d '
    { "type": "USER_AGENT", "user_agent_id": "vec:89998434" }
    { "type": "USER_AGENT", "user_agent_id": "udp:987654" }
  '
```

{% hint style="warning" %}
A device point may be linked to **several** user agent identifiers. **All of them are deleted once their device point is** - including identifiers that do not appear in your file. Deleting one identifier you know about can therefore remove others you did not list.
{% endhint %}

To pass device point IDs directly - `udp:987654` - use the `USER_AGENT` type. Note the contrast with [Import identifiers](/setup-and-monitor/collect-and-manage-your-data/import-data-in-batch/import-identifiers.md), where a `udp:` value **rejects the job**: that import deletes an identifier, this one deletes a device point.

## Verify

* A lookup on the deleted person's identifiers returns nothing.
* For a device point deletion, the UserPoint still exists, without that device.
* The execution's success count matches the number of lines.
* Downstream copies are updated too: if you run a [datamart replication](/setup-and-monitor/collect-and-manage-your-data/export-your-data/datamart-replication.md), the `DELETE` operations reach your cloud - deleting in the platform does not clean up an export you made earlier.

## Related pages

<table data-view="cards" data-search="false"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Exercise rights of the user</strong></td><td>The full procedure for an individual request.</td><td><a href="/setup-and-monitor/ensure-privacy-and-compliance/exercise-rights-of-the-user.md">Exercise rights of the user</a></td></tr><tr><td><strong>Cleaning rules</strong></td><td>Deletion by policy rather than on request.</td><td><a href="/setup-and-monitor/collect-and-manage-your-data/clean-and-delete-data/cleaning-rules.md">Cleaning rules</a></td></tr><tr><td><strong>Import identifiers</strong></td><td>Removing an identifier without the UserPoint.</td><td><a href="/setup-and-monitor/collect-and-manage-your-data/import-data-in-batch/import-identifiers.md">Import identifiers</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mediarithmics.io/setup-and-monitor/collect-and-manage-your-data/clean-and-delete-data/delete-user-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
