> For the complete documentation index, see [llms.txt](https://developer.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.mediarithmics.io/data-ingestion/bulk-processing/user-identifiers-association.md).

# User identifiers association

This document import allows you to merge UserPoint by associating their [user identifiers](/user-points.md#user-identifiers). Each line in the document represents a different user identifiers association&#x20;

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

## How-to

1. Use the [bulk import ](/data-ingestion/bulk-processing.md)endpoints to create a [document import](/data-ingestion/bulk-processing.md#document-import) with the`USER_IDENTIFIERS_ASSOCIATION_DECLARATIONS`document type and `APPLICATION_X_NDJSON` mime type. Only `ndjson` data is supported for user activities.
2. Create an[ execution ](/data-ingestion/bulk-processing.md#create-an-execution)with your commands formatted in `ndjson` .

### User identifiers association command

Each line will create/merge a UserPoint that has all the specified identifiers

| field       | type                      | description                                      |
| ----------- | ------------------------- | ------------------------------------------------ |
| identifiers | UserIdentifierResource\[] | An array of User Identifier Resource of any type |

User identifier resource can be of three shapes. Either email or user agent or user account id. They correspond with the different types of [user identifiers](/user-points.md#user-identifiers).

#### Email

| field | type              | description                                                              |
| ----- | ----------------- | ------------------------------------------------------------------------ |
| type  | "USER\_EMAIL"     | The type of the identifier.                                              |
| hash  | String            | A hash of the email. The hashing function should be unique per datamart. |
| email | String (optional) | the email address                                                        |

#### User Agent

| field           | type          | description                 |
| --------------- | ------------- | --------------------------- |
| type            | "USER\_AGENT" | The type of the identifier. |
| user\_agent\_id | String        | The user agent ID           |

#### User Account

| field             | type              | description                                                                                    |
| ----------------- | ----------------- | ---------------------------------------------------------------------------------------------- |
| type              | "USER\_ACCOUNT"   | The type of the identifier.                                                                    |
| user\_account\_id | String            | The User Account ID                                                                            |
| compartment\_id   | String (optional) | The Compartment ID. If you don't input the compartment id it will fall back on the default one |

### 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_ASSOCIATION_DECLARATIONS",
	"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 '
    { 
      "identifiers":[
        { "type": "USER_EMAIL", "hash":"<EMAIL_HASH>" }, 
        { "type": "USER_AGENT", "user_agent_id": "<USER_AGENT_ID>" }, 
        { "type": "USER_ACCOUNT", "user_account_id": "<USER_ACCOUNT_ID>",  "compartment_id": "<COMPARTMENT_ID>" }
      ]
    }
  '
```

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


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.mediarithmics.io/data-ingestion/bulk-processing/user-identifiers-association.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
