---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/list
title: List all users
updated_at: 2026-06-09T11:05:32.953Z
---

> 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


# List all users

`getUsers()` returns a paginated list of all users with their metadata.

:::note
Enable [App Context](https://youtu.be/9UEoSlngpYI) in the [Admin Portal](https://admin.pubnub.com/) to store user data. If using [Access Manager](https://www.pubnub.com/docs/chat/chat-sdk/build/features/users/permissions), uncheck `Disallow Get All User Metadata` in the [App Context configuration](https://www.pubnub.com/docs/general/metadata/basics#configuration).
:::

### Method signature

##### Under the hood

`getUsers()` calls App Context API and the JavaScript SDK [getAllUUIDMetadata()](https://www.pubnub.com/docs/sdks/javascript/api-reference/objects#get-metadata-for-all-users) method.

This method takes the following parameters:

```ts
chat.getUsers({
    filter?: string,
    sort?: object,
    limit?: number,
    page?: {
        next?: string,
        prev?: string,
    }
}): Promise<{
    users: User[],
    page: {
        next: string,
        prev: string,
    },
    total: number,
}>
```

#### Input

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| filter | string | Optional |  | Expression used to filter the results. Returns only these users whose properties satisfy the given expression are returned. The filtering language is [defined here](https://www.pubnub.com/docs/general/metadata/filtering). |
| sort | object | Optional |  | Key-value pair of a property to sort by, and a sort direction. Available options are `id`, `name`, and `updated`. Use `asc` or `desc` to specify the sorting direction, or specify `null` to take the default sorting direction (ascending). For example: `{name: "asc"}`. By default, the items are sorted by the last updated date. |
| limit | number | Optional | `100` | Number of objects to return in response. The default (and maximum) value is `100`. |
| page | object | Optional |  | Object used for pagination to define which previous or next result page you want to fetch. |
| > next | string | Optional |  | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| > prev | string | Optional |  | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `next` parameter is supplied. |

#### Output

| Parameter | Description |
| --- | --- |
| `Promise<>`Type: `object` | Returned object containing three fields: `users`, `page`, and `total`. |
| `> users`Type: `User[]` | List of all matching users. |
| `> page`Type: `object` | String that lets you either fetch the next (`next`) or previous (`prev`) result page. |
| `>> next`Type: `string` | Random string returned from the server, indicating a specific position in a data set. Used for forward pagination, it fetches the next page, allowing you to continue from where you left off. |
| `>> prev`Type: `string` | Random string returned from the server, indicating a specific position in a data set. Used for backward pagination, it fetches the previous page, enabling access to earlier data. Ignored if the `next` parameter is supplied. |
| `> total`Type: `number` | Total number of [User objects](https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/user) matching the request query. |

### Sample code

Fetch all existing user IDs.

```ts
// reference the "chat" object and invoke the "getUsers()" method
const users = await chat.getUsers()
```

### Other examples

#### Pagination

Get the total number of 25 users and then specify that you want to fetch the results from the next page using a string that was previously returned from the PubNub server.

```ts
// result page 1
const usersObject = await chat.getUsers(
    {
        limit: 25,
    }
)

// result page 2
const usersObjectPage2 = await chat.getUsers(
    {
        limit: 25,
        page: { next: usersObject.page.next } 
    }
)
```

#### Archived users

Get all archived users. This request will return all users removed with the `soft` option set to `true`, whose data is still stored in the App Context storage.

```ts
const users = await chat.getUsers(
    {
        filter: "status=='deleted'"
    }
)
```