# Advanced Search

Look up users by wallet address, wallet UUID, or username — built for admin tools and dispute resolution flows.

## Overview

While the basic search endpoint is optimised for P2P payment flows (username lookup), this endpoint is designed for back-office and admin scenarios where you need to reverse-lookup a user from a blockchain address, investigate a specific wallet, or search across multiple fields simultaneously.

All query parameters are optional — provide one or more to filter results. The response is paginated. You can also filter by `isTestnet` to scope results to sandbox or production users.

> ℹ️ Wallet address search supports both EVM (0x...) and Solana (base58) address formats. At least one query parameter must be provided.

### `GET /v1/users/advanced-search`

Authentication: bearer token required.

Multi-field user search by username, wallet UUID, or blockchain wallet address.

**Query parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `username` | string | no | Username to search |
| `wallet_id` | string | no | Wallet UUID |
| `wallet_address` | string | no | Blockchain address (EVM 0x... or Solana base58) |
| `isTestnet` | boolean | no | Scope to sandbox (true) or production (false) users |
| `limit` | integer | no | Results per page |
| `offset` | integer | no | Pagination offset |

**Responses**

`200` OK

```json
{
  "items": [
    {
      "id": "uuid",
      "username": "alice",
      "wallets": [
        { "id": "wallet-uuid", "chain": "ethereum", "address": "0x...", "isPrimary": true }
      ]
    }
  ],
  "total": 1
}
```

## Implementation

```javascript
// Look up the user who owns a specific wallet address
async function findUserByWalletAddress(token, address) {
  const res = await fetch(
    `https://api.aureahub.com/v1/users/advanced-search?wallet_address=${encodeURIComponent(address)}`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  const data = await res.json();
  return data.items[0] || null; // returns null if no match
}

// Look up by multiple fields simultaneously
async function advancedUserSearch(token, { username, walletId, walletAddress }) {
  const params = new URLSearchParams();
  if (username)      params.set('username', username);
  if (walletId)      params.set('wallet_id', walletId);
  if (walletAddress) params.set('wallet_address', walletAddress);

  const res = await fetch(
    `https://api.aureahub.com/v1/users/advanced-search?${params}`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  return res.json();
}
```

---

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