Docs

You are viewing an archived version of the docs.Go to latest version

getCount()

Retrieves the total number of users.

const totalUsers = await clerkClient.users.getCount();

This can also be flitered down by adding parameters of the type UserCountParams.

UserCountParams

  • Name
    emailAddress?
    Type
    string[]
    Description

    The email addresses to filter by.

  • Name
    phoneNumber?
    Type
    string[]
    Description

    The phone numbers to filter by.

  • Name
    username?
    Type
    string[]
    Description

    The usernames to filter by.

  • Name
    web3wallet?
    Type
    string[]
    Description

    The web3wallet to filter by.

  • Name
    query?
    Type
    string
    Description

    A search query to filter users by.

  • Name
    userId?
    Type
    string
    Description

    The user ID's to filter by.

  • Name
    externalId?
    Type
    string[]
    Description

    The external ID's to filter by.

Example

getCount({ query })

To do a broader match through a list of fields, you can use the query parameter which partially matches the fields: userId, emailAddress, phoneNumber, username, web3Wallet, and externalId.

This example retrieves the total number of users matching the query test.

const totalUsersMatchingTest = await clerkClient.users.getCount({ query: 'test' })

Feedback

What did you think of this content?

Last updated on