docs/classes/management.SDK.UsersClient-2.html
authenticationMethodsauthenticatorsconnectedAccountsenrollmentsfederatedConnectionsTokensetsgroupsidentitieslogsmultifactororganizationspermissionsriskAssessmentsrolesrefreshTokensessions
listcreatelistUsersByEmailgetdeleteupdateregenerateRecoveryCoderevokeAccess
_options_authenticationMethods_authenticators_connectedAccounts_enrollments_federatedConnectionsTokensets_groups_identities_logs_multifactor_organizations_permissions_riskAssessments_roles_refreshToken_sessions
get authenticationMethods(): AuthenticationMethodsClient
get authenticators(): AuthenticatorsClient
get connectedAccounts(): ConnectedAccountsClient
get enrollments(): EnrollmentsClient
get federatedConnectionsTokensets(): FederatedConnectionsTokensetsClient
get groups(): GroupsClient
get identities(): IdentitiesClient
get logs(): LogsClient
get multifactor(): MultifactorClient
get organizations(): OrganizationsClient
get permissions(): PermissionsClient
get riskAssessments(): RiskAssessmentsClient
get roles(): RolesClient
get refreshToken(): RefreshTokenClient
get sessions(): SessionsClient
new UsersClient(options: BaseClientOptions): UsersClient
list(
request?: ListUsersRequestParameters,
requestOptions?: UsersClient.RequestOptions,
): Promise<
Page<UserResponseSchema, ListUsersOffsetPaginatedResponseContent>,
>
Retrieve details of users. It is possible to:
The q query parameter can be used to get users that match the specified criteria using query string syntax.
Learn more about searching for users.
Read about best practices when working with the API endpoints for retrieving users.
Auth0 limits the number of users you can return. If you exceed this threshold, please redefine your search, use the export job, or the User Import / Export extension.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
Management.TooManyRequestsError
Management.ServiceUnavailableError
await client.users.list({ page: 1, per_page: 1, include_totals: true, sort: "sort", connection: "connection", fields: "fields", include_fields: true, q: "q", search_engine: "v1", primary_order: true })Copy
create(
request: CreateUserRequestContent,
requestOptions?: UsersClient.RequestOptions,
): HttpResponsePromise<CreateUserResponseContent>
Create a new user for a given database or passwordless connection.
Note: connection is required but other parameters such as email and password are dependent upon the type of connection.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
Management.TooManyRequestsError
await client.users.create({ connection: "connection" })Copy
listUsersByEmail(
request: ListUsersByEmailRequestParameters,
requestOptions?: UsersClient.RequestOptions,
): HttpResponsePromise<UserResponseSchema[]>
Find users by email. If Auth0 is the identity provider (idP), the email address associated with a user is saved in lower case, regardless of how you initially provided it.
For example, if you register a user as [email protected], Auth0 saves the user's email as [email protected].
Therefore, when using this endpoint, make sure that you are searching for users via email addresses using the correct case.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
Management.TooManyRequestsError
await client.users.listUsersByEmail({ fields: "fields", include_fields: true, email: "email" })Copy
get(
id: string,
request?: GetUserRequestParameters,
requestOptions?: UsersClient.RequestOptions,
): HttpResponsePromise<GetUserResponseContent>
Retrieve user details. A list of fields to include or exclude may also be specified. For more information, see Retrieve Users with the Get Users Endpoint.
ID of the user to retrieve.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
Management.TooManyRequestsError
await client.users.get("id", { fields: "fields", include_fields: true })Copy
delete(
id: string,
requestOptions?: UsersClient.RequestOptions,
): HttpResponsePromise<void>
Delete a user by user ID. This action cannot be undone. For Auth0 Dashboard instructions, see Delete Users.
ID of the user to delete.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
Management.TooManyRequestsError
await client.users.delete("id")Copy
update(
id: string,
request?: UpdateUserRequestContent,
requestOptions?: UsersClient.RequestOptions,
): HttpResponsePromise<UpdateUserResponseContent>
Update a user.
These are the attributes that can be updated at the root level:
Some considerations:
user_metadata and app_metadata). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level.email, email_verified, phone_number, phone_verified, username or password of a secondary identity, you need to specify the connection property too.email or phone_number you can specify, optionally, the client_id property.email_verified is not supported for enterprise and passwordless sms connections.blocked to false does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state.null as the value.To mark the email address of a user as verified, the body to send should be:
{ "email_verified": true }
Let's assume that our test user has the following user_metadata:
{ "user_metadata" : { "profileCode": 1479 } }
To add the field addresses the body to send should be:
{ "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }}
The modified object ends up with the following user_metadata property:
{
"user_metadata": {
"profileCode": 1479,
"addresses": { "work_address": "100 Industrial Way" }
}
}
If there's existing user metadata to which we want to add "home_address": "742 Evergreen Terrace" (using the addresses property) we should send the whole addresses object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be:
{
"user_metadata": {
"addresses": {
"work_address": "100 Industrial Way",
"home_address": "742 Evergreen Terrace"
}
}
}
The modified object ends up with the following user_metadata property:
{
"user_metadata": {
"profileCode": 1479,
"addresses": {
"work_address": "100 Industrial Way",
"home_address": "742 Evergreen Terrace"
}
}
}
ID of the user to update.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
Management.TooManyRequestsError
await client.users.update("id")Copy
regenerateRecoveryCode(
id: string,
requestOptions?: UsersClient.RequestOptions,
): HttpResponsePromise<RegenerateUsersRecoveryCodeResponseContent>
Remove an existing multi-factor authentication (MFA) recovery code and generate a new one. If a user cannot access the original device or account used for MFA enrollment, they can use a recovery code to authenticate.
ID of the user to regenerate a multi-factor authentication recovery code for.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
await client.users.regenerateRecoveryCode("id")Copy
revokeAccess(
id: string,
request?: RevokeUserAccessRequestContent,
requestOptions?: UsersClient.RequestOptions,
): HttpResponsePromise<void>
Revokes selected resources related to a user (sessions, refresh tokens, ...).
ID of the user.
OptionalrequestOptions: UsersClient.RequestOptionsRequest-specific configuration.
Management.TooManyRequestsError
await client.users.revokeAccess("id")Copy
Protected Readonly_options_options: NormalizedClientOptionsWithAuth<BaseClientOptions>
Protected_authenticationMethods_authenticationMethods: AuthenticationMethodsClient | undefined
Protected_authenticators_authenticators: AuthenticatorsClient | undefined
Protected_connectedAccounts_connectedAccounts: ConnectedAccountsClient | undefined
Protected_enrollments_enrollments: EnrollmentsClient | undefined
Protected_federatedConnectionsTokensets_federatedConnectionsTokensets: FederatedConnectionsTokensetsClient | undefined
Protected_groups_groups: GroupsClient | undefined
Protected_identities_identities: IdentitiesClient | undefined
Protected_logs_logs: LogsClient | undefined
Protected_multifactor_multifactor: MultifactorClient | undefined
Protected_organizations_organizations: OrganizationsClient | undefined
Protected_permissions_permissions: PermissionsClient | undefined
Protected_riskAssessments_riskAssessments: RiskAssessmentsClient | undefined
Protected_roles_roles: RolesClient | undefined
Protected_refreshToken_refreshToken: RefreshTokenClient | undefined
Protected_sessions_sessions: SessionsClient | undefined
Member Visibility
ThemeOSLightDark
Accessors authenticationMethodsauthenticatorsconnectedAccountsenrollmentsfederatedConnectionsTokensetsgroupsidentitieslogsmultifactororganizationspermissionsriskAssessmentsrolesrefreshTokensessions Constructors constructor Methods listcreatelistUsersByEmailgetdeleteupdateregenerateRecoveryCoderevokeAccess Properties _options_authenticationMethods_authenticators_connectedAccounts_enrollments_federatedConnectionsTokensets_groups_identities_logs_multifactor_organizations_permissions_riskAssessments_roles_refreshToken_sessions