> ## Documentation Index
> Fetch the complete documentation index at: https://dynamic-docs-feat-sidebar-revamp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Headless Account Deletion

## Introduction

This guide shows you how to implement account deletion functionality without using Dynamic's UI components. When a user deletes their account, all associated data will be permanently removed, including their wallets, embedded wallets, verified credentials, etc.

<Warning>
  Account deletion is permanent and cannot be undone. All associated data will
  be irrecoverably deleted.
</Warning>

## Implementation

The account deletion functionality is accessed through the `useDeleteUserAccount` hook from the SDK.

<Tip>
  This hook requires Dynamic SDK version 4.6 or higher. Make sure you're using a
  compatible version to access this functionality.
</Tip>

### Basic Implementation

Here's a simple implementation showing how to add account deletion to your app:

```tsx
import { FC } from "react";
import { useDeleteUserAccount } from "@dynamic-labs/sdk-react-core";

const DeleteAccount: FC = () => {
  const { deleteUser, error, isLoading } = useDeleteUserAccount();

  const handleDeleteAccount = async () => {
    try {
      await deleteUser();
    } catch (err) {
      console.error("Failed to delete account:", err);
    }
  };

  return (
    <div>
      <button onClick={handleDeleteAccount} disabled={isLoading}>
        {isLoading ? "Deleting..." : "Delete Account"}
      </button>

      {error && <p className="error">Error: {error.message}</p>}
    </div>
  );
};
```

## Best Practices

1. **Always confirm deletion**: Include a confirmation step before proceeding with account deletion.

2. **Clear explanation**: Clearly explain what data will be deleted and that the action is permanent.

## Hook Types and Functions

The `useDeleteUserAccount` hook provides:

* `deleteUser`: Function to initiate account deletion
* `isLoading`: Boolean indicating if deletion is in progress
* `error`: Error object if deletion fails
