# Delete User

Deactivate a user account. This is a soft-delete — data is retained but the user can no longer authenticate.

> ℹ️ **Your tenant's quorum, where Aurea enables it for your tenant** (a tenant on the institutional security profile by its profile): this call answers `202` `{ "state": "awaiting_quorum", "requestId" }` — the **202** tab below — and nothing is done until another administrator of your tenant approves it; the answer it would have given is then read once by who asked ([Read the Answer](https://docs.aureahub.com/docs/quorum-request-result.md)). With no other administrator able to approve it, it is done at once. [Your Tenant's Quorum](https://docs.aureahub.com/docs/guide-tenant-quorum.md). Every other tenant gets the answers below, unchanged.

## Overview

Deleting a user sets their account status to `inactive`. Their wallets, transactions, and history are preserved for audit and compliance purposes. The user will not be able to log in after deletion.

A successful deletion returns `204 No Content` with no response body. This action should be treated as irreversible from the user's perspective — always confirm with the user before calling this endpoint.

> ⚠️ This action immediately revokes the user's ability to authenticate. Any active sessions will be invalid on the next token verification. Ensure you have confirmation from the user or admin before calling this endpoint.

### `DELETE /v1/users/{id}`

Authentication: bearer token required.

Soft-deletes a user. Account is deactivated; data is retained.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | User UUID |

**Responses**

`204` No Content

`202` Awaiting quorum

```json
{
  "state": "awaiting_quorum",
  "requestId": "4e2b9c17-8a3d-4f60-b5e1-7c9d0a2f6b38"
}
```

`404` Not Found

```json
{ "error": "NotFoundError", "message": "User not found" }
```

## Implementation

```javascript
async function deleteUser(token, userId) {
  const res = await fetch(`https://api.aureahub.com/v1/users/${userId}`, {
    method: 'DELETE',
    headers: { 'Authorization': `Bearer ${token}` }
  });

  if (res.status === 404) throw new Error('User not found');
  if (!res.ok) throw new Error('Failed to delete user');

  // 204 No Content — no response body
  return true;
}

// Example: account deletion flow with confirmation
async function requestAccountDeletion(token, userId) {
  const confirmed = confirm('Are you sure you want to delete your account? This cannot be undone.');
  if (!confirmed) return;

  await deleteUser(token, userId);

  // Clear local tokens and redirect to homepage
  sessionStorage.removeItem('access_token');
  localStorage.removeItem('refresh_token');
  window.location.href = '/';
}
```

---

Web version: https://docs.aureahub.com/#users-delete
