> ## 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 AiChannelSessions

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

An AiChannelSession is one conversation between a contact and the AI, on whichever channel it happened — the web chat widget, email, WhatsApp or a voice call. It links to a Coworker when the contact is a member, and otherwise identifies them by ExternalIdentifier. The transcript lives in OpenAiChatMessage records sharing this record’s ChatSession GUID. Custom fields named Nexudus.Ai.VisitorId, Nexudus.Ai.CoworkerId, Nexudus.Ai.CoworkerContractId, Nexudus.Ai.CoworkerProductId and Nexudus.Ai.BookingId record what the conversation produced, so they are how you tell which conversations converted into a tour, a signup, a contract, a day pass or a booking. This entity is read-only: conversations are written by the inbound message pipeline and the proactive outreach engine, never by hand.

## 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 **`AiChannelSession-List`** role.
</Note>

## Enums

<Accordion title="eAiEscalationStatus — EscalationStatus values">
  | Value | Name     |
  | ----- | -------- |
  | 1     | Pending  |
  | 2     | Active   |
  | 3     | Resolved |
</Accordion>

## 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="AiChannelSession_Business" type="integer">
  Filter by iD of the location that owns this conversation. Set from the location the inbound message arrived at, or from the location whose agent started the outreach..
</ParamField>

<ParamField query="AiChannelSession_Coworker" type="integer">
  Filter by iD of the customer this conversation is with. Empty when the contact is not a member yet, in which case ExternalIdentifier holds their email address or phone number..
</ParamField>

<ParamField query="AiChannelSession_Coworker_CoworkerType" type="string">
  Filter by display value for Coworker.CoworkerType..
</ParamField>

<ParamField query="AiChannelSession_Coworker_FullName" type="string">
  Filter by display value for Coworker.FullName..
</ParamField>

<ParamField query="AiChannelSession_Coworker_MobilePhone" type="string">
  Filter by display value for Coworker.MobilePhone..
</ParamField>

<ParamField query="AiChannelSession_Coworker_LandLine" type="string">
  Filter by display value for Coworker.LandLine..
</ParamField>

<ParamField query="AiChannelSession_Coworker_BillingName" type="string">
  Filter by display value for Coworker.BillingName..
</ParamField>

<ParamField query="AiChannelSession_Coworker_CompanyName" type="string">
  Filter by display value for Coworker.CompanyName..
</ParamField>

<ParamField query="AiChannelSession_Coworker_TeamNames" type="string">
  Filter by display value for Coworker.TeamNames..
</ParamField>

<ParamField query="AiChannelSession_Channel" type="string">
  Filter by channel the conversation runs on, stored as text: Chat for the web widget, Email, WhatsApp or Voice for inbound contact; proactive outreach also writes CoworkerMessage and HelpDesk. Determines how ExternalIdentifier is interpreted..
</ParamField>

<ParamField query="AiChannelSession_ExternalIdentifier" type="string">
  Filter by how the outside contact is addressed on this channel: an email address for Email, a phone number for WhatsApp and Voice. It is how a conversation is matched to an incoming reply, and how dormant non-member leads are followed up..
</ParamField>

<ParamField query="AiChannelSession_ChatSession" type="string">
  Filter by gUID that groups the conversation’s messages. Every OpenAiChatMessage in this conversation carries the same value, so it is the key to reading the transcript..
</ParamField>

<ParamField query="AiChannelSession_ExternalThreadId" type="string">
  Filter by threading key from the channel provider — the email In-Reply-To/References header, or the WhatsApp conversation ID — used to attach later replies to this same conversation..
</ParamField>

<ParamField query="AiChannelSession_LastActivityUtc" type="string">
  Filter by uTC time of the most recent message in either direction. Drives conversation ordering, session expiry, and the dormant-lead follow-up agent..
</ParamField>

<ParamField query="AiChannelSession_Subject" type="string">
  Filter by conversation subject, taken from the first email or inferred from the opening messages. On the Email channel a different subject from the same address starts a new conversation rather than continuing this one..
</ParamField>

<ParamField query="AiChannelSession_EscalationStatus" type="integer">
  Filter by how far this conversation has been handed over to a person: None while the AI is handling it alone; Pending once the AI escalates and a help desk ticket is waiting; Active once someone comments on that ticket or an operator takes the thread; Resolved when the ticket is closed..
</ParamField>

### Range Filters

<ParamField query="from_AiChannelSession_LastActivityUtc" type="string">
  Filter by uTC time of the most recent message in either direction. Drives conversation ordering, session expiry, and the dormant-lead follow-up agent. greater than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

<ParamField query="to_AiChannelSession_LastActivityUtc" type="string">
  Filter by uTC time of the most recent message in either direction. Drives conversation ordering, session expiry, and the dormant-lead follow-up agent. less than or equal to this value. Format: `YYYY-MM-DDTHH:mm`.
</ParamField>

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

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

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

<ParamField query="to_AiChannelSession_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/sys/aichannelsessions?page=1&size=15&orderBy=Channel&dir=0" \
    -H "Authorization: Bearer YOUR_TOKEN"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/aichannelsessions?' + new URLSearchParams({
      page: 1,
      size: 15,
      orderBy: 'Channel',
      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/sys/aichannelsessions',
      params={
          'page': 1,
          'size': 15,
          'orderBy': 'Channel',
          'dir': 0 // Ascending
      },
      headers={
          'Authorization': 'Bearer YOUR_TOKEN'
      }
  )

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

### Filtering by Channel

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

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://spaces.nexudus.com/api/sys/aichannelsessions?' + new URLSearchParams({
      AiChannelSession_Channel: 'example-value',
      orderBy: 'Channel',
      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/sys/aichannelsessions',
      params={
          'AiChannelSession_Channel': 'example-value',
          'orderBy': 'Channel',
          '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/sys/aichannelsessions?from_AiChannelSession_UpdatedOn=2025-01-01T00:00&to_AiChannelSession_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/sys/aichannelsessions?' + new URLSearchParams({
      from_AiChannelSession_UpdatedOn: '2025-01-01T00:00',
      to_AiChannelSession_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/sys/aichannelsessions',
      params={
          'from_AiChannelSession_UpdatedOn': '2025-01-01T00:00',
          'to_AiChannelSession_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="AiChannelSession[]">
  The list of AiChannelSession records matching the query. See the [Get one AiChannelSession](/rest-api/sys/get-aichannelsessions-by-id) endpoint for the full list of properties returned for each record.
</ResponseField>

<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,
      "CoworkerId": null,
      "CoworkerCoworkerType": null,
      "CoworkerFullName": null,
      "CoworkerMobilePhone": null,
      "CoworkerLandLine": null,
      "CoworkerBillingName": null,
      "CoworkerCompanyName": null,
      "CoworkerTeamNames": null,
      "Channel": "",
      "ExternalIdentifier": "",
      "ChatSession": null,
      "ExternalThreadId": null,
      "LastActivityUtc": null,
      "Subject": null,
      "EscalationStatus": 0,
      "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": "AiChannelSession Example",
      "LocalizationDetails": null,
      "CustomFields": null
    }
  ],
  "CurrentPageSize": 15,
  "CurrentPage": 1,
  "CurrentOrderField": "Channel",
  "CurrentSortDirection": 1,
  "FirstItem": 1,
  "HasNextPage": false,
  "HasPreviousPage": false,
  "LastItem": 1,
  "PageNumber": 1,
  "PageSize": 15,
  "TotalItems": 1,
  "TotalPages": 1
}
```
