How to Use Bulk Import Job with Upsert Enabled

Overview

This article details what attributes are required for updating users in bulk when using the bulk import job with upsert enabled.

Applies To

  • Bulk Import job
  • Upsert

Solution

For an import, technically, the only required value is “email”, as email should be a unique identifier for a user within the context of a single Database connection.
Any missing attributes in the import payload will not cause changes on the existing profile’s relevant attributes, with the exception of email_verified, currently an upsert will cause this to be reset to pending unless it is specified.

Please note that when either of the user_metadata or app_metadata objects are included in the import file, and upsert is enabled, it will replace the existing metadata object in full, so if it is required to retain existing metadata whilst adding new metadata, the old metadata will need to be included in the import payload too:

[
   {
      "email": "john.doe@email.com",
      "email_verified" : true,
      "app_metadata": {
         "existing_metadata_property": "test1",
         "new_metadata_property": "test2"
      }
   }
]

It should also be noted that some user attributes cannot be updated via upsert, such as “email” and “user_id”. This also applies to Flexible identifier-enabled connections:

Bulk User Import Database Schema and Examples

Related References