Users Created Through Import Users API not Searchable after Job Completes

Overview

Users created through the import users API are not searchable after the job is completed. They cannot be retrieved immediately after. This happens frequently, but not always.

Cause

To improve search performance, users are stored in a secondary datastore while the primary datastore is used for authentication. The user search API uses this secondary storage. This behavior is sometimes described as eventually consistent as there is a sync process between the primary and secondary storage.

Solution

The recommended solution is to insert a delay period after the users are imported. Alternatively, the following management API can be used for searching. This API uses the primary database and is immediately consistent.

Related References

Retrieve Users with Get Users by Email Endpoint
User Search v2