# UserProfile

A UserProfile is usually [imported from an existing information system,](/data-streams/data-ingestion/bulk-processing/imports/profiles.md) for example CRM, and login database. We usually see our customers using the profile to collect:

* Contact details
* User preferences
* Status in a loyalty program
* Subscription to a newsletter
* CRM information
* Scoring calculated outside the platform
* Aggregated Values
* *other details*

Each UserProfile is associated with a UserPoint by a [user identifier](/user-points.md#user-identifiers). It can also be linked to a UserAccount.

## User profile object

| field                  | type               | description                                                                                      |
| ---------------------- | ------------------ | ------------------------------------------------------------------------------------------------ |
| $user\_account\_id     | String (Optional)  | The associated UserAccount ID. If none, the profile remains anonymous.                           |
| $compartment\_id       | Integer (Optional) | The compartment ID. If none, the profile is imported into the default compartment\_id.           |
| $last\_modified\_ts    | Timestamp          | The timestamp of the last edit operation for this user profile. Automatically set by the system. |
| $creation\_ts          | Timestamp          | The timestamp of the creation operation for this user profile. Automatically set by the system.  |
| \[any custom property] | Any                | The value of a custom property                                                                   |

{% hint style="warning" %}
When importing profiles it is recommended to complete the $user\_account\_id and the $compartment\_id event if the values are the same than the ones used as the identifier as the values are not inherited from the identifiers info. You can find more information about the [user profiles import](/data-streams/data-ingestion/bulk-processing/imports/profiles.md).
{% endhint %}

### Example:

```javascript
# UserProfile object 
{
    "$compartment_id": 1606,
    "$user_account_id": "c9879698769OIUYOIY9879879",
    "$last_modified_ts": 5467987654613,
    "$creation_ts": 6579874654654654,
    "firstname": "David",
    "lastname": "Guetta",
    "gender": 1,
    "newsletter_options": {
        "subscribed": true,
        "preferred_periods": "MONTHLY"
    }
    
}
```

```javascript
# Complete payload when importing a profile 
{ 
    "operation": "UPSERT",
    "compartment_id": "1600", 
    "user_account_id": "identifier_account_id",
    "force_replace": true,
    "user_profile": {
        "$compartment_id": 1606,
        "$user_account_id": "c9879698769OIUYOIY9879879",
        "$last_modified_ts": 5467987654613,
        "$creation_ts": 6579874654654654,
        "firstname": "David",
        "lastname": "Guetta",
        "gender": 1,
        "newsletter_options": {
            "subscribed": true,
            "preferred_periods": "MONTHLY"
        }
    }
}
```

{% hint style="success" %}
You can have different compartment IDs and different UserAccount between the one in the profile wrapper, as the UserPoint identifier and the one into the UserProfile object.
{% endhint %}


---

# 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://developer.mediarithmics.io/user-points/user-profiles.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.
