getCount()
Retrieves the total number of users.
function getCount(params: UserCountParams): Promise<number>UserCountParams
The total count of users can be filtered down by adding one or more of these parameters.
- Name
 emailAddress?- Type
 string[]- Description
 Counts users with emails that match the given query, via case-insensitive partial match. For example,
hellowill match a user with the emailhello@example.com.
- Name
 phoneNumber?- Type
 string[]- Description
 Counts users with phone numbers that match the given query, via case-insensitive partial match. For example,
555will match a user with the phone number+1555xxxxxxx.
- Name
 externalId?- Type
 string[]- Description
 Counts users with the specified external IDs.
- Name
 username?- Type
 string[]- Description
 Counts users with the specified usernames.
- Name
 web3wallet?- Type
 string[]- Description
 Counts users with the specified Web3 wallet addresses.
- Name
 userId?- Type
 string- Description
 Counts users with the user IDs specified.
- Name
 query?- Type
 string- Description
 Counts users that match the given query. For possible matches, Clerk checks the email addresses, phone numbers, usernames, Web3 wallet addresses, user IDs, first and last names. The query value doesn't need to match the exact value you are looking for, it is capable of partial matches as well.
const response = await clerkClient.users.getCount()Filter by query
The following example retrieves the total number of users matching the query test.
const response = await clerkClient.users.getCount({ query: 'test' })Backend API (BAPI) endpoint
This method in the SDK is a wrapper around the BAPI endpoint GET/users/count. See the BAPI reference for more information.
Feedback
Last updated on