# User identifiers deletion

This document import allows you to mark [user identifiers](https://developer.mediarithmics.io/user-points#user-identifiers) for deletion. Each line in the document represents a different object to remove from the platform.&#x20;

{% hint style="info" %}
This is only supported for datamarts using a UserPoint system version of `v201901` or later.&#x20;

**It only deletes the user identifier but not the associated UserPoint.**
{% endhint %}

## How-to

1. Use the [bulk import ](https://developer.mediarithmics.io/data-streams/data-ingestion/bulk-processing)endpoints to create a [document import](https://developer.mediarithmics.io/data-streams/data-ingestion/bulk-processing/..#document-import) with the`USER_IDENTIFIERS_DELETION`document type and `APPLICATION_X_NDJSON` mime type. Only `ndjson` data is supported for user activities.
2. Create an[ execution ](https://developer.mediarithmics.io/data-streams/data-ingestion/bulk-processing/..#create-an-execution)with your commands formatted in `ndjson`. Each command can either be a user account deletion, a user email deletion or a user agent deletion.

### Example

```bash
# Create the document import
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_IDENTIFIERS_DELETION",
	"mime_type": "APPLICATION_X_NDJSON",
	"encoding": "utf-8",
	"name": "<YOUR_DOCUMENT_IMPORT_NAME>"
}'
```

```bash
# Create the execution
curl -X POST \
  https://api.mediarithmics.com/v1/datamarts/1162/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": "982f50d88d437d13bdbd541edfv4fe5176cc8d862f8cbe7ca4f0dc8ea"
    }
    { "type": "USER_AGENT", "user_agent_id": "vec:89998434" }
  '
```

{% hint style="success" %}
You can, of course, remove different identifier types at the same time. Please note that the uploaded data is in `ndjson` and not `json`. That means the different deletions are not separated by commas, but by a line separator `\n`
{% endhint %}

## User Account deletion command

| field             | type              | description                                             |
| ----------------- | ----------------- | ------------------------------------------------------- |
| type              | String            | USER\_ACCOUNT                                           |
| user\_account\_id | String            | The User Account Id.                                    |
| compartment\_id   | Number (Optional) | The Compartment Id associated with the User Account Id. |

### **Example:**&#x20;

```javascript
{
  "type": "USER_ACCOUNT",
  "compartment_id": "1000",
  "user_account_id": "8541254132"
}
```

## User Email deletion command

| field | type   | description                |
| ----- | ------ | -------------------------- |
| type  | String | USER\_EMAIL                |
| hash  | String | Hash of the Email address. |

### &#x20;Example:

```javascript
{
  "type": "USER_EMAIL",
  "hash": "982f50d88d437d13bdbd541edfv4fe5176cc8d862f8cbe7ca4f0dc8ea"
}
```

## User Agent deletion command

| field           | type   | description                                                                                                                                                                          |
| --------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| type            | String | USER\_AGENT                                                                                                                                                                          |
| user\_agent\_id | String | A [user agent id](https://developer.mediarithmics.io/user-points/user-identifiers/device-identifiers#user_agent_id) other than a device point id. Ex: "vec:123456" or "net:9:12345". |

{% hint style="warning" %}
User device point ids ("udp:123456") are not supported by this document import job and will cause the job to be rejected.

Use the [device-points-deletion](https://developer.mediarithmics.io/data-streams/data-ingestion/bulk-processing/deletions/device-points-deletion "mention")job type if you want to delete device points along with all their associated technical ids.
{% endhint %}

\
Example:

```javascript
{ "type": "USER_AGENT", "user_agent_id": "vec:89998434" }
```
