# Import Users

To import Users via Secure folder, you can upload two JSON files, a header file and a data file, to the File Server. You can find credentials for the Server in your System Setup.

The header file contains the data fields structure, so that CrossEngage can validate each field on upload, to ensure there are no mistakes. The data file contains the Users and their attributes that you wish to upload to the CrossEngage system.

### Naming convention

The naming convention for these 2 files is the following:

```
user_feed_header_YYYYMMDDHHMMSS.json
user_feed_data_YYYMMDDHHMMSS.json
```

&#x20;Example:

```
user_feed_header_20180321110559.json
user_feed_data_20180321110559.json
```

{% hint style="warning" %}
Please ensure that a pair of header and data files always have the same timestamp in the UTC Timezone (`YYYMMDDHHMMSS`). If the files have different timestamps, they will not be processed as intended.
{% endhint %}

## Header File

This header file contains an array of objects which describe the type of attributes that may be loaded through a user object in the data file. The structure of these objects is as follows:

| Key           | Description                                                                                                                                                                                                                                         |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `column_name` | Name of the user attribute loaded through the user data file. The column name should always be sent in **camelCase** e.g. `firstName`                                                                                                               |
| `data_type`   | This describes the type of data that will be loaded in the respective attribute. See all possible values in the **Supported data** types section below.                                                                                             |
| `is_nullable` | This property allows you to describe whether or not a field can have the value `NULL`. Our system will automatically validate this to ensure that users will be updated correctly. Please note that the `id` field is mandatory and cannot be NULL. |

### **Supported data types**

{% hint style="warning" %}
Should your data file include any array attributes, please make sure to create these via API before uploading the file to our system to prevent our system from rejecting your file.
{% endhint %}

| Data type   | Description                  | Example                  |
| ----------- | ---------------------------- | ------------------------ |
| `text`      | strings of different lengths | `Some characters`        |
| `date`      | A date e.g. birthdate        | `2016-03-22`             |
| `timestamp` | timestamp                    | `2016-04-01T18:02:42+01` |
| `boolean`   | logical                      | `true`                   |
| `integer`   | an integer number            | `42`                     |
| `numeric`   | any number                   | `18.5`                   |

### **Example header file**

```
[
   {
      "column_name":"id",
      "data_type":"text",
      "is_nullable":"NO"
   },
   {
      "column_name":"email",
      "data_type":"text",
      "is_nullable":"YES"
   },
   {
      "column_name":"businessUnit",
      "data_type":"text",
      "is_nullable":"YES"
   },
   {
      "column_name":"firstName",
      "data_type":"text",
      "is_nullable":"YES"
   },
   {
      "column_name":"lastName",
      "data_type":"text",
      "is_nullable":"YES"
   },
   {
      "column_name":"birthday",
      "data_type":"date",
      "is_nullable":"YES"
   },
   {
      "column_name":"gender",
      "data_type":"text",
      "is_nullable":"YES"
   }
]
```

## Data File

This data file contains an array of objects which contain the data of the users that should be loaded into CrossEngage. Each object defines the attributes of a single user.

{% hint style="info" %}
The only technical mandatory field in User data is the `id`. The `id` refers to the user identifier you have assigned to a customer in your data warehouse. This is the same `id` you might be already sending through our Tracking SDK or User Management API.

But the combination of `email` and `businessUnit` of a user is also a unique identifier and therefore its advised to also include it in the user feed.&#x20;
{% endhint %}

{% hint style="warning" %}
If `email` and/or `businessUnit` are empty or missing from the import file, the importer will update them as empty and overwrite whatever there might have been saved before in the user profile.
{% endhint %}

{% hint style="warning" %}
Please note that if you drop more than one file at the same time before they are processed, only the most recent file will be processed. The older one(s) will be ignored.
{% endhint %}

### **Example data file**&#x20;

```
[
    {
      "id": "JD1534",
      "gender": "male",
      "firstName": "James",
      "email": "james.dean@yahoo.com",
      "businessUnit":"crossengage",
      "birthday": "1931-02-08",
      "lastName": "Dean",
      "lastOperation": {
          "operationDate": "2016-08-20",
          "type": "PURCHASE"
      },
      "subscriptions": [
          {
              "subscriptionId": "BI934",
              "subscriptionName": "BILD daily"
          },
          {
              "subscriptionId": "FA772",
              "subscriptionName": "FAZ weekly"
          }
      ],
      "tags": ["tag1", "tag2"]
    },
    {
      "id": "JD1332",
      "gender": "female",
      "firstName": "Marilyn",
      "email": "marilyn.monroe@gmail.com",
      "businessUnit":"crossengage",
      "birthday": "1926-01-06",
      "lastName": "Monroe",
      "subscriptions": [
          {
              "subscriptionId": "SZ337",
              "subscriptionName": "SZ weekly"
          }
      ]
    }
]
```


---

# Agent Instructions: 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:

```
GET https://documentation.crossengage.io/data-and-engagement-platform/data-management/data-management-with-data-feeds/users/import-users.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
