Import a batch of users
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:
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:
Parameters
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.
Whether to pregenerate an embedded Ethereum wallet for the imported user. Defaults to false
.
Whether to pregenerate an embedded Solana wallet for the imported user. Defaults to false
.
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.
Response Format
A successful response will include a list of results along with details about which imports succeeded and which failed:
Each result in the response includes:
The action taken (“create”).
The index of the user in the request array.
Whether the import succeeded.
The Privy DID of the created user (if successful).
Error code (if unsuccessful).
Error message (if unsuccessful).
The conflicting DID (if there was an account conflict).
Make a POST
request to:
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:
Parameters
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.
Whether to pregenerate an embedded Ethereum wallet for the imported user. Defaults to false
.
Whether to pregenerate an embedded Solana wallet for the imported user. Defaults to false
.
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.
Response Format
A successful response will include a list of results along with details about which imports succeeded and which failed:
Each result in the response includes:
The action taken (“create”).
The index of the user in the request array.
Whether the import succeeded.
The Privy DID of the created user (if successful).
Error code (if unsuccessful).
Error message (if unsuccessful).
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.