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 | Type | Description |
---|---|---|
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? | string | A search query to filter users by. |
userId? | string | The user ID's to filter by. |
externalId? | string[] | 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' })