> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# ListSessionsAsync

# Package: analytics

# Namespace: SessionIdsService

# Method link: https://dev.wix.com/docs/api-reference/business-management/analytics/sessions/list-sessions-async.md

## Permission Scopes:
Manage Session Recording Analytics - all permissions: SCOPE.DC-ANALYTICS-AND-REPORTS.MANAGE-SESSIONS

## Introduction

Start an async job to retrieve a list of session IDs, given the specified filters. The following filters **must** be passed:
- Time period, either predefined or custom.
- Session filter, either navigation flow (page interactions), conversion funnel steps, or device type.

---

## REST API

### Schema

```
 Method: listSessionsAsync
 Description: Start an async job to retrieve a list of session GUIDs, given the specified filters. The following filters **must** be passed: - Time period, either predefined or custom. - Session filter, either navigation flow (page interactions), conversion funnel steps, or device type.
 URL: https://www.wixapis.com/analytics/v1/sessions/list/async
 Method: POST
 Method parameters:
    - ONE-OF: 
     - name: navigationFlow | type: NavigationFlowSessionsParams | description: Navigation flow details.  
        - name: pageInteractions | type: array<string> | description: Page interactions, including where the user dropped off. For example: - ["/{Homepage}", "__DROP__"]: Sessions where a user visited the site's homepage and then dropped off. - ["", "__DROP__"]: Sessions where a user visited (any page) and then dropped off. - ["", "", "__DROP__"]: Session where a user visited any page, then navigated to any page, and then dropped off.  | validation: minItems 1, maxItems 5, maxLength 255
     - name: conversionFunnel | type: ConversionFunnelSessionsParams | description: Conversion funnel details. The steps in the journey the visitor has taken on the site.  
        - name: include | type: FunnelStep | description: Funnel step to include.  
             - enum:
             -     NOT_SELECTED_FUNNEL_STEP: Not selected.
             -     SITE_SESSIONS: Site sessions.
             -     VIEWED_PRODUCT: Viewed product.
             -     ADDED_TO_CART: Added to cart.
             -     REACHED_CHECKOUT: Reached checkout.
             -     SESSIONS_CONVERTED: Sessions converted.
        - name: exclude | type: FunnelStep | description: Funnel step to exclude.  
     - name: deviceType | type: SessionsByDeviceParams | description: Device type.  
        - name: type | type: DeviceType | description: Device type.  
             - enum:
             -     NOT_SELECTED_DEVICE_TYPE: Not selected.
             -     DESKTOP: Desktop.
             -     MOBILE: Mobile.
             -     TABLET: Tablet.
             -     ALL: All.
    - ONE-OF: 
     - name: customTimePeriod | type: CustomTimePeriod | description: Custom time period with start & end dates.  
        - name: startDate | type: string | description: Custom period start date in provided timezone.  | validation: format LOCAL_DATE
        - name: endDate | type: string | description: Custom period end date in provided timezone. Returned data will include all dates until the requested end date. For example, { startDate: '2024-01-01', endDate: '2024-01-03' } will return data for '2024-01-01' and '2024-01-02'  | validation: format LOCAL_DATE
     - name: predefinedTimePeriod | type: PredefinedTimePeriod | description: Predefined time period.  
         - enum:
         -     TODAY: Today.
         -     YESTERDAY: Yesterday.
         -     LAST_7_DAYS: Last 7 days.
         -     LAST_14_DAYS: Last 14 days.
         -     LAST_30_DAYS: Last 30 days.
         -     LAST_90_DAYS: Last 90 days.
         -     LAST_28_DAYS: Last 28 days.
         -     LAST_180_DAYS: Last 180 days.
         -     LAST_365_DAYS: Last 365 days.
         -     THIS_WEEK: Current week, starting on Monday.
         -     THIS_MONTH: Current month.
         -     THIS_QUARTER: Current quarter.
         -     THIS_YEAR: This year.
         -     LAST_WEEK: Last week (previous week).
         -     LAST_MONTH: Last month.
         -     LAST_QUARTER: Last quarter.
         -     LAST_YEAR: Last year.
         -     LAST_12_MONTHS: Last 12 months.
   param name: timezone | type: timezone | description: User's timezone. Defaults to timezone as set in the [Site Properties API](https://dev.wix.com/docs/rest/business-management/site-properties/properties/properties-object.md).  | validation: maxLength 100
 Return type: ListSessionsAsyncResponse
  - name: jobId | type: string | description: List sessions job GUID. Pass this GUID to Get List Sessions Job Result to retrieve job details and metadata.  | validation: format GUID


```

### Examples

