How to Bulk Update User Profile Details in the Management API?

Keywords: bulk user update, upsert, management api, postman

Problem statement:

Bulk update user profile details such as user_metadata and profile_metadata using the Auth0 Management API and Postman.

Solution:

We can bulk import users details with Upsert mode turned on to update user details.

This article explains the user import schema and the fields that can be bulk imported

Steps:

  1. Bulk export user details in JSON format using this extension: User Import / Export Extension
  2. Make changes to the export file.
  3. Import the users with the extension or by calling the /api/v2/jobs/users-imports end point in the Auth0 Management API dashboard or Postman to import the users.

https://auth0.com/docs/api/management/v2#!/Jobs/post_users_imports

  1. Verify the job is successful and the number of records are updated with the /api/v2/jobs/{id} end point:

https://auth0.com/docs/api/management/v2#!/Jobs/get_jobs_by_id

  1. Check on the Auth0 Dashboard users details to confirm the change.

Note:

  1. To migrate users between databases, we can export them from one connection and then import them to another connection by using User import/export extension.
  2. Please test with a few users first to verify the result before bulk update.
  3. The user id should have the format of “connection|id”. It is unique in the Auth0 environment. The update will fail if the same user id exists in multiple connections.
  4. The name of the field in the import file should be the name added in “User Attribute” when exporting user details from the extension.
  5. When bulk export user details we must include the email because that’s the key used for updating the user details.
  6. Bulk import passwordless users is not supported. We can import one user at a time with Auth0 Management API v2
  7. The user_metadata object is replaced when you upsert with bulk import. So we need to send the full user_metadata object when importing, otherwise, the existing fields might be lost after the upsert.
  8. We can not bulk block users. It can only be done by this endpoint for each user: Auth0 Management API v2

Recording:

4 Likes