# List Users

Retrieve a paginated list of all users in the tenant. Primarily used in admin and back-office dashboards.

## Overview

This endpoint returns all users belonging to the authenticated tenant, paginated for performance. It is intended for admin dashboards and back-office tools where you need a user directory. For looking up a specific user by username or wallet address, use the **Search Users** or **Advanced Search** endpoints instead, which are more efficient for single-user lookups.

You can filter by `status` to show only active or suspended users, and by `isTestnet` to separate sandbox users from production ones.

### `GET /v1/users/`

Authentication: bearer token required.

Returns a paginated list of users in the tenant.

**Query parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer | no | Results per page (default: 20, max: 100) |
| `offset` | integer | no | Number of records to skip for pagination |
| `status` | string | no | Filter by status: active, suspended, inactive |
| `isTestnet` | boolean | no | Filter sandbox (true) or production (false) users |

**Responses**

`200` OK

```json
{
  "items": [
    {
      "id": "uuid",
      "username": "alice",
      "email": "alice@example.com",
      "status": "active",
      "role": "user",
      "created_at": "2024-01-15T10:00:00Z"
    }
  ],
  "total": 42,
  "limit": 20,
  "offset": 0
}
```

## Implementation

Fetch all pages of users using offset-based pagination:

```javascript
async function getAllUsers(token) {
  const limit = 50;
  let offset = 0;
  let allUsers = [];

  while (true) {
    const res = await fetch(
      `https://api.aureahub.com/v1/users/?limit=${limit}&offset=${offset}`,
      { headers: { Authorization: `Bearer ${token}` } }
    );
    const data = await res.json();
    allUsers = allUsers.concat(data.items);

    if (allUsers.length >= data.total) break;
    offset += limit;
  }

  return allUsers;
}

// Or fetch a single page for a dashboard table:
async function getUsersPage(token, page = 0, limit = 20) {
  const res = await fetch(
    `https://api.aureahub.com/v1/users/?limit=${limit}&offset=${page * limit}`,
    { headers: { Authorization: `Bearer ${token}` } }
  );
  return res.json(); // { items, total, limit, offset }
}
```

---

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