---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/user
title: User object
updated_at: 2026-06-15T12:11:38.756Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# User object

`User` represents a single user in a chat.

## Properties

The `User` interface has the following properties:

```kotlin
interface User {
    val chat: Chat
    val id: String
    val name: String?
    val externalId: String?
    val profileUrl: String?
    val email: String?
    val custom: Map<String, Any?>?
    val status: String?
    val type: String?
    val updated: String?
    val lastActiveTimestamp: Long?
    val active: Boolean
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| chat | Chat | Optional |  | Reference to the main `Chat` object. |
| id | String | Optional |  | [Unique ID](https://www.pubnub.com/docs/general/setup/users-and-devices) of the user. |
| name | String | Optional |  | Display name or username of the user (must not be empty or consist only of whitespace characters). |
| externalId | String | Optional |  | Identifier for the user from an external system, such as a third-party authentication provider or a user directory. |
| profileUrl | String | Optional |  | URL to the user's profile or avatar image. |
| email | String | Optional |  | User's email address. |
| custom | Map<String, | Optional |  | Any custom properties or metadata associated with the user in the form of a JSON. [App Context filtering language](https://www.pubnub.com/docs/general/metadata/filtering) doesn’t support filtering by custom properties. |
| status | String | Optional |  | Current status of the user, like `online`, `offline`, or `away`. |
| type | String | Optional |  | Type of the user, like `admin`, `member`, `guest`. |
| updated | String | Optional |  | Timestamp (a number of milliseconds since January 1, 1970) for the last time the user information was updated or modified. |
| lastActiveTimestamp | Long | Optional |  | Timestamp for the last time the user was active in a chat app. |
| active | Boolean | Optional |  | Whether the user is currently active in the app. Based on `lastActiveTimestamp` and the configured `storeUserActivityInterval`. |

:::tip API limits
To learn about the maximum length of parameters used to set user metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-user-metadata).
:::

## Methods

The `User` object exposes the following methods.

### Regular methods

* [delete()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/delete)
* [getChannelRestrictions()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/moderation#one-user-on-one-channel)
* [getChannelsRestrictions()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/moderation#one-user-on-all-channels)
* [getMembership()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/membership#check-membership)
* [getMemberships()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/membership#get-membership)
* [isMemberOf()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/membership#check-membership)
* [isPresentOn()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/presence#check-users-channel-presence)
* [setRestrictions()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/moderation#mute-or-ban-users-as-an-administrator)
* [update()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/updates#update-user-details)
* [wherePresent()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/presence#return-channels-where-user-is-present)

### Event listeners

* [onDeleted()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/updates#get-user-updates)
* [onInvited()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/invite#listen-to-invite-events)
* [onMentioned()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/mentions#show-notifications-for-mentions)
* [onRestrictionChanged()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/moderation#listen-to-moderation-events)
* [onUpdated()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/updates#get-user-updates)
* active() (deprecated — use the `active` property instead)
* streamUpdates() (deprecated)
* [streamUpdatesOn()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/updates#get-user-updates)

## Use case

`User` methods enable:

* [Creating and managing](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/create) users
* Configuring channel [memberships](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/membership)
* [Mentioning](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/mentions) others in conversations
* Checking user [presence](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/presence) status
* Receiving real-time [invite](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/invite#listen-to-invite-events) and [mention](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/users/mentions#show-notifications-for-mentions) notifications