Privy allows you to import your users in batches via REST API to simplify the migration process. To import users, pass in an array of user objects which each represent a new user. You can also create wallets during import with wallet pregeneration.
Once a user has been imported into Privy, if they log in, all of their imported accounts (wallet, email, etc.) will be included in their user object. If the imported user has an embedded wallet, that wallet will be available to the user upon sign in.
Make a POST request to:
https://auth.privy.io/api/v1/users/import
In the body of the request, include a users field with an array of up to 20 user objects.
Below is a sample cURL command for importing multiple new users into Privy:
An array including all of the user’s linked accounts. These objects are in the same shape as the
linked accounts returned by getUser. For
each linked account, you must specify the type and must not include a verifiedAt timestamp.
Field
Type
Description
type
'apple_oauth'
N/A
email
string
Email address associated with the user’s Apple account.
subject
number
ID of user from Apple’s user API.
Field
Type
Description
type
'custom_auth'
N/A
API: custom_user_id SDK: customUserId
string
ID of user from custom auth provider.
Field
Type
Description
type
'discord_oauth'
N/A
subject
string
ID of user from Discord user API response.
email
string
Email of user from Discord user API response
username
string
Username of user from Discord user API response. Include the 4-digit discriminator prefixed by ’#’.
Wallet address of the user from Farcaster user API response. Note that this is the Farcaster wallet address, and not the Privy embedded wallet address.
username
string
(Optional) Username of user from Farcaster user API response. Do not include the ’@’.
API: display_name SDK: displayName
string
(Optional) Display name of user from Farcaster user API response.
bio
string
(Optional) Bio of user from Farcaster user API response.
API: profile_picture_url SDK: profilePictureUrl
string
(Optional) Profile picture URL of the user from Farcaster user API response. Must be a valid image URL.
API: homepage_url SDK: homepageUrl
string
(Optional) Profile URL of the user from Farcaster user API response.
(See Farcaster docs. Note that the Privy import interface differs slightly from the Farcaster public interface in order to maintain consistency with other Privy LinkedAccount types.)
Whether to pregenerate an embedded Smart wallet for the imported user. Defaults to false. If
createEthereumSmartWallet is true, you must also explicitly set createEthereumWallet to
true as well.
An array including all of the user’s linked accounts. These objects are in the same shape as the
linked accounts returned by getUser. For
each linked account, you must specify the type and must not include a verifiedAt timestamp.
Field
Type
Description
type
'apple_oauth'
N/A
email
string
Email address associated with the user’s Apple account.
subject
number
ID of user from Apple’s user API.
Field
Type
Description
type
'custom_auth'
N/A
API: custom_user_id SDK: customUserId
string
ID of user from custom auth provider.
Field
Type
Description
type
'discord_oauth'
N/A
subject
string
ID of user from Discord user API response.
email
string
Email of user from Discord user API response
username
string
Username of user from Discord user API response. Include the 4-digit discriminator prefixed by ’#’.
Wallet address of the user from Farcaster user API response. Note that this is the Farcaster wallet address, and not the Privy embedded wallet address.
username
string
(Optional) Username of user from Farcaster user API response. Do not include the ’@’.
API: display_name SDK: displayName
string
(Optional) Display name of user from Farcaster user API response.
bio
string
(Optional) Bio of user from Farcaster user API response.
API: profile_picture_url SDK: profilePictureUrl
string
(Optional) Profile picture URL of the user from Farcaster user API response. Must be a valid image URL.
API: homepage_url SDK: homepageUrl
string
(Optional) Profile URL of the user from Farcaster user API response.
(See Farcaster docs. Note that the Privy import interface differs slightly from the Farcaster public interface in order to maintain consistency with other Privy LinkedAccount types.)
Whether to pregenerate an embedded Smart wallet for the imported user. Defaults to false. If
createEthereumSmartWallet is true, you must also explicitly set createEthereumWallet to
true as well.
The conflicting DID (if there was an account conflict).
User import endpoints have a rate limit of 240 users per minute. If you are being rate limited,
responses will have status code 429. We suggest you set up exponential back-offs starting at 1
second to seamlessly recover.