Skip to Content
Clerk logo

Clerk Docs

Ctrl + K
Go to clerkstage.dev

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

NameTypeDescription
emailAddress?string[]The email addresses to filter by.
phoneNumber?string[]The phone numbers to filter by.
username?string[]The usernames to filter by.
web3wallet?string[]The web3wallet to filter by.
query?stringA search query to filter users by.
userId?stringThe user ID's to filter by.
externalId?string[]The external ID's to filter by.

Example

getCount({ query })

Retrieves the total number of users matching the query.

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

What did you think of this content?

Clerk © 2023