# Users

The Users API provides access to a list of users within a tenant. This API supports filtering, pagination, and sorting.

### API Endpoint

```http
GET /tenant/users
Host: api.audicient.com
Authorization: <API_KEY>:<API_SECRET>
enterprise-id: 123456
```

### Query Parameters

| Parameter         | Type    | Description                                     | Default     |
| ----------------- | ------- | ----------------------------------------------- | ----------- |
| orderByDescending | boolean | Whether to sort results in descending order     | `true`      |
| orderByProperty   | string  | Field to sort by                                | `createdAt` |
| pageSize          | number  | Number of results per page                      | `20`        |
| pageNumber        | number  | Page number for pagination                      | `1`         |
| fromDate          | string  | Filter users created from this date (optional)  | `null`      |
| toDate            | string  | Filter users created up to this date (optional) | `null`      |
| searchText        | string  | Search term for user filtering (optional)       | `null`      |

### Authentication Requirements

All requests must include authentication credentials.

* **Authorization Header:** Pass the API key and secret as `<API_KEY>:<API_SECRET>`.
* **Enterprise-ID Header:** Required for impersonation when accessing user-specific data.

### Example Request

```http
GET /tenant/users?pageSize=10&pageNumber=1&orderByProperty=firstName&orderByDescending=false
Host: api.audicient.com
Authorization: <API_KEY>:<API_SECRET>
```

### Example Response

```json
{
  "totalItemsCount": 3,
  "pageNumber": 1,
  "pageSize": 100,
  "items": [
    {
      "firstName": "John",
      "lastName": "Doe",
      "email": "johndoe@example.com",
      "imageId": "abc123",
      "createdAt": "2025-03-10T12:34:56.789Z"
    },
    {
      "firstName": "Alice",
      "lastName": "Smith",
      "email": "alice.smith@example.com",
      "imageId": "xyz456",
      "createdAt": "2025-02-20T08:15:30.621Z"
    },
    {
      "firstName": "Bob",
      "lastName": "Johnson",
      "email": "bob.johnson@example.com",
      "imageId": null,
      "createdAt": "2025-03-05T14:20:10.123Z"
    }
  ],
  "additionalCounters": null
}

```

### Impersonation

If you need to perform operations as a specific user, include the `enterprise-id` header in your requests. This allows tenant administrators to access user-specific data and perform actions on behalf of users.
