> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Search AccessTokens

> Search and list AccessToken records with filtering, sorting, and pagination.

> **WiFi Access Tokens** provide unique network access codes for customers and visitors. They work alongside the Mikrotik, IronWifi, and Layer8 integrations. Access tokens can be shared with customers and visitors as part of visitor and booking confirmation emails. Each token includes a number of minutes of WiFi access and, optionally, an expiration date and user limit.

## Authentication

<Note>
  This endpoint requires OAuth2 authentication. Include a valid bearer token in the `Authorization` header.
  The authenticated user must be a full unrestricted administrator or have the **`AccessToken-List`** role.
</Note>

## Query Parameters

### Pagination & Sorting

<ParamField query="page" type="integer" default="1">
  The page number to retrieve.
</ParamField>

<ParamField query="size" type="integer" default="25">
  The number of records per page.
</ParamField>

<ParamField query="orderBy" type="string">
  The property name to sort results by (e.g. `Name`, `CreatedOn`).
</ParamField>

<ParamField query="dir" type="integer">
  Sort direction. `0` for ascending, `1` for descending.
</ParamField>

### Filters

<ParamField query="AccessToken_Business" type="integer">
  Filter by Business Id.
</ParamField>

<ParamField query="AccessToken_AccessCode" type="string">
  Filter by unique network access code used to connect to WiFi.
</ParamField>

<ParamField query="AccessToken_Description" type="string">
  Filter by free-text description of this access token.
</ParamField>

<ParamField query="AccessToken_MinutesIncluded" type="integer">
  Filter by total minutes of WiFi access included in this token.
</ParamField>

<ParamField query="AccessToken_ValidFrom" type="string">
  Filter by start date from which this token can be used.
</ParamField>

<ParamField query="AccessToken_ValidTo" type="string">
  Filter by expiration date after which this token is no longer valid.
</ParamField>

<ParamField query="AccessToken_UserLimit" type="integer">
  Filter by maximum number of users that can use this token simultaneously.
</ParamField>

<ParamField query="AccessToken_MinutesLeft" type="integer">
  Filter by remaining minutes of WiFi access available on this token.
</ParamField>

<ParamField query="AccessToken_MacAddress" type="string">
  Filter by mAC address of the device associated with this token.
</ParamField>

<ParamField query="AccessToken_BookingGuid" type="string">
  Filter by Booking Guid.
</ParamField>

<ParamField query="AccessToken_VisitorGuid" type="string">
  Filter by Visitor Guid.
</ParamField>

<ParamField query="AccessToken_LastAccess" type="string">
  Filter by date and time this token was last used to connect.
</ParamField>

### Range Filters

<ParamField query="from_AccessToken_MinutesIncluded" type="integer">
  Filter by total minutes of WiFi access included in this token greater than or equal to this value.
</ParamField>

<ParamField query="to_AccessToken_MinutesIncluded" type="integer">
  Filter by total minutes of WiFi access included in this token less than or equal to this value.
</ParamField>

<ParamField query="from_AccessToken_ValidFrom" type="string">
  Filter by start date from which this token can be used greater than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AccessToken_ValidFrom" type="string">
  Filter by start date from which this token can be used less than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="from_AccessToken_ValidTo" type="string">
  Filter by expiration date after which this token is no longer valid greater than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AccessToken_ValidTo" type="string">
  Filter by expiration date after which this token is no longer valid less than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="from_AccessToken_UserLimit" type="integer">
  Filter by maximum number of users that can use this token simultaneously greater than or equal to this value.
</ParamField>

<ParamField query="to_AccessToken_UserLimit" type="integer">
  Filter by maximum number of users that can use this token simultaneously less than or equal to this value.
</ParamField>

<ParamField query="from_AccessToken_MinutesLeft" type="integer">
  Filter by remaining minutes of WiFi access available on this token greater than or equal to this value.
</ParamField>

<ParamField query="to_AccessToken_MinutesLeft" type="integer">
  Filter by remaining minutes of WiFi access available on this token less than or equal to this value.
</ParamField>

<ParamField query="from_AccessToken_LastAccess" type="string">
  Filter by date and time this token was last used to connect greater than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AccessToken_LastAccess" type="string">
  Filter by date and time this token was last used to connect less than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="from_AccessToken_CreatedOn" type="string">
  Filter records created on or after this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AccessToken_CreatedOn" type="string">
  Filter records created on or before this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="from_AccessToken_UpdatedOn" type="string">
  Filter records updated on or after this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AccessToken_UpdatedOn" type="string">
  Filter records updated on or before this date. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

## Code Examples

