Skip to main content
Privy allows you to delete users via their Privy user ID. This is a destructive action: if the user logs into your app again, they will have a new user ID, will create a new embedded wallet address, and will have to relink any formerly linked accounts.
Avoid deleting users whenever possible. For security of user assets, Privy does not delete the embedded wallet, and instead “soft deletes” it by disassociating it from the deleted user and archiving the data.While wallet recovery may be technically possible if the user still has access to their login method, the recovery process requires significant internal coordination and can take considerable time to complete. There is no guarantee of successful recovery.Treat all user deletions as permanent and irreversible. Only delete users when absolutely necessary, and confirm you have exhausted all other options before proceeding.
Use the PrivyClient’s delete method from the users() interface to delete a user. As a parameter, pass the user’s Privy ID as a string:
await privy.users().delete('insert-user-id');

Complete Example

import { PrivyClient } from '@privy-io/node';

const privy = new PrivyClient({
  appId: process.env.PRIVY_APP_ID,
  appSecret: process.env.PRIVY_APP_SECRET
});

async function deletePrivyUser(id: string) {
  try {
    await privy.users().delete(id);
    console.log(`User ${id} successfully deleted`);
    return true;
  } catch (error) {
    console.error(`Failed to delete user: ${error.message}`);
    return false;
  }
}
This method will throw an error if the deletion operation failed (e.g. due to an invalid Privy ID).