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 user creation request. You can also generate a wallet when you create a user.

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]'
    }
  ],
  wallets: [{chainType: "ethereum"}]
  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.

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.

wallets
WalletCreateRequestType[]

(Optional) An array of wallets to create for the user.

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.