### Simple listing

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://spaces.nexudus.com/api/spaces/accesstokens?page=1&size=15&orderBy=AccessCode&dir=0" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/spaces/accesstokens?' + new URLSearchParams({
      page: 1,
      size: 15,
      orderBy: 'AccessCode',
      dir: 1 // Ascending
    }),
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://spaces.nexudus.com/api/spaces/accesstokens',
      params={
          'page': 1,
          'size': 15,
          'orderBy': 'AccessCode',
          'dir': 0 // Ascending
      },
      headers={
          'Authorization': 'Bearer YOUR_TOKEN'
      }
  )

  data = response.json()
  ```
</CodeGroup>

### Filtering by AccessCode

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://spaces.nexudus.com/api/spaces/accesstokens?AccessToken_AccessCode=example-value&orderBy=AccessCode&dir=0" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/spaces/accesstokens?' + new URLSearchParams({
      AccessToken_AccessCode: 'example-value',
      orderBy: 'AccessCode',
      dir: 1
    }),
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://spaces.nexudus.com/api/spaces/accesstokens',
      params={
          'AccessToken_AccessCode': 'example-value',
          'orderBy': 'AccessCode',
          'dir': 0 // Ascending
      },
      headers={
          'Authorization': 'Bearer YOUR_TOKEN'
      }
  )

  data = response.json()
  ```
</CodeGroup>

### Range filters

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET \
    "https://spaces.nexudus.com/api/spaces/accesstokens?from_AccessToken_UpdatedOn=2025-01-01T00:00&to_AccessToken_UpdatedOn=2025-12-31T23:59&orderBy=UpdatedOn&dir=0" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/spaces/accesstokens?' + new URLSearchParams({
      from_AccessToken_UpdatedOn: '2025-01-01T00:00',
      to_AccessToken_UpdatedOn: '2025-12-31T23:59',
      orderBy: 'UpdatedOn',
      dir: 1 // Descending
     }),
    {
      headers: {
        'Authorization': 'Bearer YOUR_TOKEN'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://spaces.nexudus.com/api/spaces/accesstokens',
      params={
          'from_AccessToken_UpdatedOn': '2025-01-01T00:00',
          'to_AccessToken_UpdatedOn': '2025-12-31T23:59',
          'orderBy': 'UpdatedOn',
          'dir': 1 // Descending
      },
      headers={
          'Authorization': 'Bearer YOUR_TOKEN'
      }
  )

  data = response.json()
  ```
</CodeGroup>

## Response

### 200

<ResponseField name="Records" type="AccessToken[]">
  The list of AccessToken records matching the query. See the [Get one AccessToken](/rest-api/spaces/get-accesstokens-by-id) endpoint for the full list of properties returned for each record.
</ResponseField>

<Warning>
  **Partial records** — The listing endpoint returns a summary representation of each AccessToken. The following fields are **not populated** in the `Records[]` response: `MinutesIncluded`, `ValidTo`, `UserLimit`.

  To get all fields, fetch the full record using the [Get one AccessToken](/rest-api/spaces/get-accesstokens-by-id) endpoint.

  **Important for updates:** When updating a record via `PUT`, always retrieve the full record with a `GET` request first, apply your changes to that complete data, and then send the updated record. Do not use data from a listing response as the base for a `PUT` request, as missing fields may be unintentionally cleared.
</Warning>

<ResponseField name="CurrentPage" type="integer">
  Current page number.
</ResponseField>

<ResponseField name="CurrentPageSize" type="integer">
  Number of records per page.
</ResponseField>

<ResponseField name="CurrentOrderField" type="string">
  The field used for sorting.
</ResponseField>

<ResponseField name="CurrentSortDirection" type="integer">
  The sort direction (`0` = ascending, `1` = descending).
</ResponseField>

<ResponseField name="FirstItem" type="integer">
  Index of the first item on the current page.
</ResponseField>

<ResponseField name="LastItem" type="integer">
  Index of the last item on the current page.
</ResponseField>

<ResponseField name="TotalItems" type="integer">
  Total number of matching records across all pages.
</ResponseField>

<ResponseField name="TotalPages" type="integer">
  Total number of pages.
</ResponseField>

<ResponseField name="HasNextPage" type="boolean">
  Whether there is a next page of results.
</ResponseField>

<ResponseField name="HasPreviousPage" type="boolean">
  Whether there is a previous page of results.
</ResponseField>

```json Example Response theme={null}
{
  "Records": [
    {
      "BusinessId": 0,
      "AccessCode": "",
      "Description": null,
      "ValidFrom": null,
      "MinutesLeft": 0,
      "MacAddress": null,
      "BookingGuid": null,
      "VisitorGuid": null,
      "LastAccess": null,
      "Id": 87654321,
      "UpdatedOn": "2025-01-15T10:30:00Z",
      "CreatedOn": "2025-01-10T08:00:00Z",
      "UniqueId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "UpdatedBy": "admin@example.com",
      "IsNew": false,
      "SystemId": null,
      "ToStringText": "AccessToken Example",
      "LocalizationDetails": null,
      "CustomFields": null
    }
  ],
  "CurrentPageSize": 15,
  "CurrentPage": 1,
  "CurrentOrderField": "AccessCode",
  "CurrentSortDirection": 1,
  "FirstItem": 1,
  "HasNextPage": false,
  "HasPreviousPage": false,
  "LastItem": 1,
  "PageNumber": 1,
  "PageSize": 15,
  "TotalItems": 1,
  "TotalPages": 1
}
```
