> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getdecipher.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Users

> Easily tag and identify users with errors, session replays, and traces.

<Check>**⏱ Estimated Time To Completion: 2 minutes**</Check>

## Overview of User Fields

Users in Decipher are identified by calling `Sentry.setUser` and passing **at least one** of the following fields:

* **email**: The user's email address. This is the **strongly recommended** identifier if available.
* **id**: Your internal identifier for the user.
* **username**: The username, typically used as a more readable label than the internal id.

Below is the full list of natively supported fields in Decipher, but you can add any arbitrary key/values in the `setUser` call as well.

| Field in `setUser` | Meaning                                                           |
| ------------------ | ----------------------------------------------------------------- |
| `email`            | Recommended identifier to set                                     |
| `id`               | Optional: use if email not available                              |
| `username`         | Optional: use if email not available                              |
| `account`          | Recommended: Which account/organization is this user a member of? |
| `created_at`       | Recommended: date this user signed up                             |
| `role`             | Optional: what is this user's role/type?                          |

We strongly recommend providing the `created_at` field to tell Decipher when the user originally signed up.

You can also provide arbitrary **additional key/value pairs** beyond these reserved names, and Decipher will store them with the user information. For example,
you can set a key like **"paymentTier"** to values like `"free"` or `"paid"` to represent your user's payment plan, and any other field specific to your application or users

Anywhere in your application where you have user information, call the `setUser` (or `set_user`, depending on language) method.

<Tip>Make sure to call `setUser` in your **frontend** to ensure replays are tagged correctly.</Tip>

## Sentry SDK

<Tabs>
  <Tab title="Web (JavaScript/TypeScript)">
    ```typescript theme={null}
    // Set user information in Decipher via the Sentry TypeScript SDK
    Sentry.setUser({
      "email": "jane.doe@example.com",  // Recommended identifier to set
      "id": "your_internal_unique_identifier", // Optional: use if email not available
      "username": "unique_username", // Optional: use if email not available
      "account": "AcmeCo",  // Recommended: Which account/organization is this user a member of?
      "created_at": "2025-04-01T15:30:00Z", // Recommended: date this user signed up.
      "role": "client", // Optional: what is this user's role/type?
      // You can add more user information here as key/value pairs.
    });
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    # Set user information in Decipher via the Sentry Python SDK
    import sentry_sdk

    sentry_sdk.set_user({
        "email": "jane.doe@example.com",  # Recommended identifier to set.
        "id": "your_internal_unique_identifier",
        "username": "unique_username",
        "role": "client",
        # Additional user information can be added here
        "account": "AcmeCo",  # Which account/organization is this user a member of?
        "created_at": "2025-04-01T15:30:00Z", # Recommended: date this user signed up.
        "role": "client", # Optional: what is this user's role/type?
    })
    ```
  </Tab>

  <Tab title="C#">
    ```csharp theme={null}
    // Set user information in Sentry for C#
    SentrySdk.ConfigureScope(scope =>
    {
        scope.User = new User
        {
            Id = "unique_user_id", // Unique identifier for the user
            Email = "jane.doe@example.com", // User's email address
            Username = "username", // User's username
            Role: "client",
            // Additional user information can be added here
        };
    });
    ```
  </Tab>
</Tabs>