### List Sessions Async
```curl
curl -X POST \
  'https://www.wixapis.com/analytics/v1/sessions/list/async' \
  -H 'Content-type: application/json' \
  -H 'Authorization: <AUTH>' \
  -d '{
    "deviceType": {
      "type": "MOBILE"
    },
    "predefinedTimePeriod": "LAST_30_DAYS"
  }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.analyticsSession.analyticsSession.listSessionsAsync(options)
 Description: Start an async job to retrieve a list of session GUIDs, given the specified filters. The following filters **must** be passed: - Time period, either predefined or custom. - Session filter, either navigation flow (page interactions), conversion funnel steps, or device type.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  options
 Method parameters: 
   param name: options | type: ListSessionsAsyncOptions  none | required: true 
    - ONE-OF: - required: true
     - name: customTimePeriod | type: CustomTimePeriod | description: Custom time period with start & end dates.  
        - name: startDate | type: string | description: Custom period start date in provided timezone.  | validation: format LOCAL_DATE
        - name: endDate | type: string | description: Custom period end date in provided timezone. Returned data will include all dates until the requested end date. For example, { startDate: '2024-01-01', endDate: '2024-01-03' } will return data for '2024-01-01' and '2024-01-02'  | validation: format LOCAL_DATE
     - name: predefinedTimePeriod | type: PredefinedTimePeriod | description: Predefined time period.  
         - enum:
         -     TODAY: Today.
         -     YESTERDAY: Yesterday.
         -     LAST_7_DAYS: Last 7 days.
         -     LAST_14_DAYS: Last 14 days.
         -     LAST_30_DAYS: Last 30 days.
         -     LAST_90_DAYS: Last 90 days.
         -     LAST_28_DAYS: Last 28 days.
         -     LAST_180_DAYS: Last 180 days.
         -     LAST_365_DAYS: Last 365 days.
         -     THIS_WEEK: Current week, starting on Monday.
         -     THIS_MONTH: Current month.
         -     THIS_QUARTER: Current quarter.
         -     THIS_YEAR: This year.
         -     LAST_WEEK: Last week (previous week).
         -     LAST_MONTH: Last month.
         -     LAST_QUARTER: Last quarter.
         -     LAST_YEAR: Last year.
         -     LAST_12_MONTHS: Last 12 months.
     - name: navigationFlow | type: NavigationFlowSessionsParams | description: Navigation flow details.  
        - name: pageInteractions | type: array<string> | description: Page interactions, including where the user dropped off. For example: - ["/{Homepage}", "__DROP__"]: Sessions where a user visited the site's homepage and then dropped off. - ["", "__DROP__"]: Sessions where a user visited (any page) and then dropped off. - ["", "", "__DROP__"]: Session where a user visited any page, then navigated to any page, and then dropped off.  | validation: minItems 1, maxItems 5, maxLength 255
     - name: conversionFunnel | type: ConversionFunnelSessionsParams | description: Conversion funnel details. The steps in the journey the visitor has taken on the site.  
        - name: include | type: FunnelStep | description: Funnel step to include.  
             - enum:
             -     NOT_SELECTED_FUNNEL_STEP: Not selected.
             -     SITE_SESSIONS: Site sessions.
             -     VIEWED_PRODUCT: Viewed product.
             -     ADDED_TO_CART: Added to cart.
             -     REACHED_CHECKOUT: Reached checkout.
             -     SESSIONS_CONVERTED: Sessions converted.
        - name: exclude | type: FunnelStep | description: Funnel step to exclude.  
     - name: deviceType | type: SessionsByDeviceParams | description: Device type.  
        - name: type | type: DeviceType | description: Device type.  
             - enum:
             -     NOT_SELECTED_DEVICE_TYPE: Not selected.
             -     DESKTOP: Desktop.
             -     MOBILE: Mobile.
             -     TABLET: Tablet.
             -     ALL: All.
        - name: timezone | type: string | description: User's timezone. Defaults to timezone as set in the [Site Properties API](https://dev.wix.com/docs/rest/business-management/site-properties/properties/properties-object.md).  | validation: maxLength 100
 Return type: PROMISE<ListSessionsAsyncResponse>
  - name: jobId | type: string | description: List sessions job GUID. Pass this GUID to Get List Sessions Job Result to retrieve job details and metadata.  | validation: format GUID


```

### Examples

### listSessionsAsync
```javascript
import { analyticsSession } from '@wix/analytics-session';

async function listSessionsAsync(options) {
  const response = await analyticsSession.listSessionsAsync(options);
};
```

### listSessionsAsync (with elevated permissions)
```javascript
import { analyticsSession } from '@wix/analytics-session';
import { auth } from '@wix/essentials';

async function myListSessionsAsyncMethod(options) {
  const elevatedListSessionsAsync = auth.elevate(analyticsSession.listSessionsAsync);
  const response = await elevatedListSessionsAsync(options);
}
```

### listSessionsAsync (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { analyticsSession } from '@wix/analytics-session';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { analyticsSession },
  // Include the auth strategy and host as relevant
});


async function listSessionsAsync(options) {
  const response = await myWixClient.analyticsSession.listSessionsAsync(options);
};
```

---