Skip to main content

getUserListWithoutCount()

Important

getUserListWithoutCount() requires @clerk/backend 3.32.0 or later.

Retrieves the list of users in your instance without their total count. It takes the same parameters as getUserList() and returns the same users, but makes no request to count them, which can be slow for a search over many users. By default, the list is returned in descending order by creation date (newest first).

There is no total, so page until a page holds fewer users than its limit.

Returns an object with a data property that contains an array of User objects.

function getUserListWithoutCount(params: UserListParams): Promise<{ data: User[] }>
  • Name
    createdAtAfter?
    Type
    number
    Description

    Filters users who were created after the given date (with millisecond precision).

  • Name
    createdAtBefore?
    Type
    number
    Description

    Filters users who were created before the given date (with millisecond precision).

  • Name
    emailAddress?
    Type
    string[]
    Description

    Filters users with the specified email addresses. Accepts up to 100 email addresses.

  • Name
    externalId?
    Type
    string[]
    Description

    Filters users with the specified external IDs. Accepts up to 100 external IDs.

  • Name
    last_active_at_since?
    Type
    number
    Description

    Deprecated. Use lastActiveAtAfter instead. This parameter will be removed in a future version.

  • Name
    lastActiveAtAfter?
    Type
    number
    Description

    Filters users who were last active after the given date (with millisecond precision).

  • Name
    lastActiveAtBefore?
    Type
    number
    Description

    Filters users who were last active before the given date (with millisecond precision).

  • Name
    lastSignInAtAfter?
    Type
    number
    Description

    Filters users who were last signed in after the given date (with millisecond precision).

  • Name
    lastSignInAtBefore?
    Type
    number
    Description

    Filters users who were last signed in before the given date (with millisecond precision).

  • Name
    limit?
    Type
    number
    Description

    Maximum number of items returned per request. Must be an integer greater than zero and less than 501. Can be used for paginating the results together with offset. Defaults to 10.

  • Name
    offset?
    Type
    number
    Description

    Skip the first offset items when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with limit. Defaults to 0.

  • Name
    orderBy?
    Type
    WithSign<"created_at" | "updated_at" | "email_address" | "web3wallet" | "first_name" | "last_name" | "phone_number" | "username" | "last_active_at" | "last_sign_in_at">
    Description

    Filters users in a particular order. Prefix a value with + to sort in ascending order, or - to sort in descending order. Defaults to -created_at.

  • Name
    organizationId?
    Type
    string[]
    Description

    Filters users who are members of the specified Organizations. Accepts up to 100 Organization IDs.

  • Name
    phoneNumber?
    Type
    string[]
    Description

    Filters users with the specified phone numbers. Accepts up to 100 phone numbers.

  • Name
    query?
    Type
    string
    Description

    Filters users matching the given query across email addresses, phone numbers, usernames, Web3 wallet addresses, user IDs, first names, and last names. Partial matches supported.

  • Name
    startingAfter?
    Type
    string
    Description

    The ID of the last user on the previous page. Only valid when orderBy is omitted, created_at, +created_at, or -created_at, and offset is omitted or 0.

  • Name
    userId?
    Type
    string[]
    Description

    Filters users with the specified user IDs. Accepts up to 100 user IDs.

  • Name
    username?
    Type
    string[]
    Description

    Filters users with the specified usernames. Accepts up to 100 usernames.

  • Name
    web3Wallet?
    Type
    string[]
    Description

    Filters users with the specified Web3 wallet addresses. Accepts up to 100 Web3 wallet addresses.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

const { data } = await clerkClient.users.getUserListWithoutCount()

Page through users

Gets users who match the query test, 100 at a time. Pagination uses startingAfter, which works only with created_at ordering (the default). See Retrieve every user.

const limit = 100
let startingAfter: string | undefined

while (true) {
  const { data } = await clerkClient.users.getUserListWithoutCount({
    query: 'test',
    limit,
    startingAfter,
  })

  for (const user of data) {
    // Replace this with your own logic.
    console.log(user.id)
  }

  if (data.length < limit) break
  startingAfter = data[data.length - 1].id
}

To page in any order, or to filter by metadata, use searchUsers().

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint GET/users. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on