> ## Documentation Index
>
> Fetch the complete documentation index at: [/llms.txt](https://docs.cognigy.com/llms.txt)
>
> Use this file to discover all available pages before exploring further.

[Skip to main content](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#content-area)

[Updated in 2025.25](https://docs.cognigy.com/release-notes/2025.25)

Live Agent has been put in maintenance mode. The product will continue to be maintained in the foreseeable future. Users can continue to fully rely on Live Agent being available. In future releases, only security updates and bug fixes will be provided; no new features will be released.

Live Agent exposes an OData 4 analytics endpoint to retrieve analytics records. [OData](https://www.odata.org/), the best way to REST, is a powerful API framework. The OData endpoints allow you to retrieve the most relevant data models from Live Agent by using GET requests. It covers all your enterprise analytics needs to make fine-grained queries in your spreadsheets or build rich dashboards for your bots with your favorite data visualization tool.The Live Agent OData endpoint supports only `GET` requests and doesn’t support any other request types, such as `PATCH`, `DELETE`, or `POST`.

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#supported-versions)  Supported Versions

| OData endpoint version | Live Agent version | Status | New in Version |
| --- | --- | --- | --- |
| 2.0 | 2025.25.0 and later | Supported | The Team and AgentAvailabilityRecord collections were added. A new field, `priority`, was added to the Conversation model, and the changes introduced in 1.1 were rolled back. |
| 1.1 | 2025.18.0 or later | Supported | Rollback to pre-1.0 fields: - **Restored fields**: Conversation (`identifier`, `contact_last_seen_at`), Inbox (`greeting_enabled`, `greeting_message`, `email_address`), Message (`status`, `source_id`), User (`encrypted_password`, `reset_password_token`, `reset_password_sent_at`, `remember_created_at`, `current_sign_in_ip`, `last_sign_in_ip`, `confirmation_token`) \- **No longer supported**: Conversation (`assigned_at`, `ended_at`), Label (`conversation_ids`), User (`last_sign_out_at`) |
| 1.0 | 1.0.0 and later | Supported | Initial release. |

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#usage-and-authentication)  Usage and Authentication

To connect to the OData endpoint, get a Live Agent Access Token:

1. In the left-side menu of the Live Agent interface, go to **Profile Settings**.
2. In the **Access Token** section, copy the existing token.
3. Paste this token into your OData request.

An OData URL is composed of the service root, API version, service path, data collection, and Live Agent access token parameter as follows:

```
GET /<api-version>/odata/<OData data model>?<odata query> HTTP/1.1
Host: <odata domain>
Authorization: Bearer <Live Agent access token>
```

The authentication can also be done using a query param such as follows:

```
/<api-version>/odata/<OData data model>?<odata query>&$top=1&$skip=0&apikey=<Live Agent access token>
```

OData Domain Name

The OData endpoint is available on a different domain from your Cognigy User Interface domain. For example, [https://odata-liveagent-trial.cognigy.ai/v1.0/odata](https://odata-dev-live-agent.cognigy.ai/v1.0/odata).For example, on our trial server, the OData endpoint URL for the Analytics Inputs Collection is `https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Message?`. For on-premises installations, replace the `odata-trial.cognigy.ai` domain name with the domain name configured for your local installation.

Excel/Power BI

When using Power BI or Excel, you might be asked to authenticate. Simply choose `anonymous authentication` and pass the Live Agent access token as a query parameter `&apikey=<Live Agent access-token>`

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#endpoint-versions)  Endpoint Versions

- Version 2.0

- Version 1.1

- Version 1.0

This endpoint version is available in Live Agent 2025.25.0 and later. In this version, the following OData collections are available:

- [Message](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#message) (`/Message`)
- [Conversation](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#conversation) (`/Conversation`)
- [Inbox](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#inbox) (`/Inbox`)
- [Reporting Event](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#reporting-event) (`/ReportingEvent`)
- [Label](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#label) (`/Label`)
- [User](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#user) (`/User`)
- [Team](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#team) (`/Team`)
- [Agent Availability Record](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#agentavailabilityrecord) (`/AgentAvailabilityRecord`)

To see all the available OData models, use the following Endpoint:
`https://<hostname>/v2.0/odata/`The URL for accessing the OData endpoint 2.0 is the following:
`https://<hostname>/v2.0/odata/<collection>`

This endpoint version is available in Live Agent 2025.18.0 or later. In this version, the following OData collections are available:

To see all the available OData models, use the following Endpoint:
`https://<hostname>/v1.1/odata/`The URL for accessing the OData endpoint 1.1 is the following:
`https://<hostname>/v1.1/odata/<collection>`

This endpoint version is available in Live Agent 1.0.0 and later. In this version, the following OData collections are available:

To see all the available OData models, use the following Endpoint:
`https://<hostname>/v1.0/odata/`The URL for accessing the OData endpoint 1.0 is the following:
`https://<hostname>/v1.0/odata/<collection>`

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#querying)  Querying

The Endpoint supports the following OData Query Language operators:

- `$skip`[1](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#footnote1)
- `$top`[1](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#footnote1)
- `$filter`
- `$select`
- `$orderby`
- `$expand`

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#example-queries)  Example Queries

- Version 2.0

- Version 1.1

- Version 1.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Conversation(1)?$select=inbox_id,account_id&$top=1&$skip=0&apikey=<access-token>`
Return the columns inbox\_id and account\_id for the Conversation with id=1.`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Conversation?$select=id,account_id&$top=1&$skip=0&apikey=<access-token>`
Return the columns’ ID and account\_id for all Conversations.`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Conversation?$select=id,account_id&$top=1&$skip=0&$filter=created_at le '2021-11-23T00:00:00'&$top=1&$skip=0&apikey=<access-token>`
Return the columns’ ID and account\_id for all the Conversations filtered by the created\_at column being lower or equal to ‘2021-11-23T00:00:00’

`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/Conversation(1)?$select=inbox_id,account_id&$top=1&$skip=0&apikey=<access-token>`
Return the columns inbox\_id and account\_id for the Conversation with id=1.`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/Conversation?$select=id,account_id&$top=1&$skip=0&apikey=<access-token>`
Return the columns’ ID and account\_id for all Conversations.`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/Conversation?$select=id,account_id&$top=1&$skip=0&$filter=created_at le '2021-11-23T00:00:00'&$top=1&$skip=0&apikey=<access-token>`
Return the columns’ ID and account\_id for all the Conversations filtered by the created\_at column being lower or equal to ‘2021-11-23T00:00:00’

`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Conversation(1)?$select=inbox_id,account_id&$top=1&$skip=0&apikey=<access-token>`
Return the columns inbox\_id and account\_id for the Conversation with id=1.`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Conversation?$select=id,account_id&$top=1&$skip=0&apikey=<access-token>`
Return the columns’ ID and account\_id for all Conversations.`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Conversation?$select=id,account_id&$top=1&$skip=0&$filter=created_at le '2021-11-23T00:00:00'&$top=1&$skip=0&apikey=<access-token>`
Return the columns’ ID and account\_id for all the Conversations filtered by the created\_at column being lower or equal to ‘2021-11-23T00:00:00’

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#reference-documentation)  Reference Documentation

For complete reference documentation, refer to the [extensive collection of resources at OData.org](https://www.odata.org/) and the [Oasis OData URL Convention Documentation](http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part2-url-conventions.html).

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#data-protection-&-analytics)  Data Protection & Analytics

Only users with an admin role in Live Agent will be able to query OData Models.

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#live-agent-odata-collections)  Live Agent OData Collections

This section details the data types that exist within the OData Collections that can be retrieved from the OData endpoint. The following Collections are available:

- [Message](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#message)
- [Conversation](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#conversation)
- [User](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#user)
- [Reporting Event](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#reporting-event)
- [Label](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#label)
- [Inbox](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#inbox)
- [Team](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#team)
- [Agent Availability Record](https://docs.cognigy.com/live-agent/tools/odata-endpoint/#AgentAvailabilityRecord)

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#message)  Message

**Description:**

- Version 2.0

- Version 1.1

- Version 1.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Message?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/Message?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Message?$top=1&$skip=0`

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

- Version 2.0

- Version 1.1

- Version 1.0

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | The unique message ID | Number | `9411` |
| `content` | The text content of the message | String | `"hi"` |
| `account_id` | The ID of the account where the conversation belongs | Number | `2` |
| `inbox_id` | The ID of the inbox where the conversation belongs | Number | `427` |
| `conversation_id` | The ID of the conversation to which this message belongs | Number | `1424` |
| `message_type` | The type of message: `{ incoming: 0, outgoing: 1, activity: 2, template: 3 }` | Number | `0` |
| `created_at` | The timestamp when the message was created | Date | `"2023-01-20T13:01:24.141Z"` |
| `updated_at` | The timestamp when the message was last updated | Date | `"2023-01-20T13:01:24.141Z"` |
| `private` | Indicates if the message is private (visible only to agents) | Boolean | `false` |
| `content_type` | The content type: `text: 0`, `input_text: 1`, `input_textarea: 2`, `input_email: 3` | Number | `0` |
| `content_attributes` | JSON object with additional content details, for example, items, external timestamps | JSON | `{"items":[{"text":"hi","data":null}],"external_created_at":1674219684}` |
| `sender_type` | The type of sender: `"Contact"`, `"Agent"`, or `"cognigy"` | String | `"Contact"` |
| `sender_id` | The unique ID of the sender | String | `"1045"` |

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique message ID | Number | 1 |
| `content` | The message sent | String | `Welcome to Live Agent` |
| `account_id` | Account ID | Number | 1 |
| `inbox_id` | Inbox ID | Number | 1 |
| `conversation_id` | Conversation ID | Number | 1 |
| `message_type` | Type of message `{ incoming: 0, outgoing: 1, activity: 2, template: 3 }` | Number | 3 |
| `created_at` | Message Creation Date | Date | `2023-01-19T13:31:18.553Z` |
| `updated_at` | Message Updated Date | Date | `2023-01-19T13:31:18.553Z` |
| `private` | Message Visibility | Boolean | false |
| `status` | Message Status `{ sent: 0, delivered: 1, read: 2, failed: 3 }` | Number | 3 |
| `source_id` | Message source ID | String | default |
| `content_type` | `text: 0`, `input_text: 1`, `input_textarea: 2`, `input_email: 3`, `input_select: 4`, `cards: 5`, `form: 6`, `article: 7`, `incoming_email: 8`, `input_csat: 9`, `typescognigy: 2016`, `request_file_upload: 2017` | Number | 0 |
| `content_attributes` | JSON Attribute/Value Definitions | JSON | `{"items":[{"title":"Acme Hardware"}]}` |
| `sender_type` | Provides information on who originated the message | String | `cognigy` |
| `sender_id` | Sender unique ID | Number | 1 |

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#conversation)  Conversation

**Description:**A Conversation is the communication channel opened between an Agent and a client.**Example Query:**

- Version 2.0

- Version 1.1

- Version 1.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Conversation?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/Conversation?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Conversation?$top=1&$skip=0`

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

- Version 2.0

- Version 1.1

- Version 1.0

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | The unique conversation ID | Number | `74160` |
| `account_id` | The account ID where the conversation belongs | Number | `2` |
| `inbox_id` | The inbox ID where the conversation belongs | Number | `34608` |
| `status` | The conversation status: open: 0, resolved: 1, pending: 2, snoozed: 3, abandoned: 4, deleted: 5 | Number | `2` |
| `assignee_id` | The agent ID assigned to the conversation | Number | `null` |
| `created_at` | The conversation creation date | Date | `"2023-12-08T13:39:57.528Z"` |
| `updated_at` | The date when the conversation was last updated | Date | `"2023-12-08T14:58:04.695Z"` |
| `contact_id` | The unique client ID | Number | `"42992"` |
| `display_id` | The display ID for the conversation | Number | `6133` |
| `agent_last_seen_at` | The last seen date of the agent | Date | `"2023-12-19T06:51:27.875Z"` |
| `contact_inbox_id` | The contact inbox ID | Number | `"117788"` |
| `last_activity_at` | The date of the last activity in the conversation | Date | `"2023-12-08T14:58:04.693Z"` |
| `team_id` | The team ID the conversation belongs to | Number | `null` |
| `snoozed_until` | The end date until which the conversation is snoozed | Date | `null` |
| `assignee_last_seen_at` | The last seen date of the assigned agent | Date | `null` |
| `first_reply_created_at` | The date when the first reply was created | Date | `null` |
| `assigned_at` | The date when the conversation was assigned | Date | `null` |
| `ended_at` | The date when the conversation ended | Date | `null` |
| `priority` | The priority of the conversation: low: 0, medium: 1, high: 2, urgent: 3, escalation: 4. | Number | `null` |
| `additional_attributes` | A JSON object containing any additional attributes | JSON | "" |
| `uuid` | The unique identifier | String | `"e41a989a-81c8-49f7-af64-9a85482c67da"` |
| `custom_attributes` | A JSON object containing extra add-on attributes | JSON | `{"enableAgentInject":false,"cognigy_channel_type":"admin-webchat","cognigy_agent_assist_workspace_url":"https://agent-assist-trial.cognigy.ai/?sessionId=session-a369b88c-03fb-4497-a60b-495b94313210&userId=4cc1adcf-df86-401d-86ff-4effd5e3c9b1&URLToken=1234"}` |
| `cognigy_session_id` | The unique session ID | String | `"session-a369b88c-03fb-4497-a60b-495b94313210"` |

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique conversation ID | Number | 1 |
| `account_id` | Account ID (where the conversation belongs) | Number | 1 |
| `inbox_id` | Inbox ID (where the conversation belongs) | Number | 1 |
| `status` | Conversation status: `{ open: 0, resolved: 1, pending: 2, snoozed: 3 }` | Number | 1 |
| `assignee_id` | Agent ID (assigned to the conversation) | Number | 1 |
| `created_at` | Conversation creation date | Date | `2023-01-19T13:31:18.553Z` |
| `updated_at` | Conversation updated date | Date | `2023-01-19T13:31:18.553Z` |
| `contact_id` | Client unique identification | Number | 3 |
| `display_id` | Display ID | Number | 3 |
| `contact_last_seen_at` | Contact/Client date last seen | Date | `2023-01-19T13:31:18.553Z` |
| `agent_last_seen_at` | Agent date last seen | Date | `2023-01-19T13:31:18.553Z` |
| `additional_attributes` | JSON containing any additional attributes | JSON | `{}` |
| `contact_inbox_id` | Contact Inbox ID | Number | 1 |
| `uuid` | Unique identifier | String | `89f20666-e17d-427c-9283-268ba7870283` |
| `identifier` | Identifier | String | `89f20666-e17d-427c-9283-268ba7870283` |
| `last_activity_at` | Last activity date | Date | `2023-01-19T13:31:18.553Z` |
| `team_id` | Team ID (belonging to the conversation) | Number | 1 |
| `snoozed_until` | Snoozed date end | Date | `2023-01-19T13:31:18.553Z` |
| `custom_attributes` | Extra add-on attributes | JSON | `{}` |
| `assignee_last_seen_at` | Date of last time the assignee has been seen | Date | `2023-01-19T13:31:18.553Z` |
| `cognigy_session_id` | Unique session ID | String | ”session-deedb62a-8062-490f-83ac-826de9ef94S3” |

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#inbox)  Inbox

**Description:**The Inbox is where all Conversations from a specific set of Agents will be placed.**Example Query:**

- Version 2.0

- Version 1.1

- Version 1.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Inbox?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/Inbox?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Inbox?$top=1&$skip=0`

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

- Version 2.0

- Version 1.1

- Version 1.0

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique Inbox record ID | Number | `3` |
| `channel_id` | The channel ID this Inbox is connected to | Number | `3` |
| `name` | Inbox name | String | `"cucumberTest_Project_by_template-default"` |
| `account_id` | Account ID that owns the Inbox | Number | `2` |
| `created_at` | Timestamp when the Inbox was created | String | `"2023-01-10T17:36:00.052Z"` |
| `updated_at` | Timestamp when the Inbox was last updated | String | `"2023-01-10T17:36:00.052Z"` |
| `channel_type` | Communication channel type, such as API, Webchat, Facebook (Meta) | String | `"Channel::Api"` |
| `enable_auto_assignment` | Whether conversations are automatically assigned to agents | Boolean | `true` |
| `working_hours_enabled` | Whether working hours scheduling is enabled | Boolean | `false` |
| `out_of_office_message` | Custom message displayed when outside working hours | String | `null` |
| `timezone` | Timezone of the Inbox | String | `"UTC"` |
| `enable_email_collect` | Whether email collection is enabled | Boolean | `true` |
| `csat_survey_enabled` | Whether CSAT survey is enabled | Boolean | `false` |
| `cognigy_organization_id` | Cognigy Organization ID | String | `null` |
| `cognigy_project_id` | Cognigy Project ID | String | `"63bda1ff4688585c8fa2ccae"` |
| `enable_auto_reassignment` | Whether conversations can be automatically reassigned | Boolean | `true` |
| `conversations_show_all` | Whether agents can see all conversations, even if not assigned to them | Boolean | `true` |

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique record ID | Number | 1 |
| `channel_id` | Channel ID | Number | 1 |
| `name` | Inbox name | String | `Welcome to Live Agent` |
| `email_address` | Email address | String | `ai-agent@cognigy.com` |
| `account_id` | Account ID | Number | 1 |
| `created_at` | Inbox creation date | Date | `2023-01-19T13:31:18.553Z` |
| `updated_at` | Inbox updated date | Date | `2023-01-19T13:31:18.553Z` |
| `channel_type` | Communication channel, for example, API, Webchat, Facebook (Meta) | String | `Channel:Webchat` |
| `enable_auto_assignment` | Feature that allows the agent to auto assign conversations | Boolean | `true` |
| `greeting_enabled` | Feature that allows an automatic greeting to be sent | Boolean | `false` |
| `greeting_message` | Automatic greeting message | String | `Hi there!` |
| `working_hours_enabled` | Feature that enables a working hours timetable | Boolean | `true` |
| `out_of_office_message` | Feature that enables a working hours timetable | Boolean | `true` |
| `timezone` | Inbox timezone | String | ”UTC” |
| `enable_email_collect` | Allows email collection | Boolean | `true` |
| `csat_survey_enabled` | Allows CSAT survey | Boolean | `true` |
| `cognigy_organization_id` | Cognigy account ID | String | 1 |
| `cognigy_project_id` | Cognigy Project ID | String | 1 |
| `enable_auto_reassignment` | Allows conversation reassignment | Boolean | `true` |
| `conversations_show_all` | Allows you to see all conversations in the Inbox, even if they don’t belong to you | Boolean | `true` |

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique record ID | Number | 1 |
| `channel_id` | Channel ID | Number | 1 |
| `name` | Inbox Name | String | `Welcome to Live Agent` |
| `account_id` | Account ID | Number | 1 |
| `created_at` | Inbox creation date | Date | `2023-01-19T13:31:18.553Z` |
| `updated_at` | Inbox updated date | Date | `2023-01-19T13:31:18.553Z` |
| `channel_type` | Communication channel, for example, API, Webchat, Facebook (Meta) | String | `Channel:Webchat` |
| `enable_auto_assignment` | Feature that allows the agent to auto assign conversations | Boolean | `true` |
| `working_hours_enabled` | Feature that enables a working hours timetable | Boolean | `true` |
| `out_of_office_message` | Feature that enables a working hours timetable | Boolean | `true` |
| `timezone` | Inbox Timezone | String | `UTC` |
| `enable_email_collect` | Allows email collection | Boolean | `true` |
| `csat_survey_enabled` | Allows CSAT survey | Boolean | `true` |
| `cognigy_organization_id` | Cognigy Account ID | String | 1 |
| `cognigy_project_id` | Cognigy Project ID | String | 1 |
| `enable_auto_reassignment` | Allows conversation reassignment | Boolean | `true` |
| `conversation_show_all` | Allows you to see all conversations in the Inbox, even if they don’t belong to you | Boolean | `true` |

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#label)  Label

**Description:**Labels are used to mark, identify, or group different Conversations.**Example Query:**

- Version 2.0

- Version 1.1

- Version 1.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Label?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/Label?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/Label?$top=1&$skip=0`

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

- Version 2.0

- Version 1.1

- Version 1.0

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | A unique label ID | String | `"1"` |
| `title` | The label title | String | `"qa-60"` |
| `description` | The label description | String | `"sadc"` |
| `color` | The label color in HEX format | String | `"#111113"` |
| `show_on_sidebar` | Indicates whether the label is shown on the sidebar | Boolean | `true` |
| `account_id` | The ID of the account to which the label belongs | String | `"2"` |
| `created_at` | The label creation timestamp | Date | `"2023-01-19T13:31:18.553Z"` |
| `updated_at` | The label last updated timestamp | Date | `"2023-09-18T12:34:19.579Z"` |
| `conversation_ids` | A list of conversation IDs associated with this label | Array of Numbers | `[77455, 78729, 79906, …]` |

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique label ID | Number | 1 |
| `title` | Label title | String | `label-complain` |
| `description` | Label description | String | `labels used for complains` |
| `color` | Label color | String | `red` |
| `show_on_sidebar` | Allows the label to be shown on the sidebar | Boolean | `true` |
| `account_id` | Account to which the label will belong | Number | 3 |
| `created_at` | Label creation date | Date | `2023-01-19T13:31:18.553Z` |
| `updated_at` | Label updated date | Date | `2023-01-19T13:31:18.553Z` |

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#reporting-event)  Reporting Event

**Description:**The Reporting Event model represents actions or occurrences tracked in the system for reporting and analytics purposes.**Example Query:**

- Version 2.0

- Version 1.1

- Version 1.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/ReportingEvent?$top=10&$skip=0`.

`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/ReportingEvent?$top=10&$skip=0`.

`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/ReportingEvent?$top=10&$skip=0`.

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique Reporting Event ID | Number | 4 |
| `event_start_time` | Start time of the event | Date | `2023-01-08T18:34:43.162Z` |
| `event_end_time` | End time of the event | Date | `2023-01-08T18:34:43.162Z` |
| `name` | Name of the event | String | `message_created`, `conversation_resolved`, `first_reply_created`, `assignee_changed`, `conversation_inbox_changed` |
| `value` | Value associated with the event, such as timestamp | Number | 1 |
| `created_at` | The date and time when the event was created | Date | `2023-01-08T18:34:43.213Z` |
| `updated_at` | The date and time when the event was last updated | Date | `2023-01-08T18:34:43.213Z` |
| `account_id` | ID of the account associated with the event | Number | 2 |
| `conversation_id` | ID of the conversation associated with the event | Number | 1 |
| `inbox_id` | ID of the inbox associated with the event | Number | 1 |
| `user_id` | ID of the user associated with the event | Number | 3 |

To avoid potential query timeouts due to large data volumes, use the `$top` query option to limit the number of returned records.

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#user)  User

**Description:**This data model stores information about Live Agent users.**Example Query:**

- Version 2.0

- Version 1.1

- Version 1.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/User?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.1/odata/User?$top=1&$skip=0`

`https://odata-liveagent-trial.cognigy.ai/v1.0/odata/User?$top=1&$skip=0`

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

- Version 2.0

- Version 1.1

- Version 1.0

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | A unique record ID | Number | `1` |
| `provider` | The provider, for example, email | String | `email` |
| `uid` | A provided unique identifier | String | `some-email@cognigy.com` |
| `confirmed_at` | The date when the confirmation token was confirmed | Date | `2021-12-11 12:41:26.745` |
| `confirmation_sent_at` | The date when the confirmation token was sent | Date | `2021-12-11 12:41:26.745` |
| `unconfirmed_email` | An unconfirmed email | String | `unconfirmed@cognigy.com` |
| `name` | The user’s name | String | `Francisco` |
| `display_name` | The user’s display name | String | `Paco` |
| `email` | The user’s email | String | `fran@cognigy.com` |
| `tokens` | The user’s tokens | JSON | `{"MN4iNP38tvwe5wer7pvpnAQ":{"token":"$2a$10$iA7Si0sBV9lMkO2mqvwiD.L90.uTCl27WQbEo/Kc0W","expiry":1644763988}}` |
| `created_at` | The date when the user was created | Date | `2021-12-11 12:41:26.745` |
| `updated_at` | The date when the user was last updated | Date | `2021-12-11 12:41:26.745` |
| `pubsub_token` | The user’s publish/subscribe token | String | `MiVxY3FKry6oklambiuqL72nn` |
| `availability` | The user’s availability | Number | 1 |
| `custom_attributes` | The user’s custom attributes | JSON | `{}` |
| `cognigy_user_id` | The Cognigy user ID | String | `610bEOk617uPiXy9L3HOq8nn6kdjJK2` |
| `sign_in_count` | The total number of times the user has logged in to Live Agent | Number | 3 |
| `current_sign_in_at` | The date and time of the user’s most recent login | Date | `2021-12-11 12:41:26.745` |
| `last_sign_in_at` | The date and time of the user’s last login | Date | `2021-12-11 12:41:26.745` |
| `last_sign_out_at` | The date and time of the user’s last logout from Live Agent | Date | `2021-12-11 12:41:26.745` |

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique record ID | Number | 1 |
| `provider` | For example, email | String | `email` |
| `uid` | Provided unique identifier | String | `some-email@cognigy.com` |
| `encrypted_password` | Encrypted password | String | `$2a$11$L.610bE0k617uÜiXy9L3H0q8nn6kdjJK2/X4p7ghlxPC38hjovasd` |
| `reset_password_token` | Token used to reset the password | String | `$2a$11$L.610bE0k617uÜiXy9L3H0q8nn6kdjJK2/X4p7ghlxPC38hjsvaru` |
| `reset_password_send_at` | Date when a password reset was sent | Date | `2021-12-11 12:41:26.745` |
| `remember_created_at` | Date of remember creation | Date | `2021-12-11 12:41:26.745` |
| `sign_in_count` | Number of times the user has signed in | Number | 3 |
| `current_sign_in_ip` | Current sign in IP address | String | `120.0.0.1` |
| `last_sign_in_ip` | Last sign in IP address | String | `120.0.0.1` |
| `confirmation_token` | Confirmation token | String | `$2a$11$L.610bE0k617uÜiXy9L3H0q8nn6kdjJK2/X4p7ghlxPC38hjovasd` |
| `confirmed_at` | Confirmation token confirmed at date | Date | `2021-12-11 12:41:26.745` |
| `confirmation_sent_at` | Confirmation token sent at date | Date | `2021-12-11 12:41:26.745` |
| `unconfirmed_email` | Unconfirmed email | String | `unconfirmed@cognigy.com` |
| `name` | User name | String | `Francisco` |
| `display_name` | User display name | String | `Paco` |
| `email` | User email | String | `fran@cognigy.com` |
| `tokens` | User tokens | JSON | `{"MN4iNP38tvwe5wer7pvpnAQ":{"token":"$2a$10$iA7Si0sBV9lMkO2mqvwiD.L90.uTCl27WQbEo/Kc0W","expiry":1644763988}}` |
| `created_at` | User creation date | Date | `2021-12-11 12:41:26.745` |
| `updated_at` | User updated date | Date | `2021-12-11 12:41:26.745` |
| `pubsub_token` | User publish/subscribe token | String | `MiVxY3FKry6oklambiuqL72nn` |
| `availability` | This represents the user’s availability | Number | 1 |
| `custom_attributes` | Custom attributes | JSON | `{}` |
| `cognigy_user_id` | Cognigy user ID | string | `610bEOk617uPiXy9L3HOq8nn6kdjJK2` |
| `sign_in_count` | The total number of times the user has logged in to Live Agent | Number | 3 |
| `current_sign_in_at` | The date and time of the user’s most recent login | Date | `2021-12-11 12:41:26.745` |
| `last_sign_in_at` | The date and time of the user’s login previous to the current one | Date | `2021-12-11 12:41:26.745` |

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | Unique record ID | Number | 1 |
| `provider` | For example, email | String | `email` |
| `uid` | Provided unique identifier | String | `some-email@cognigy.com` |
| `confirmed_at` | Confirmation token confirmed at date | Date | `2021-12-11 12:41:26.745` |
| `confirmation_sent_at` | Confirmation token sent at date | Date | `2021-12-11 12:41:26.745` |
| `unconfirmed_email` | Unconfirmed email | String | `unconfirmed@cognigy.com` |
| `name` | User name | String | `Francisco` |
| `display_name` | User display name | String | `Paco` |
| `email` | User email | String | `fran@cognigy.com` |
| `tokens` | User tokens | JSON | `{"MN4iNP38tvwe5wer7pvpnAQ":{"token":"$2a$10$iA7Si0sBV9lMkO2mqvwiD.L90.uTCl27WQbEo/Kc0W","expiry":1644763988}}` |
| `created_at` | User creation date | Date | `2021-12-11 12:41:26.745` |
| `updated_at` | User updated date | Date | `2021-12-11 12:41:26.745` |
| `pubsub_token` | User publish/subscribe token | String | `MiVxY3FKry6oklambiuqL72nn` |
| `availability` | This represents the user’s availability | Number | 1 |
| `custom_attributes` | Custom attributes | JSON | `{}` |
| `cognigy_user_id` | Cognigy user ID | string | `610bEOk617uPiXy9L3HOq8nn6kdjJK2` |
| `sign_in_count` | The total number of times the user has logged in to Live Agent | Number | 3 |
| `current_sign_in_at` | The date and time of the user’s most recent login | Date | `2021-12-11 12:41:26.745` |
| `last_sign_in_at` | The date and time of the user’s login previous to the current one | Date | `2021-12-11 12:41:26.745` |
| `last_sign_out_at` | The date and time of the user’s last logout from Live Agent | Date | `2021-12-11 12:41:26.745` |

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#team)  Team

**Description:**This data model stores information about Live Agent teams.**Example Query:**

- Version 2.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/Team?$top=1&$skip=0`

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | The unique ID of the team | String | `"9"` |
| `name` | The name of the team | String | `"customer support team"` |
| `description` | A description of the team | String | `"for urgent user requests"` |
| `allow_auto_assign` | Whether conversations can be automatically assigned to the team | Boolean | `true` |
| `account_id` | The account ID the team belongs to | String | `"2"` |
| `created_at` | The timestamp when the team was created | String | `"2025-12-08 12:41:26.745"` |
| `updated_at` | The timestamp when the team was last updated | String | `"2025-12-08 12:41:26.745"` |
| `members` | An array of user entities | Array | `[...]` |
| `members.id` | The member ID (internal Live Agent ID) | Number | `57` |
| `members.provider` | The authentication provider | String | `"cognigy"` |
| `members.uid` | The user UID from the provider | String | `"63ca7c200d733defd7512584"` |
| `members.confirmed_at` | The timestamp when the user confirmed their account | String | `"2025-12-08 12:41:26.745"` |
| `members.confirmation_sent_at` | The timestamp when the confirmation was sent | String | `null` |
| `members.unconfirmed_email` | The email pending confirmation | String | `null` |
| `members.name` | The full name of the user | String | `"John Doe"` |
| `members.display_name` | The display name used in the UI | String | `"John"` |
| `members.email` | The email address | String | `"john.doe@example.com"` |
| `members.tokens` | Authentication tokens | String | `null` |
| `members.created_at` | The timestamp when the user was created | String | `"2025-12-08 12:41:26.745"` |
| `members.updated_at` | The timestamp when the user was last updated | String | `"2025-12-08 12:41:26.745"` |
| `members.pubsub_token` | The token for real-time updates | String | `"a5DXd5Q84djArRReTNfavEZk"` |
| `members.availability` | The user availability status (`0 = offline`) | Number | `0` |
| `members.custom_attributes` | Custom attributes in JSON format | String | `"{}"` |
| `members.cognigy_user_id` | The user ID from Cognigy.AI | String | `"63ca7c200d733eefd7512584"` |
| `members.sign_in_count` | The number of times the user signed in | Number | `17` |
| `members.current_sign_in_at` | The timestamp of the current login session | String | `"2025-12-08 12:41:26.745"` |
| `members.last_sign_in_at` | The timestamp of the last login | String | `"2025-12-08 12:41:26.745"` |
| `members.last_sign_out_at` | The timestamp of the last logout | String | `"2025-12-08 12:41:26.745"` |

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#agentavailabilityrecord)  AgentAvailabilityRecord

**Description:**This data model stores information about agent availability in Live Agent.**Example Query:**

- Version 2.0

`https://odata-liveagent-trial.cognigy.ai/v2.0/odata/AgentAvailabilityRecord?$top=1&$skip=0`

**Data Types:**When retrieving this data model, the endpoint returns the following fields:

| Field Name | Description | Type | Example |
| --- | --- | --- | --- |
| `id` | The unique ID of the availability record | String | `"1"` |
| `availability` | The agent’s availability status (`0 = online`, `1 = offline`, `2 = busy`, `3 = away`) | Number | `0` |
| `created_at` | The timestamp when the record was created | ISO 8601 String | `"2025-12-03T09:22:32.760Z"` |
| `updated_at` | The timestamp when the record was last updated | ISO 8601 String | `"2025-12-03T09:22:32.760Z"` |
| `account_id` | The ID of the account the agent belongs to | String | `"2"` |
| `user_id` | The ID of the user (agent) | String | `"8953"` |

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#integrations)  Integrations

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#excel)  Excel

When connecting from Microsoft Excel 2016, you must use the Power Query feature, which can be found under **Data > Get & Transform > New Query > From Other Sources > From OData Feed**. This will connect to our OData 4 feed.

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#power-bi)  Power BI

Follow the [instructions in the Power BI documentation](https://docs.microsoft.com/en-us/power-bi/desktop-connect-odata).

### [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#tableau)  Tableau

Cognigy.AI supports OData 4.0, which implies that certain versions of Tableau aren’t compatible.

Find instructions on how to connect an OData Feed in the [Tableau documentation](https://help.tableau.com/current/pro/desktop/en-gb/examples_odata.htm).

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#odata-consumer-ecosystem)  OData Consumer Ecosystem

For a full list of available OData Consumer options, [follow the link to Consumers on OData.org](https://www.odata.org/ecosystem/#consumers).

## [​](https://docs.cognigy.com/live-agent/tools/odata-endpoint/\#client-libraries-in-net-java-javascript-c++-and-other-platforms)  Client Libraries in .NET, Java, JavaScript, C++, and Other Platforms

For a full list of available OData Libraries, [see the latest directory of available libraries on OData.org](https://www.odata.org/libraries/).

* * *

1: This parameter is required to make a request to the Live Agent OData endpoint.

Last modified onJuly 14, 2026

[Previous](https://docs.cognigy.com/live-agent/reports/admin/teams) [OverviewOverview of Cognigy Live Agent settings, including team management, inbox configuration, automation rules, canned responses, and account settings.\\
\\
Next](https://docs.cognigy.com/live-agent/settings/overview)

Ctrl+I

ChatVoice

Click the call button to start talking.

Cognigy AssistantReady to talk

Connecting…

Powered by [Cognigy.AI](/content/site-root.html)

### Cookie Consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for.

With your consent, you're helping us make our documentation better.
To find out more about the cookies we use, see our
[Privacy Policy](/content/privacy-policy/index.html).

Accept

';
 cachedClickBlockingCode = css + js;
 return cachedClickBlockingCode;
 }

// Helper: Inject click-blocking code into iframe
 function injectClickBlocking(iframeDoc) {
 if (!iframeDoc \|\| !iframeDoc.head) return false;

try {
 const style = iframeDoc.createElement('style');
 style.textContent = 'a,button,input,select,textarea,\[onclick\],\[role="button"\],input\[type="button"\],input\[type="submit"\],\[href\],\[tabindex\]:not(\[tabindex="-1"\]){pointer-events:none!important;cursor:default!important}a:hover,button:hover{cursor:default!important;opacity:0.7!important}';
 iframeDoc.head.appendChild(style);

const script = iframeDoc.createElement('script');
 script.textContent = '(function(){var preventClick=function(e){e.preventDefault();e.stopPropagation();e.stopImmediatePropagation();return false;};document.addEventListener("click",preventClick,true);document.addEventListener("mousedown",preventClick,true);document.addEventListener("mouseup",preventClick,true);document.addEventListener("touchstart",preventClick,true);document.addEventListener("touchend",preventClick,true);document.addEventListener("contextmenu",preventClick,true);window.addEventListener("beforeunload",function(e){e.preventDefault();e.returnValue="";return "";},true);try{Object.defineProperty(window,"location",{value:{href:"#",replace:function(){},assign:function(){}},writable:false,configurable:false});}catch(e){}var originalPushState=history.pushState;history.pushState=function(){return false;};var originalReplaceState=history.replaceState;history.replaceState=function(){return false;};var originalOpen=window.open;window.open=function(){return null;};var allElements=document.querySelectorAll("\*");for(var i=0;i 0 \|\| replacedViewers.length > 0) {
 const currentUrl = window.location.href;
 if (!processedUrls.has(currentUrl)) {
 processedUrls.add(currentUrl);
 lastUrl = currentUrl;
 }
 return;
 }

const currentUrl = window.location.href;
 if (currentUrl === lastUrl && lastUrl !== null && processedUrls.has(currentUrl)) {
 return;
 }

// Optimized: Use cached viewer query
 const viewers = getUninitializedViewers();

if (viewers.length === 0) {
 if (periodicCheckInterval) {
 clearInterval(periodicCheckInterval);
 periodicCheckInterval = null;
 }
 return;
 }

// Final safety check
 if (viewers.length > 0) {
 if (currentUrl === lastUrl && lastUrl !== null && processedUrls.has(currentUrl)) {
 viewers.forEach(function(viewer) {
 viewer.setAttribute('data-initialized', 'true');
 });
 return;
 }

if (currentUrl === lastUrl && lastUrl !== null) {
 if (existingContainers.length > 0) {
 processedUrls.add(currentUrl);
 viewers.forEach(function(viewer) {
 viewer.setAttribute('data-initialized', 'true');
 });
 return;
 }
 }
 }

isInitializing = true;
 let processedAny = false;

// Optimized: Process viewers in batch
 viewers.forEach(function(viewer) {
 if (processedElements.has(viewer) \|\| viewer.hasAttribute('data-initialized')) {
 return;
 }

if (viewer.closest('.single-page-viewer-container')) {
 return;
 }

if (!viewer.parentNode) {
 return;
 }

const isInContentArea = contentArea === document.body \|\| contentArea.contains(viewer);
 if (!isInContentArea) {
 return;
 }

const src = viewer.getAttribute('data-src');
 const hint = viewer.getAttribute('data-hint') \|\| '';
 const defaultZoom = parseFloat(viewer.getAttribute('data-zoom')) \|\| DEFAULT\_ZOOM;
 const dataHeight = viewer.getAttribute('data-height');
 const height = dataHeight ? parseFloat(dataHeight) : null;

if (!src) {
 // Don't set isInitializing = false here - it affects all viewers in the loop
 return;
 }

processedElements.add(viewer);
 viewer.setAttribute('data-initialized', 'true');

let zoom = defaultZoom;

// Optimized: Use document fragment for DOM construction
 const fragment = document.createDocumentFragment();
 const container = document.createElement('div');
 container.className = 'single-page-viewer-container';

const wrapper = document.createElement('div');
 wrapper.className = 'single-page-viewer-wrapper';

const controlsBar = document.createElement('div');
 controlsBar.className = 'single-page-viewer-controls';

if (hint) {
 const hintDiv = document.createElement('div');
 hintDiv.className = 'single-page-viewer-hint';
 hintDiv.innerHTML = '' \+ hint + '';
 controlsBar.appendChild(hintDiv);
 }

const iframeWrapper = document.createElement('div');
 iframeWrapper.className = 'single-page-viewer-iframe-wrapper';
 iframeWrapper.\_scrollHandlerAdded = false;

// Optimized: Get height without temporary DOM manipulation
 const baseHeightFromCSS = height \|\| NORMAL\_HEIGHT;

const scaleDiv = document.createElement('div');
 scaleDiv.className = 'single-page-viewer-scale';
 const initialHeight = baseHeightFromCSS;
 scaleDiv.style.cssText = 'transform: scale(' + zoom + '); transform-origin: top left; width: ' + (100 / zoom) + '%; height: ' + initialHeight + 'px; transition: transform 0.2s ease;';

const iframe = document.createElement('iframe');
 let iframeSrc = src;
 if (iframeSrc && !iframeSrc.startsWith('http') && !iframeSrc.startsWith('//')) {
 if (!iframeSrc.startsWith('/')) {
 iframeSrc = '/' + iframeSrc;
 }
 }

iframe.title = 'Single Page Viewer';
 iframe.className = 'single-page-viewer-iframe';
 iframe.style.width = '100%';
 iframe.style.height = initialHeight + 'px';
 iframe.loading = 'lazy';
 iframe.setAttribute('scrolling', 'no');
 iframe.setAttribute('sandbox', 'allow-same-origin allow-scripts allow-forms allow-popups allow-modals');

const clickBlocker = document.createElement('div');
 clickBlocker.className = 'single-page-viewer-click-blocker';

if (iframeSrc.endsWith('.html') && !iframeSrc.startsWith('http')) {
 fetch(iframeSrc)
 .then(function(response) {
 return response.text().then(function(htmlContent) {
 if (htmlContent.includes('Page Not Found') \|\|
 (htmlContent.includes('\_\_next') && htmlContent.includes('mintlify') && !htmlContent.includes('Page saved with SingleFile'))) {
 throw new Error('Received 404 page instead of HTML file.');
 }
 const blockingCode = getClickBlockingCode();
 if (htmlContent.includes('')) {
 htmlContent = htmlContent.replace('', blockingCode + '');
 } else if (htmlContent.includes('')) {
 htmlContent = htmlContent.replace('', '' + blockingCode);
 } else {
 if (htmlContent.includes('')) {
 htmlContent = htmlContent.replace('', '' + blockingCode + '');
 } else {
 htmlContent = blockingCode + htmlContent;
 }
 }
 iframe.srcdoc = htmlContent;
 });
 });
 } else {
 iframe.src = iframeSrc;
 }

iframe.addEventListener('load', function() {
 setTimeout(function() {
 updateIframeDimensions(iframeWrapper, scaleDiv, iframe, zoom);
 }, 100);

try {
 const iframeDoc = iframe.contentDocument \|\| iframe.contentWindow.document;
 injectClickBlocking(iframeDoc);
 } catch (e) {
 // Cross-origin iframe - cannot block clicks
 }
 }, { once: true });

iframe.addEventListener('error', function() {
 // Iframe failed to load - error handling is silent
 }, { once: true });

scaleDiv.appendChild(iframe);
 iframeWrapper.appendChild(scaleDiv);
 if (!iframeSrc.endsWith('.html') \|\| iframeSrc.startsWith('http')) {
 iframeWrapper.appendChild(clickBlocker);
 }

if (hint) {
 wrapper.appendChild(controlsBar);
 }
 wrapper.appendChild(iframeWrapper);
 container.appendChild(wrapper);
 fragment.appendChild(container);

try {
 if (viewer.parentNode) {
 if (viewer === contentArea \|\| viewer.id === 'content-area') {
 isInitializing = false;
 return;
 }

const viewerId = 'viewer-' + Date.now() + '-' + Math.random().toString(36).slice(2, 11);
 viewer.id = viewerId;
 viewer.setAttribute('data-viewer-id', viewerId);
 container.setAttribute('data-viewer-id', viewerId);

// Optimized: Single DOM insertion using fragment
 if (viewer.nextSibling) {
 viewer.parentNode.insertBefore(fragment, viewer.nextSibling);
 } else {
 viewer.parentNode.appendChild(fragment);
 }

// Batch style updates
 Object.assign(viewer.style, {
 display: 'none',
 visibility: 'hidden',
 position: 'absolute',
 width: '1px',
 height: '1px',
 overflow: 'hidden',
 opacity: '0',
 pointerEvents: 'none',
 margin: '0',
 padding: '0'
 });

viewer.setAttribute('data-initialized', 'true');
 viewer.setAttribute('data-viewer-replaced', 'true');

processedAny = true;
 invalidateQueryCache();

requestAnimationFrame(function() {
 updateIframeDimensions(iframeWrapper, scaleDiv, iframe, zoom);
 });
 }
 } catch (e) {
 isInitializing = false;
 return;
 }
 });

if (processedAny) {
 const currentUrl = window.location.href;
 processedUrls.add(currentUrl);
 lastUrl = currentUrl;
 invalidateQueryCache();
 }

isInitializing = false;
 }

// Wait for content area to be available
 function waitForContentArea(callback, maxAttempts, attempt) {
 attempt = attempt \|\| 0;
 maxAttempts = maxAttempts \|\| 20;

const contentArea = document.querySelector('#content-area') \|\| document.querySelector('.mdx-content');

if (contentArea && document.contains(contentArea)) {
 cachedContentArea = contentArea;
 callback();
 } else if (attempt < maxAttempts) {
 setTimeout(function() {
 waitForContentArea(callback, maxAttempts, attempt + 1);
 }, 500);
 } else {
 cachedContentArea = document.body;
 callback();
 }
 }

// Optimized: Initialize with better state management
 function initialize() {
 const currentUrl = window.location.href;
 if (lastUrl !== currentUrl && lastUrl !== null) {
 lastUrl = currentUrl;
 processedUrls.clear();
 invalidateQueryCache();
 }

if (typeof window !== 'undefined') {
 window.\_\_lastFullUrl = window.location.href;
 }

if (lastThemeClass === null && document.documentElement) {
 lastThemeClass = document.documentElement.className;
 }

if (!themeObserver && document.documentElement) {
 themeObserver = new MutationObserver(function(mutations) {
 for (let i = 0; i < mutations.length; i++) {
 const mutation = mutations\[i\];
 if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
 const currentThemeClass = document.documentElement.className;
 if (lastThemeClass !== null && lastThemeClass !== currentThemeClass) {
 themeToggleInProgress = true;

// Optimized: Lock containers synchronously
 const contentArea = getContentArea();
 if (contentArea) {
 const containers = getContainers(true);
 containers.forEach(function(container) {
 if (container.getAttribute('data-position-locked') !== 'true') {
 const rect = container.getBoundingClientRect();
 Object.assign(container.style, {
 position: 'fixed',
 top: rect.top + 'px',
 left: rect.left + 'px',
 width: rect.width + 'px',
 zIndex: '9999',
 margin: '0'
 });
 container.setAttribute('data-position-locked', 'true');
 containerPositions.set(container, {
 top: rect.top,
 left: rect.left,
 width: rect.width,
 height: rect.height
 });
 }
 });
 }

let repositionAttempts = 0;
 const maxRepositionAttempts = 30;

const repositionInterval = setInterval(function() {
 repositionAttempts++;
 repositionContainersAfterThemeToggleCore(); // Use core function for immediate repositioning
 if (repositionAttempts >= maxRepositionAttempts) {
 clearInterval(repositionInterval);
 }
 }, 100);

setTimeout(function() {
 clearInterval(repositionInterval);
 themeToggleInProgress = false;
 repositionContainersAfterThemeToggleCore(); // Use core function for final repositioning
 unlockContainers();
 }, 3000);
 }
 lastThemeClass = currentThemeClass;
 }
 }
 });

themeObserver.observe(document.documentElement, {
 attributes: true,
 attributeFilter: \['class'\]
 });
 }

if (typeof MutationObserver !== 'undefined') {
 setupObserver();
 }

waitForContentArea(function() {
 setTimeout(function() {
 initSinglePageViewers();
 setTimeout(function() {
 const remaining = getUninitializedViewers(true);
 if (remaining.length > 0) {
 initSinglePageViewers();
 }
 }, INIT\_DELAY);
 }, INIT\_DELAY);
 });
 }

// Optimized: Lock/unlock containers
 function lockContainersInPlace() {
 const contentArea = getContentArea();
 if (!contentArea) return;

const containers = getContainers(true);
 containerPositions.clear();

requestAnimationFrame(function() {
 containers.forEach(function(container) {
 if (container.getAttribute('data-position-locked') !== 'true') {
 const rect = container.getBoundingClientRect();
 Object.assign(container.style, {
 position: 'fixed',
 top: rect.top + 'px',
 left: rect.left + 'px',
 width: rect.width + 'px',
 zIndex: '9999',
 margin: '0'
 });
 container.setAttribute('data-position-locked', 'true');
 containerPositions.set(container, {
 top: rect.top,
 left: rect.left,
 width: rect.width,
 height: rect.height
 });
 }
 });
 });
 }

function unlockContainers() {
 const contentArea = getContentArea();
 if (!contentArea) return;

const containers = Array.from(
 contentArea.querySelectorAll('.single-page-viewer-container\[data-position-locked="true"\]')
 );

containers.forEach(function(container) {
 Object.assign(container.style, {
 position: '',
 top: '',
 left: '',
 width: '',
 zIndex: '',
 margin: ''
 });
 container.removeAttribute('data-position-locked');
 // Clean up container position from Map to prevent memory leak
 containerPositions.delete(container);
 });

containerPositions.clear();
 }

// Optimized: Reposition containers with better DOM operations
 // Core repositioning function (not debounced for immediate use)
 function repositionContainersAfterThemeToggleCore() {
 const contentArea = getContentArea();
 if (!contentArea) return;

const containers = getContainers(true);

containers.forEach(function(container) {
 const viewerId = container.getAttribute('data-viewer-id');
 if (!viewerId) return;

let viewer = document.getElementById(viewerId);

if (!viewer) {
 const iframe = container.querySelector('iframe');
 if (iframe && iframe.src) {
 const allViewers = contentArea.querySelectorAll('\[data-single-page-viewer\]');
 for (let i = 0; i < allViewers.length; i++) {
 const v = allViewers\[i\];
 if (v.getAttribute('data-src') === iframe.src) {
 viewer = v;
 viewer.id = viewerId;
 viewer.setAttribute('data-viewer-id', viewerId);
 Object.assign(viewer.style, {
 display: 'none',
 visibility: 'hidden',
 position: 'absolute',
 width: '1px',
 height: '1px',
 overflow: 'hidden',
 opacity: '0',
 pointerEvents: 'none',
 margin: '0',
 padding: '0'
 });
 viewer.setAttribute('data-initialized', 'true');
 viewer.setAttribute('data-viewer-replaced', 'true');
 break;
 }
 }
 }
 }

if (viewer && viewer.parentNode) {
 if (container.getAttribute('data-position-locked') === 'true') {
 unlockContainers();
 }

const viewerIndex = Array.from(viewer.parentNode.children).indexOf(viewer);
 const containerIndex = Array.from(viewer.parentNode.children).indexOf(container);

if (containerIndex !== viewerIndex + 1) {
 // CRITICAL: Check if container is actually a child before removing
 if (container.parentNode && container.parentNode.contains(container)) {
 try {
 container.parentNode.removeChild(container);
 } catch (e) {
 return; // Skip repositioning if removal failed
 }
 }
 if (viewer.nextSibling) {
 viewer.parentNode.insertBefore(container, viewer.nextSibling);
 } else {
 viewer.parentNode.appendChild(container);
 }
 } else if (container.parentNode !== viewer.parentNode) {
 // CRITICAL: Check if container is actually a child before removing
 if (container.parentNode && container.parentNode.contains(container)) {
 try {
 container.parentNode.removeChild(container);
 } catch (e) {
 return; // Skip repositioning if removal failed
 }
 }
 if (viewer.nextSibling) {
 viewer.parentNode.insertBefore(container, viewer.nextSibling);
 } else {
 viewer.parentNode.appendChild(container);
 }
 }
 }
 });

invalidateQueryCache();
 }

// Debounced version for non-critical repositioning
 const repositionContainersAfterThemeToggle = debounce(repositionContainersAfterThemeToggleCore, REPOSITION\_DEBOUNCE);

// Optimized: Observer setup with better filtering
 let observer = null;
 let containerPositionObserver = null;
 let fallbackObserver = null; // Track fallback observer for cleanup

function setupContainerPositionObserver() {
 if (typeof MutationObserver === 'undefined') return;

const contentArea = getContentArea();
 if (!contentArea \|\| !document.contains(contentArea)) {
 setTimeout(setupContainerPositionObserver, 500);
 return;
 }

if (containerPositionObserver) {
 containerPositionObserver.disconnect();
 }

containerPositionObserver = new MutationObserver(function(mutations) {
 if (themeToggleInProgress) {
 // Use core function (not debounced) for immediate repositioning during theme toggle
 requestAnimationFrame(repositionContainersAfterThemeToggleCore);
 return;
 }

let needsReposition = false;
 for (let i = 0; i < mutations.length && !needsReposition; i++) {
 if (mutations\[i\].type === 'childList') {
 needsReposition = true;
 }
 }

if (needsReposition) {
 clearTimeout(containerPositionObserver.\_timeout);
 containerPositionObserver.\_timeout = setTimeout(repositionContainersAfterThemeToggle, REPOSITION\_DEBOUNCE);
 }
 });

containerPositionObserver.observe(contentArea, {
 childList: true,
 subtree: true,
 attributes: false,
 characterData: false
 });

containerPositionObserver.\_timeout = null;
 }

// Optimized: Main observer with better early exits
 function setupObserver() {
 if (typeof MutationObserver === 'undefined') return;

const contentArea = getContentArea();
 if (!contentArea \|\| !document.contains(contentArea)) {
 setTimeout(setupObserver, 500);
 return;
 }

if (contentArea === document.documentElement \|\| contentArea === document.body) {
 return;
 }

if (observer) {
 const currentObserved = observer.\_observedElement;
 if (currentObserved === contentArea && document.contains(contentArea)) {
 return;
 }
 if (currentObserved) {
 observer.disconnect();
 }
 observer = null;
 }

observer = new MutationObserver(function(mutations) {
 if (themeToggleInProgress) return;

let hasNewViewer = false;
 for (let i = 0; i < mutations.length && !hasNewViewer; i++) {
 const mutation = mutations\[i\];
 if (mutation.addedNodes && mutation.addedNodes.length > 0) {
 for (let j = 0; j < mutation.addedNodes.length && !hasNewViewer; j++) {
 const node = mutation.addedNodes\[j\];
 if (node.nodeType === 1 &&
 node.hasAttribute &&
 node.hasAttribute('data-single-page-viewer') &&
 !node.hasAttribute('data-initialized') &&
 !node.hasAttribute('data-viewer-replaced')) {
 hasNewViewer = true;
 }
 }
 }
 }

if (hasNewViewer) {
 // Use core function for immediate repositioning when new viewer detected
 repositionContainersAfterThemeToggleCore();
 setTimeout(repositionContainersAfterThemeToggleCore, 10);
 setTimeout(repositionContainersAfterThemeToggleCore, 50);
 setTimeout(repositionContainersAfterThemeToggleCore, 200);
 }

clearTimeout(observerTimeout);
 observerTimeout = setTimeout(function() {
 if (themeToggleInProgress) return;

let hasNewViewer = false;
 for (let i = 0; i < mutations.length && !hasNewViewer; i++) {
 const mutation = mutations\[i\];

if (mutation.target === document.documentElement \|\| mutation.target === document.body) {
 continue;
 }

if (mutation.type === 'attributes' &&
 mutation.attributeName === 'class' &&
 mutation.target === document.documentElement) {
 continue;
 }

if (mutation.type === 'attributes' && mutation.attributeName === 'data-initialized') {
 const target = mutation.target;
 if (target && target.hasAttribute &&
 target.hasAttribute('data-single-page-viewer') &&
 !target.hasAttribute('data-initialized')) {
 hasNewViewer = true;
 }
 }

if (mutation.addedNodes && mutation.addedNodes.length > 0) {
 for (let j = 0; j < mutation.addedNodes.length && !hasNewViewer; j++) {
 const node = mutation.addedNodes\[j\];
 if (node.nodeType === 1 &&
 node.hasAttribute &&
 node.hasAttribute('data-single-page-viewer') &&
 !node.hasAttribute('data-initialized')) {
 hasNewViewer = true;
 }
 }
 }
 }

if (hasNewViewer) {
 invalidateQueryCache();
 initSinglePageViewers();
 }
 }, OBSERVER\_DEBOUNCE);
 });

observer.observe(contentArea, {
 childList: true,
 subtree: true,
 attributes: true,
 attributeFilter: \['data-initialized'\],
 characterData: false
 });

observer.\_observedElement = contentArea;
 setupContainerPositionObserver();
 }

function start() {
 setupObserver();
 initialize();
 }

function checkAndInitialize() {
 if (isInitializing) return;

const currentUrl = window.location.href;
 if (currentUrl === lastUrl && lastUrl !== null) {
 return;
 }

const contentArea = document.querySelector('#content-area') \|\| document.querySelector('.mdx-content');
 if (contentArea) {
 const viewers = getUninitializedViewers(true);
 if (viewers.length > 0) {
 cachedContentArea = contentArea;
 setupObserver();
 initialize();
 }
 }
 }

if (document.readyState === 'loading') {
 document.addEventListener('DOMContentLoaded', start);
 } else {
 setTimeout(start, 100);
 }

if (typeof window !== 'undefined' && window.next) {
 let initialLoadAttempts = 0;
 const maxInitialAttempts = 4;
 const attemptDelays = \[200, 500, 1000, 2000\];
 const initialUrl = window.location.href;

attemptDelays.forEach(function(delay) {
 setTimeout(function() {
 if (initialLoadAttempts < maxInitialAttempts) {
 initialLoadAttempts++;
 if (window.location.href === initialUrl) {
 checkAndInitialize();
 }
 }
 }, delay);
 });
 }

window.addEventListener('popstate', function(e) {
 const currentUrl = window.location.href;
 if (currentUrl !== lastUrl) {
 handleNavigation();
 }
 });

if (typeof window !== 'undefined') {
 if (window.next && window.next.router && window.next.router.events) {
 window.next.router.events.on('routeChangeComplete', function(url) {
 lastUrl = window.location.href;
 isInitializing = false;
 pendingInitCall = false;
 if (navigationTimeout) {
 clearTimeout(navigationTimeout);
 navigationTimeout = null;
 }
 invalidateContentAreaCache();
 invalidateQueryCache();
 setTimeout(function() {
 setupObserver();
 initialize();
 }, 300);
 });

window.next.router.events.on('routeChangeStart', function(url) {
 isInitializing = false;
 pendingInitCall = false;
 });
 }

if (!window.next \|\| !window.next.router) {
 const originalPushState = history.pushState;
 const originalReplaceState = history.replaceState;

history.pushState = function() {
 originalPushState.apply(history, arguments);
 setTimeout(function() {
 if (window.location.href !== lastUrl) {
 handleNavigation();
 }
 }, 0);
 };

history.replaceState = function() {
 originalReplaceState.apply(history, arguments);
 setTimeout(function() {
 if (window.location.href !== lastUrl) {
 handleNavigation();
 }
 }, 0);
 };
 }
 }

document.addEventListener('visibilitychange', function() {
 if (!document.hidden) {
 isInitializing = false;
 startPeriodicCheck();
 if (!pendingInitCall) {
 pendingInitCall = true;
 setTimeout(function() {
 pendingInitCall = false;
 initSinglePageViewers();
 }, INIT\_DELAY / 2);
 }
 }
 });

function startPeriodicCheck() {
 if (periodicCheckInterval) return;

periodicCheckInterval = setInterval(function() {
 const uninitialized = getUninitializedViewers(true);
 if (uninitialized.length === 0) {
 clearInterval(periodicCheckInterval);
 periodicCheckInterval = null;
 } else if (!isInitializing) {
 initSinglePageViewers();
 }
 }, 2000);
 }

setTimeout(startPeriodicCheck, INIT\_DELAY \* 2);

window.\_\_singlePageViewerInit = function() {
 const currentUrl = window.location.href;
 if (currentUrl === lastUrl) {
 return;
 }

isInitializing = false;
 pendingInitCall = false;
 lastUrl = currentUrl;
 invalidateContentAreaCache();
 invalidateQueryCache();
 setupObserver();
 initialize();
 };

window.\_\_singlePageViewerCheck = function() {
 invalidateQueryCache();
 initSinglePageViewers();
 };
})();

// Optimized: Second IIFE for navigation handling
(function() {
 'use strict';

let lastPathname = window.location.pathname;
 let lastInitializedPathname = window.location.pathname;

function checkAndInit() {
 const currentPathname = window.location.pathname;
 if (currentPathname === lastInitializedPathname) {
 return;
 }

lastInitializedPathname = currentPathname;
 if (typeof window !== 'undefined') {
 window.\_\_lastFullUrl = window.location.href;
 }

if (window.\_\_singlePageViewerInit) {
 window.\_\_singlePageViewerInit();
 }
 }

function runInit() {
 if (window.\_\_singlePageViewerInit) {
 setTimeout(checkAndInit, 100);
 } else {
 let attempts = 0;
 const maxAttempts = 50;
 const checkInterval = setInterval(function() {
 attempts++;
 if (window.\_\_singlePageViewerInit) {
 clearInterval(checkInterval);
 setTimeout(checkAndInit, 100);
 } else if (attempts >= maxAttempts) {
 clearInterval(checkInterval);
 }
 }, 100);
 }
 }

if (document.readyState === 'loading') {
 document.addEventListener('DOMContentLoaded', runInit);
 } else {
 setTimeout(runInit, 100);
 }

if (typeof window !== 'undefined' && window.next && window.next.router && window.next.router.events) {
 window.next.router.events.on('routeChangeComplete', function(url) {
 lastPathname = window.location.pathname;
 setTimeout(checkAndInit, 300);
 });
 }

setInterval(function() {
 const currentPathname = window.location.pathname;
 if (currentPathname !== lastPathname) {
 lastPathname = currentPathname;
 setTimeout(checkAndInit, 300);
 }
 }, 500);

if (typeof MutationObserver !== 'undefined') {
 let fallbackObserverTimeout = null;
 // Store in outer scope for cleanup tracking
 fallbackObserver = new MutationObserver(function(mutations) {
 if (fallbackObserverTimeout) {
 clearTimeout(fallbackObserverTimeout);
 }
 fallbackObserverTimeout = setTimeout(function() {
 const contentArea = document.querySelector('#content-area');
 if (contentArea) {
 const uninitialized = contentArea.querySelectorAll(
 '\[data-single-page-viewer\]:not(\[data-initialized\]):not(.single-page-viewer-container \[data-single-page-viewer\])'
 );
 if (uninitialized.length > 0) {
 const currentPathname = window.location.pathname;
 if (currentPathname !== lastInitializedPathname) {
 setTimeout(checkAndInit, 200);
 }
 }
 }
 }, 500);
 });

if (document.body) {
 fallbackObserver.observe(document.body, { childList: true, subtree: true });
 } else {
 document.addEventListener('DOMContentLoaded', function() {
 if (document.body) {
 fallbackObserver.observe(document.body, { childList: true, subtree: true });
 }
 });
 }
 }
})();
