# List User Wallets

Retrieve all wallets owned by a specific user, across all supported blockchains.

## Overview

A single user can hold multiple wallets — one per blockchain, or several on the same chain. This endpoint returns the complete list for a given user, including each wallet's chain, address, label, and whether it is the primary wallet (used for QR code payments and default transactions).

This is different from `GET /v1/wallets/` which returns wallets for the *authenticated* user. This endpoint can be called for any user by UUID, making it suitable for admin dashboards and user profile views.

### `GET /v1/users/{id}/wallets`

Authentication: bearer token required.

Returns all wallets belonging to the specified user.

**Path parameters**

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

**Responses**

`200` OK

```json
[
  {
    "id": "wallet-uuid",
    "chain": "ethereum",
    "address": "0xAbCd...",
    "label": "My ETH Wallet",
    "isPrimary": true
  },
  {
    "id": "wallet-uuid-2",
    "chain": "polygon",
    "address": "0xEfGh...",
    "label": null,
    "isPrimary": false
  }
]
```

`404` Not Found

```json
{ "detail": "User not found" }
```

## Implementation

```javascript
// Get all wallets for a user
async function getUserWallets(token, userId) {
  const res = await fetch(
    `https://api.aureahub.com/v1/users/${userId}/wallets`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  if (!res.ok) throw new Error('Failed to load wallets');
  return res.json(); // Array of wallet objects
}

// Find the primary wallet for a given user
async function getPrimaryWallet(token, userId) {
  const wallets = await getUserWallets(token, userId);
  return wallets.find(w => w.isPrimary) || wallets[0] || null;
}

// Get all wallets grouped by chain
async function getWalletsByChain(token, userId) {
  const wallets = await getUserWallets(token, userId);
  return wallets.reduce((acc, wallet) => {
    acc[wallet.chain] = acc[wallet.chain] || [];
    acc[wallet.chain].push(wallet);
    return acc;
  }, {});
}
```

---

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