> 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/design-your-data-model-and-schema/user-identity/user-identifiers/user-account.md).

# User Account

Identify a registered user with an account ID and the compartment it belongs to.

## Your goal

Identify users who are registered in one of your systems, in a way that keeps accounts from different systems distinguishable on the same person.

## Expected outcome

Every account identifier you send is paired with the compartment representing the system it came from.

## What a UserAccount is

A **UserAccount** identifies a user registered on one of your systems - a CRM, a loyalty programme, or any authentication system. That registration system is external to mediarithmics.

| Property          | Type                | Description                                                    |
| ----------------- | ------------------- | -------------------------------------------------------------- |
| `user_account_id` | String              | Usually the same ID as in the source system, such as your CRM. |
| `compartment_id`  | String              | The compartment associated with the user account.              |
| `creation_ts`     | Timestamp           | The account's creation timestamp.                              |
| `expiration_ts`   | Timestamp, optional | The account's eventual expiration timestamp.                   |

{% hint style="warning" %}
**Always use `user_account_id` together with `compartment_id`** to identify a user by their account. If you do not specify a compartment ID, the default compartment is used - which means two accounts with the same ID from two different systems become the same identifier.
{% endhint %}

## The compartment half of the identifier

A **compartment** is a group that organises specific user account identifiers. Each compartment has a unique ID used to identify the corresponding account identifier - "UTIQ Martechpass" might have compartment ID 20, for instance.

There are two categories:

| Category                                  | What it holds                                                                            |
| ----------------------------------------- | ---------------------------------------------------------------------------------------- |
| **First-party user account compartments** | Account identifiers created inside your organisation, such as CRM identifiers.           |
| **Shared user account compartments**      | Account identifiers shared from another organisation - including user-based network IDs. |

For a compartment shared at community level: subscribe to it in your community organisation, after which it is automatically shared with your other organisations - but you still need to activate it in your datamart.

Creating and subscribing to compartments is covered in [Compartments](/setup-and-monitor/plan-and-integrate/set-up-the-environment/set-up-compartments.md).

## In the schema

```graphql
type UserAccount {
  id: ID! @TreeIndex(index:"USER_INDEX")
  creation_ts: Timestamp! @TreeIndex(index:"USER_INDEX")
  creation_date: Date! @TreeIndex(index:"USER_INDEX") @Function(params:["creation_ts"], name:"ISODate")

  compartment_id: String! @TreeIndex(index:"USER_INDEX") @ReferenceTable(model_type:"COMPARTMENTS", type:"CORE_OBJECT")
  user_account_id: String! @TreeIndex(index:"USER_INDEX")
}
```

`@ReferenceTable` on `compartment_id` is what gives people building queries an autocomplete on compartment names instead of IDs. See [Schema definition](/setup-and-monitor/collect-and-manage-your-data/design-your-data-model-and-schema/schema-definition.md).

## In an activity

```json
{
  "$user_identifiers": [
    {
      "$type": "USER_ACCOUNT",
      "$compartment_id": 1606,
      "$user_account_id": "c9879698769OIUYOIY9879879"
    }
  ]
}
```

## When importing profiles

A `UserProfile` carries `$user_account_id` and `$compartment_id` of its own, separately from the identifier used to route the import.

{% hint style="warning" %}
When importing profiles, fill `$user_account_id` and `$compartment_id` in the profile itself **even if the values are the same** as the ones used as the identifier - the values are not inherited from the identifier information.
{% endhint %}

The compartment ID and the account in the profile object can legitimately differ from the ones used as the UserPoint identifier. See [Import profiles](/setup-and-monitor/collect-and-manage-your-data/import-data-in-batch/import-profiles.md).

## Verify

* Every account identifier you send carries a compartment ID.
* The compartment exists and is activated on the datamart receiving the data.
* A logged-in test user's UserPoint shows the account under the expected compartment.

## 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>Compartments</strong></td><td>Create the compartments this identifier depends on.</td><td><a href="/setup-and-monitor/plan-and-integrate/set-up-the-environment/set-up-compartments.md">Compartments</a></td></tr><tr><td><strong>User Email</strong></td><td>The other identifier tied to a person rather than a device.</td><td><a href="/setup-and-monitor/collect-and-manage-your-data/design-your-data-model-and-schema/user-identity/user-identifiers/user-email.md">User Email</a></td></tr><tr><td><strong>Network IDs</strong></td><td>User-based network IDs, which also use compartments.</td><td><a href="/setup-and-monitor/collect-and-manage-your-data/design-your-data-model-and-schema/user-identity/network-ids.md">Network IDs</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/design-your-data-model-and-schema/user-identity/user-identifiers/user-account.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.
