Privy allows you to import a single user into your Privy app. To import a user, pass their linked accounts (wallet, email, etc.) as part of the import request. You can also create a wallet during import with wallet pregeneration.

When an imported user logs in, all of their imported accounts will be included in their user object. If the imported user has a pregenerated embedded wallet, that wallet will be available to the user upon sign in.

Use the PrivyClient’s importUser method to import a single user into your Privy app.

const user = await privy.importUser({
  linkedAccounts: [
    {
      type: 'email',
      address: '[email protected]'
    }
  ],
  createEthereumWallet: true,
  createSolanaWallet: true,
  createEthereumSmartWallet: true,
  customMetadata: {
    key: 'value'
  }
});

Parameters

linkedAccounts
LinkedAccount[]
required

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.

createEthereumWallet
boolean

Whether to pregenerate an embedded Ethereum wallet for the imported user. Defaults to false.

createSolanaWallet
boolean

Whether to pregenerate an embedded Solana wallet for the imported user. Defaults to false.

createEthereumSmartWallet
boolean

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.

customMetadata
object

An object containing any custom metadata you want to associate with the user. This metadata will be returned in the user object when the user logs in.

User import endpoints have a rate limit of 240 users in total 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.