> ## 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/api-reference/endpoints/update-an-endpoint#content-area)

PATCH

/

v2.0

/

endpoints

/

{endpointId}

Try it

Update an Endpoint

cURL

```
curl --request PATCH \
  --url https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId} \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "foreignId": "<string>",
  "channel": "webchat3",
  "flowId": "<string>",
  "localeId": "<string>",
  "URLToken": "f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f",
  "name": "New Endpoint",
  "entrypoint": "667ed4ae16d66f47dc2a9400",
  "active": true,
  "nluConnectorId": "cognigy",
  "useConversations": true,
  "maskIPAddress": true,
  "maskAnalytics": true,
  "maskLogging": true,
  "useContactProfiles": true,
  "useAnalytics": true,
  "useDashbotAnalytics": true,
  "dashbotApikey": "<string>",
  "dashbotPlatform": "<string>",
  "disableInputSanitization": "<string>",
  "disableSkipUriTags": "<string>",
  "overrideSnapshotConnections": true,
  "settings": {
    "accessScope": "<string>",
    "accessToken": "<string>",
    "appId": "<string>",
    "appSecret": "<string>",
    "backgroundImageUrl": "<string>",
    "basicAuthPassword": "<string>",
    "basicAuthUser": "<string>",
    "botUserId": "<string>",
    "businessHours": {
      "businessHours": [\
        {\
          "startTime": "<string>",\
          "endTime": "<string>",\
          "weekDay": "<string>"\
        }\
      ],
      "enabled": true,
      "text": "<string>",
      "mode": "<string>",
      "timeZone": "<string>",
      "title": "<string>"
    },
    "colorScheme": "<string>",
    "connectionName": "<string>",
    "customJSON": "<string>",
    "designTemplate": 123,
    "disableHtmlContentSanitization": true,
    "disableInputAutocomplete": true,
    "disableInputAutogrow": true,
    "disableUrlButtonSanitization": true,
    "enableGenericHTMLStyling": true,
    "enableAsyncCommunication": true,
    "engagementMessageText": "<string>",
    "displayGetStartedButton": true,
    "dynamicImageAspectRatio": true,
    "enableCollectMetadata": true,
    "enableConnectionStatusIndicator": true,
    "enableDemoWebchat": true,
    "enableFileUpload": true,
    "enablePersistentMenu": true,
    "enableSTT": true,
    "enableTTS": true,
    "enableUnreadMessageBadge": true,
    "enableUnreadMessagePreview": true,
    "enableUnreadMessageSound": true,
    "enableUnreadMessageTitleIndicator": true,
    "enableTypingIndicator": true,
    "facebookPageToken": "<string>",
    "focusInputAfterPostback": true,
    "getStartedButtonText": "<string>",
    "getStartedPayload": "<string>",
    "getStartedText": "<string>",
    "getStartedData": "<string>",
    "headerLogoUrl": "<string>",
    "hubSecret": "<string>",
    "inputAutogrowMaxRows": 123,
    "inputPlaceholder": "<string>",
    "language": "<string>",
    "lineChannelAccessToken": "<string>",
    "lineChannelSecret": "<string>",
    "maintenance": {
      "enabled": true,
      "mode": "<string>",
      "text": "<string>",
      "title": "<string>"
    },
    "mergeContactProfiles": true,
    "messageDelay": 123,
    "messageLogoUrl": "<string>",
    "overwriteWebchatBundleUrl": "<string>",
    "ratingTitleText": "<string>",
    "ratingCommentText": "<string>",
    "ratingMessageHistoryRatingText": "<string>",
    "ratingMessageHistoryCommentText": "<string>",
    "reparseAlexaSlots": true,
    "requestFacebookProfileData": true,
    "restEndpointAuthentication": {},
    "sessionExpiration": 123,
    "shouldOverwriteWebchatBundleUrl": true,
    "showEngagementMessagesInChat": true,
    "slackOAuthAccessToken": "<string>",
    "slackVerifyToken": "<string>",
    "sunshineConversationsChannelKeyId": "<string>",
    "sunshineConversationsChannelSecret": "<string>",
    "sunshineConversationsChannelUri": "<string>",
    "tenantId": "<string>",
    "updateContactProfileWithFacebookProfile": true,
    "voice": "<string>",
    "webhookEndpointAuthentication": {},
    "webhookUrl": "<string>",
    "skill": {},
    "persistentMenu": {}
  },
  "transformer": {
    "abortOnError": true,
    "transformer": "<string>",
    "transpiledTransformer": "<string>",
    "inputTransformerEnabled": true,
    "outputTransformerEnabled": true,
    "finalPingTransformerEnabled": true,
    "notifyTransformerEnabled": true,
    "injectTransformerEnabled": true
  },
  "handoverSettings": {
    "providerSettings": {
      "forwardOnlyHandoverConversations": true,
      "getQueueUpdates": true,
      "apiVersion": "<string>",
      "baseUrl": "<string>",
      "apiAccessToken": "<string>",
      "baseApiUrl": "<string>",
      "realtimeAccessToken": "<string>",
      "realtimeEndpointUrl": "<string>",
      "webhookSecret": "<string>",
      "botCategoryId": "<string>",
      "agentCategoryId": "<string>",
      "organizationId": "<string>",
      "deploymentId": "<string>",
      "buttonId": "<string>"
    },
    "agentAssistSettings": {
      "agentAssistFlowId": "<string>",
      "agentAssistConfigId": "<string>",
      "enableTranscriptTile": true,
      "enableTranscriptTileChatInput": true,
      "redactTranscriptTileMessages": true,
      "enableAgentCopilotAuthentication": true,
      "blockNonJWTRequests": true,
      "agentCopilotAuthentication": "<string>",
      "oAuth2Connection": "<string>"
    }
  },
  "orgDataPrivacySettings": {
    "enabled": true,
    "useAnalytics": true,
    "storeDataPayload": true,
    "useContactProfiles": true,
    "useConversations": true,
    "maskIPAddress": true,
    "maskAnalytics": true,
    "maskLogging": true
  }
}
'
```

```
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}"

payload = {
    "foreignId": "<string>",
    "channel": "webchat3",
    "flowId": "<string>",
    "localeId": "<string>",
    "URLToken": "f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f",
    "name": "New Endpoint",
    "entrypoint": "667ed4ae16d66f47dc2a9400",
    "active": True,
    "nluConnectorId": "cognigy",
    "useConversations": True,
    "maskIPAddress": True,
    "maskAnalytics": True,
    "maskLogging": True,
    "useContactProfiles": True,
    "useAnalytics": True,
    "useDashbotAnalytics": True,
    "dashbotApikey": "<string>",
    "dashbotPlatform": "<string>",
    "disableInputSanitization": "<string>",
    "disableSkipUriTags": "<string>",
    "overrideSnapshotConnections": True,
    "settings": {
        "accessScope": "<string>",
        "accessToken": "<string>",
        "appId": "<string>",
        "appSecret": "<string>",
        "backgroundImageUrl": "<string>",
        "basicAuthPassword": "<string>",
        "basicAuthUser": "<string>",
        "botUserId": "<string>",
        "businessHours": {
            "businessHours": [\
                {\
                    "startTime": "<string>",\
                    "endTime": "<string>",\
                    "weekDay": "<string>"\
                }\
            ],
            "enabled": True,
            "text": "<string>",
            "mode": "<string>",
            "timeZone": "<string>",
            "title": "<string>"
        },
        "colorScheme": "<string>",
        "connectionName": "<string>",
        "customJSON": "<string>",
        "designTemplate": 123,
        "disableHtmlContentSanitization": True,
        "disableInputAutocomplete": True,
        "disableInputAutogrow": True,
        "disableUrlButtonSanitization": True,
        "enableGenericHTMLStyling": True,
        "enableAsyncCommunication": True,
        "engagementMessageText": "<string>",
        "displayGetStartedButton": True,
        "dynamicImageAspectRatio": True,
        "enableCollectMetadata": True,
        "enableConnectionStatusIndicator": True,
        "enableDemoWebchat": True,
        "enableFileUpload": True,
        "enablePersistentMenu": True,
        "enableSTT": True,
        "enableTTS": True,
        "enableUnreadMessageBadge": True,
        "enableUnreadMessagePreview": True,
        "enableUnreadMessageSound": True,
        "enableUnreadMessageTitleIndicator": True,
        "enableTypingIndicator": True,
        "facebookPageToken": "<string>",
        "focusInputAfterPostback": True,
        "getStartedButtonText": "<string>",
        "getStartedPayload": "<string>",
        "getStartedText": "<string>",
        "getStartedData": "<string>",
        "headerLogoUrl": "<string>",
        "hubSecret": "<string>",
        "inputAutogrowMaxRows": 123,
        "inputPlaceholder": "<string>",
        "language": "<string>",
        "lineChannelAccessToken": "<string>",
        "lineChannelSecret": "<string>",
        "maintenance": {
            "enabled": True,
            "mode": "<string>",
            "text": "<string>",
            "title": "<string>"
        },
        "mergeContactProfiles": True,
        "messageDelay": 123,
        "messageLogoUrl": "<string>",
        "overwriteWebchatBundleUrl": "<string>",
        "ratingTitleText": "<string>",
        "ratingCommentText": "<string>",
        "ratingMessageHistoryRatingText": "<string>",
        "ratingMessageHistoryCommentText": "<string>",
        "reparseAlexaSlots": True,
        "requestFacebookProfileData": True,
        "restEndpointAuthentication": {},
        "sessionExpiration": 123,
        "shouldOverwriteWebchatBundleUrl": True,
        "showEngagementMessagesInChat": True,
        "slackOAuthAccessToken": "<string>",
        "slackVerifyToken": "<string>",
        "sunshineConversationsChannelKeyId": "<string>",
        "sunshineConversationsChannelSecret": "<string>",
        "sunshineConversationsChannelUri": "<string>",
        "tenantId": "<string>",
        "updateContactProfileWithFacebookProfile": True,
        "voice": "<string>",
        "webhookEndpointAuthentication": {},
        "webhookUrl": "<string>",
        "skill": {},
        "persistentMenu": {}
    },
    "transformer": {
        "abortOnError": True,
        "transformer": "<string>",
        "transpiledTransformer": "<string>",
        "inputTransformerEnabled": True,
        "outputTransformerEnabled": True,
        "finalPingTransformerEnabled": True,
        "notifyTransformerEnabled": True,
        "injectTransformerEnabled": True
    },
    "handoverSettings": {
        "providerSettings": {
            "forwardOnlyHandoverConversations": True,
            "getQueueUpdates": True,
            "apiVersion": "<string>",
            "baseUrl": "<string>",
            "apiAccessToken": "<string>",
            "baseApiUrl": "<string>",
            "realtimeAccessToken": "<string>",
            "realtimeEndpointUrl": "<string>",
            "webhookSecret": "<string>",
            "botCategoryId": "<string>",
            "agentCategoryId": "<string>",
            "organizationId": "<string>",
            "deploymentId": "<string>",
            "buttonId": "<string>"
        },
        "agentAssistSettings": {
            "agentAssistFlowId": "<string>",
            "agentAssistConfigId": "<string>",
            "enableTranscriptTile": True,
            "enableTranscriptTileChatInput": True,
            "redactTranscriptTileMessages": True,
            "enableAgentCopilotAuthentication": True,
            "blockNonJWTRequests": True,
            "agentCopilotAuthentication": "<string>",
            "oAuth2Connection": "<string>"
        }
    },
    "orgDataPrivacySettings": {
        "enabled": True,
        "useAnalytics": True,
        "storeDataPayload": True,
        "useContactProfiles": True,
        "useConversations": True,
        "maskIPAddress": True,
        "maskAnalytics": True,
        "maskLogging": True
    }
}
headers = {
    "X-API-Key": "<api-key>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```

```
const options = {
  method: 'PATCH',
  headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    foreignId: '<string>',
    channel: 'webchat3',
    flowId: '<string>',
    localeId: '<string>',
    URLToken: 'f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f',
    name: 'New Endpoint',
    entrypoint: '667ed4ae16d66f47dc2a9400',
    active: true,
    nluConnectorId: 'cognigy',
    useConversations: true,
    maskIPAddress: true,
    maskAnalytics: true,
    maskLogging: true,
    useContactProfiles: true,
    useAnalytics: true,
    useDashbotAnalytics: true,
    dashbotApikey: '<string>',
    dashbotPlatform: '<string>',
    disableInputSanitization: '<string>',
    disableSkipUriTags: '<string>',
    overrideSnapshotConnections: true,
    settings: {
      accessScope: '<string>',
      accessToken: '<string>',
      appId: '<string>',
      appSecret: '<string>',
      backgroundImageUrl: '<string>',
      basicAuthPassword: '<string>',
      basicAuthUser: '<string>',
      botUserId: '<string>',
      businessHours: {
        businessHours: [{startTime: '<string>', endTime: '<string>', weekDay: '<string>'}],
        enabled: true,
        text: '<string>',
        mode: '<string>',
        timeZone: '<string>',
        title: '<string>'
      },
      colorScheme: '<string>',
      connectionName: '<string>',
      customJSON: '<string>',
      designTemplate: 123,
      disableHtmlContentSanitization: true,
      disableInputAutocomplete: true,
      disableInputAutogrow: true,
      disableUrlButtonSanitization: true,
      enableGenericHTMLStyling: true,
      enableAsyncCommunication: true,
      engagementMessageText: '<string>',
      displayGetStartedButton: true,
      dynamicImageAspectRatio: true,
      enableCollectMetadata: true,
      enableConnectionStatusIndicator: true,
      enableDemoWebchat: true,
      enableFileUpload: true,
      enablePersistentMenu: true,
      enableSTT: true,
      enableTTS: true,
      enableUnreadMessageBadge: true,
      enableUnreadMessagePreview: true,
      enableUnreadMessageSound: true,
      enableUnreadMessageTitleIndicator: true,
      enableTypingIndicator: true,
      facebookPageToken: '<string>',
      focusInputAfterPostback: true,
      getStartedButtonText: '<string>',
      getStartedPayload: '<string>',
      getStartedText: '<string>',
      getStartedData: '<string>',
      headerLogoUrl: '<string>',
      hubSecret: '<string>',
      inputAutogrowMaxRows: 123,
      inputPlaceholder: '<string>',
      language: '<string>',
      lineChannelAccessToken: '<string>',
      lineChannelSecret: '<string>',
      maintenance: {enabled: true, mode: '<string>', text: '<string>', title: '<string>'},
      mergeContactProfiles: true,
      messageDelay: 123,
      messageLogoUrl: '<string>',
      overwriteWebchatBundleUrl: '<string>',
      ratingTitleText: '<string>',
      ratingCommentText: '<string>',
      ratingMessageHistoryRatingText: '<string>',
      ratingMessageHistoryCommentText: '<string>',
      reparseAlexaSlots: true,
      requestFacebookProfileData: true,
      restEndpointAuthentication: {},
      sessionExpiration: 123,
      shouldOverwriteWebchatBundleUrl: true,
      showEngagementMessagesInChat: true,
      slackOAuthAccessToken: '<string>',
      slackVerifyToken: '<string>',
      sunshineConversationsChannelKeyId: '<string>',
      sunshineConversationsChannelSecret: '<string>',
      sunshineConversationsChannelUri: '<string>',
      tenantId: '<string>',
      updateContactProfileWithFacebookProfile: true,
      voice: '<string>',
      webhookEndpointAuthentication: {},
      webhookUrl: '<string>',
      skill: {},
      persistentMenu: {}
    },
    transformer: {
      abortOnError: true,
      transformer: '<string>',
      transpiledTransformer: '<string>',
      inputTransformerEnabled: true,
      outputTransformerEnabled: true,
      finalPingTransformerEnabled: true,
      notifyTransformerEnabled: true,
      injectTransformerEnabled: true
    },
    handoverSettings: {
      providerSettings: {
        forwardOnlyHandoverConversations: true,
        getQueueUpdates: true,
        apiVersion: '<string>',
        baseUrl: '<string>',
        apiAccessToken: '<string>',
        baseApiUrl: '<string>',
        realtimeAccessToken: '<string>',
        realtimeEndpointUrl: '<string>',
        webhookSecret: '<string>',
        botCategoryId: '<string>',
        agentCategoryId: '<string>',
        organizationId: '<string>',
        deploymentId: '<string>',
        buttonId: '<string>'
      },
      agentAssistSettings: {
        agentAssistFlowId: '<string>',
        agentAssistConfigId: '<string>',
        enableTranscriptTile: true,
        enableTranscriptTileChatInput: true,
        redactTranscriptTileMessages: true,
        enableAgentCopilotAuthentication: true,
        blockNonJWTRequests: true,
        agentCopilotAuthentication: '<string>',
        oAuth2Connection: '<string>'
      }
    },
    orgDataPrivacySettings: {
      enabled: true,
      useAnalytics: true,
      storeDataPayload: true,
      useContactProfiles: true,
      useConversations: true,
      maskIPAddress: true,
      maskAnalytics: true,
      maskLogging: true
    }
  })
};

fetch('https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

```
<?php

$curl = curl_init();

curl_setopt_array($curl, [\
  CURLOPT_URL => "https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}",\
  CURLOPT_RETURNTRANSFER => true,\
  CURLOPT_ENCODING => "",\
  CURLOPT_MAXREDIRS => 10,\
  CURLOPT_TIMEOUT => 30,\
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\
  CURLOPT_CUSTOMREQUEST => "PATCH",\
  CURLOPT_POSTFIELDS => json_encode([\
    'foreignId' => '<string>',\
    'channel' => 'webchat3',\
    'flowId' => '<string>',\
    'localeId' => '<string>',\
    'URLToken' => 'f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f',\
    'name' => 'New Endpoint',\
    'entrypoint' => '667ed4ae16d66f47dc2a9400',\
    'active' => true,\
    'nluConnectorId' => 'cognigy',\
    'useConversations' => true,\
    'maskIPAddress' => true,\
    'maskAnalytics' => true,\
    'maskLogging' => true,\
    'useContactProfiles' => true,\
    'useAnalytics' => true,\
    'useDashbotAnalytics' => true,\
    'dashbotApikey' => '<string>',\
    'dashbotPlatform' => '<string>',\
    'disableInputSanitization' => '<string>',\
    'disableSkipUriTags' => '<string>',\
    'overrideSnapshotConnections' => true,\
    'settings' => [\
        'accessScope' => '<string>',\
        'accessToken' => '<string>',\
        'appId' => '<string>',\
        'appSecret' => '<string>',\
        'backgroundImageUrl' => '<string>',\
        'basicAuthPassword' => '<string>',\
        'basicAuthUser' => '<string>',\
        'botUserId' => '<string>',\
        'businessHours' => [\
                'businessHours' => [\
                                [\
                                                                'startTime' => '<string>',\
                                                                'endTime' => '<string>',\
                                                                'weekDay' => '<string>'\
                                ]\
                ],\
                'enabled' => true,\
                'text' => '<string>',\
                'mode' => '<string>',\
                'timeZone' => '<string>',\
                'title' => '<string>'\
        ],\
        'colorScheme' => '<string>',\
        'connectionName' => '<string>',\
        'customJSON' => '<string>',\
        'designTemplate' => 123,\
        'disableHtmlContentSanitization' => true,\
        'disableInputAutocomplete' => true,\
        'disableInputAutogrow' => true,\
        'disableUrlButtonSanitization' => true,\
        'enableGenericHTMLStyling' => true,\
        'enableAsyncCommunication' => true,\
        'engagementMessageText' => '<string>',\
        'displayGetStartedButton' => true,\
        'dynamicImageAspectRatio' => true,\
        'enableCollectMetadata' => true,\
        'enableConnectionStatusIndicator' => true,\
        'enableDemoWebchat' => true,\
        'enableFileUpload' => true,\
        'enablePersistentMenu' => true,\
        'enableSTT' => true,\
        'enableTTS' => true,\
        'enableUnreadMessageBadge' => true,\
        'enableUnreadMessagePreview' => true,\
        'enableUnreadMessageSound' => true,\
        'enableUnreadMessageTitleIndicator' => true,\
        'enableTypingIndicator' => true,\
        'facebookPageToken' => '<string>',\
        'focusInputAfterPostback' => true,\
        'getStartedButtonText' => '<string>',\
        'getStartedPayload' => '<string>',\
        'getStartedText' => '<string>',\
        'getStartedData' => '<string>',\
        'headerLogoUrl' => '<string>',\
        'hubSecret' => '<string>',\
        'inputAutogrowMaxRows' => 123,\
        'inputPlaceholder' => '<string>',\
        'language' => '<string>',\
        'lineChannelAccessToken' => '<string>',\
        'lineChannelSecret' => '<string>',\
        'maintenance' => [\
                'enabled' => true,\
                'mode' => '<string>',\
                'text' => '<string>',\
                'title' => '<string>'\
        ],\
        'mergeContactProfiles' => true,\
        'messageDelay' => 123,\
        'messageLogoUrl' => '<string>',\
        'overwriteWebchatBundleUrl' => '<string>',\
        'ratingTitleText' => '<string>',\
        'ratingCommentText' => '<string>',\
        'ratingMessageHistoryRatingText' => '<string>',\
        'ratingMessageHistoryCommentText' => '<string>',\
        'reparseAlexaSlots' => true,\
        'requestFacebookProfileData' => true,\
        'restEndpointAuthentication' => [\
\
        ],\
        'sessionExpiration' => 123,\
        'shouldOverwriteWebchatBundleUrl' => true,\
        'showEngagementMessagesInChat' => true,\
        'slackOAuthAccessToken' => '<string>',\
        'slackVerifyToken' => '<string>',\
        'sunshineConversationsChannelKeyId' => '<string>',\
        'sunshineConversationsChannelSecret' => '<string>',\
        'sunshineConversationsChannelUri' => '<string>',\
        'tenantId' => '<string>',\
        'updateContactProfileWithFacebookProfile' => true,\
        'voice' => '<string>',\
        'webhookEndpointAuthentication' => [\
\
        ],\
        'webhookUrl' => '<string>',\
        'skill' => [\
\
        ],\
        'persistentMenu' => [\
\
        ]\
    ],\
    'transformer' => [\
        'abortOnError' => true,\
        'transformer' => '<string>',\
        'transpiledTransformer' => '<string>',\
        'inputTransformerEnabled' => true,\
        'outputTransformerEnabled' => true,\
        'finalPingTransformerEnabled' => true,\
        'notifyTransformerEnabled' => true,\
        'injectTransformerEnabled' => true\
    ],\
    'handoverSettings' => [\
        'providerSettings' => [\
                'forwardOnlyHandoverConversations' => true,\
                'getQueueUpdates' => true,\
                'apiVersion' => '<string>',\
                'baseUrl' => '<string>',\
                'apiAccessToken' => '<string>',\
                'baseApiUrl' => '<string>',\
                'realtimeAccessToken' => '<string>',\
                'realtimeEndpointUrl' => '<string>',\
                'webhookSecret' => '<string>',\
                'botCategoryId' => '<string>',\
                'agentCategoryId' => '<string>',\
                'organizationId' => '<string>',\
                'deploymentId' => '<string>',\
                'buttonId' => '<string>'\
        ],\
        'agentAssistSettings' => [\
                'agentAssistFlowId' => '<string>',\
                'agentAssistConfigId' => '<string>',\
                'enableTranscriptTile' => true,\
                'enableTranscriptTileChatInput' => true,\
                'redactTranscriptTileMessages' => true,\
                'enableAgentCopilotAuthentication' => true,\
                'blockNonJWTRequests' => true,\
                'agentCopilotAuthentication' => '<string>',\
                'oAuth2Connection' => '<string>'\
        ]\
    ],\
    'orgDataPrivacySettings' => [\
        'enabled' => true,\
        'useAnalytics' => true,\
        'storeDataPayload' => true,\
        'useContactProfiles' => true,\
        'useConversations' => true,\
        'maskIPAddress' => true,\
        'maskAnalytics' => true,\
        'maskLogging' => true\
    ]\
  ]),\
  CURLOPT_HTTPHEADER => [\
    "Content-Type: application/json",\
    "X-API-Key: <api-key>"\
  ],\
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

```
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}"

payload := strings.NewReader("{\n  \"foreignId\": \"<string>\",\n  \"channel\": \"webchat3\",\n  \"flowId\": \"<string>\",\n  \"localeId\": \"<string>\",\n  \"URLToken\": \"f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f\",\n  \"name\": \"New Endpoint\",\n  \"entrypoint\": \"667ed4ae16d66f47dc2a9400\",\n  \"active\": true,\n  \"nluConnectorId\": \"cognigy\",\n  \"useConversations\": true,\n  \"maskIPAddress\": true,\n  \"maskAnalytics\": true,\n  \"maskLogging\": true,\n  \"useContactProfiles\": true,\n  \"useAnalytics\": true,\n  \"useDashbotAnalytics\": true,\n  \"dashbotApikey\": \"<string>\",\n  \"dashbotPlatform\": \"<string>\",\n  \"disableInputSanitization\": \"<string>\",\n  \"disableSkipUriTags\": \"<string>\",\n  \"overrideSnapshotConnections\": true,\n  \"settings\": {\n    \"accessScope\": \"<string>\",\n    \"accessToken\": \"<string>\",\n    \"appId\": \"<string>\",\n    \"appSecret\": \"<string>\",\n    \"backgroundImageUrl\": \"<string>\",\n    \"basicAuthPassword\": \"<string>\",\n    \"basicAuthUser\": \"<string>\",\n    \"botUserId\": \"<string>\",\n    \"businessHours\": {\n      \"businessHours\": [\n        {\n          \"startTime\": \"<string>\",\n          \"endTime\": \"<string>\",\n          \"weekDay\": \"<string>\"\n        }\n      ],\n      \"enabled\": true,\n      \"text\": \"<string>\",\n      \"mode\": \"<string>\",\n      \"timeZone\": \"<string>\",\n      \"title\": \"<string>\"\n    },\n    \"colorScheme\": \"<string>\",\n    \"connectionName\": \"<string>\",\n    \"customJSON\": \"<string>\",\n    \"designTemplate\": 123,\n    \"disableHtmlContentSanitization\": true,\n    \"disableInputAutocomplete\": true,\n    \"disableInputAutogrow\": true,\n    \"disableUrlButtonSanitization\": true,\n    \"enableGenericHTMLStyling\": true,\n    \"enableAsyncCommunication\": true,\n    \"engagementMessageText\": \"<string>\",\n    \"displayGetStartedButton\": true,\n    \"dynamicImageAspectRatio\": true,\n    \"enableCollectMetadata\": true,\n    \"enableConnectionStatusIndicator\": true,\n    \"enableDemoWebchat\": true,\n    \"enableFileUpload\": true,\n    \"enablePersistentMenu\": true,\n    \"enableSTT\": true,\n    \"enableTTS\": true,\n    \"enableUnreadMessageBadge\": true,\n    \"enableUnreadMessagePreview\": true,\n    \"enableUnreadMessageSound\": true,\n    \"enableUnreadMessageTitleIndicator\": true,\n    \"enableTypingIndicator\": true,\n    \"facebookPageToken\": \"<string>\",\n    \"focusInputAfterPostback\": true,\n    \"getStartedButtonText\": \"<string>\",\n    \"getStartedPayload\": \"<string>\",\n    \"getStartedText\": \"<string>\",\n    \"getStartedData\": \"<string>\",\n    \"headerLogoUrl\": \"<string>\",\n    \"hubSecret\": \"<string>\",\n    \"inputAutogrowMaxRows\": 123,\n    \"inputPlaceholder\": \"<string>\",\n    \"language\": \"<string>\",\n    \"lineChannelAccessToken\": \"<string>\",\n    \"lineChannelSecret\": \"<string>\",\n    \"maintenance\": {\n      \"enabled\": true,\n      \"mode\": \"<string>\",\n      \"text\": \"<string>\",\n      \"title\": \"<string>\"\n    },\n    \"mergeContactProfiles\": true,\n    \"messageDelay\": 123,\n    \"messageLogoUrl\": \"<string>\",\n    \"overwriteWebchatBundleUrl\": \"<string>\",\n    \"ratingTitleText\": \"<string>\",\n    \"ratingCommentText\": \"<string>\",\n    \"ratingMessageHistoryRatingText\": \"<string>\",\n    \"ratingMessageHistoryCommentText\": \"<string>\",\n    \"reparseAlexaSlots\": true,\n    \"requestFacebookProfileData\": true,\n    \"restEndpointAuthentication\": {},\n    \"sessionExpiration\": 123,\n    \"shouldOverwriteWebchatBundleUrl\": true,\n    \"showEngagementMessagesInChat\": true,\n    \"slackOAuthAccessToken\": \"<string>\",\n    \"slackVerifyToken\": \"<string>\",\n    \"sunshineConversationsChannelKeyId\": \"<string>\",\n    \"sunshineConversationsChannelSecret\": \"<string>\",\n    \"sunshineConversationsChannelUri\": \"<string>\",\n    \"tenantId\": \"<string>\",\n    \"updateContactProfileWithFacebookProfile\": true,\n    \"voice\": \"<string>\",\n    \"webhookEndpointAuthentication\": {},\n    \"webhookUrl\": \"<string>\",\n    \"skill\": {},\n    \"persistentMenu\": {}\n  },\n  \"transformer\": {\n    \"abortOnError\": true,\n    \"transformer\": \"<string>\",\n    \"transpiledTransformer\": \"<string>\",\n    \"inputTransformerEnabled\": true,\n    \"outputTransformerEnabled\": true,\n    \"finalPingTransformerEnabled\": true,\n    \"notifyTransformerEnabled\": true,\n    \"injectTransformerEnabled\": true\n  },\n  \"handoverSettings\": {\n    \"providerSettings\": {\n      \"forwardOnlyHandoverConversations\": true,\n      \"getQueueUpdates\": true,\n      \"apiVersion\": \"<string>\",\n      \"baseUrl\": \"<string>\",\n      \"apiAccessToken\": \"<string>\",\n      \"baseApiUrl\": \"<string>\",\n      \"realtimeAccessToken\": \"<string>\",\n      \"realtimeEndpointUrl\": \"<string>\",\n      \"webhookSecret\": \"<string>\",\n      \"botCategoryId\": \"<string>\",\n      \"agentCategoryId\": \"<string>\",\n      \"organizationId\": \"<string>\",\n      \"deploymentId\": \"<string>\",\n      \"buttonId\": \"<string>\"\n    },\n    \"agentAssistSettings\": {\n      \"agentAssistFlowId\": \"<string>\",\n      \"agentAssistConfigId\": \"<string>\",\n      \"enableTranscriptTile\": true,\n      \"enableTranscriptTileChatInput\": true,\n      \"redactTranscriptTileMessages\": true,\n      \"enableAgentCopilotAuthentication\": true,\n      \"blockNonJWTRequests\": true,\n      \"agentCopilotAuthentication\": \"<string>\",\n      \"oAuth2Connection\": \"<string>\"\n    }\n  },\n  \"orgDataPrivacySettings\": {\n    \"enabled\": true,\n    \"useAnalytics\": true,\n    \"storeDataPayload\": true,\n    \"useContactProfiles\": true,\n    \"useConversations\": true,\n    \"maskIPAddress\": true,\n    \"maskAnalytics\": true,\n    \"maskLogging\": true\n  }\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
```

```
HttpResponse<String> response = Unirest.patch("https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}")
  .header("X-API-Key", "<api-key>")
  .header("Content-Type", "application/json")
  .body("{\n  \"foreignId\": \"<string>\",\n  \"channel\": \"webchat3\",\n  \"flowId\": \"<string>\",\n  \"localeId\": \"<string>\",\n  \"URLToken\": \"f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f\",\n  \"name\": \"New Endpoint\",\n  \"entrypoint\": \"667ed4ae16d66f47dc2a9400\",\n  \"active\": true,\n  \"nluConnectorId\": \"cognigy\",\n  \"useConversations\": true,\n  \"maskIPAddress\": true,\n  \"maskAnalytics\": true,\n  \"maskLogging\": true,\n  \"useContactProfiles\": true,\n  \"useAnalytics\": true,\n  \"useDashbotAnalytics\": true,\n  \"dashbotApikey\": \"<string>\",\n  \"dashbotPlatform\": \"<string>\",\n  \"disableInputSanitization\": \"<string>\",\n  \"disableSkipUriTags\": \"<string>\",\n  \"overrideSnapshotConnections\": true,\n  \"settings\": {\n    \"accessScope\": \"<string>\",\n    \"accessToken\": \"<string>\",\n    \"appId\": \"<string>\",\n    \"appSecret\": \"<string>\",\n    \"backgroundImageUrl\": \"<string>\",\n    \"basicAuthPassword\": \"<string>\",\n    \"basicAuthUser\": \"<string>\",\n    \"botUserId\": \"<string>\",\n    \"businessHours\": {\n      \"businessHours\": [\n        {\n          \"startTime\": \"<string>\",\n          \"endTime\": \"<string>\",\n          \"weekDay\": \"<string>\"\n        }\n      ],\n      \"enabled\": true,\n      \"text\": \"<string>\",\n      \"mode\": \"<string>\",\n      \"timeZone\": \"<string>\",\n      \"title\": \"<string>\"\n    },\n    \"colorScheme\": \"<string>\",\n    \"connectionName\": \"<string>\",\n    \"customJSON\": \"<string>\",\n    \"designTemplate\": 123,\n    \"disableHtmlContentSanitization\": true,\n    \"disableInputAutocomplete\": true,\n    \"disableInputAutogrow\": true,\n    \"disableUrlButtonSanitization\": true,\n    \"enableGenericHTMLStyling\": true,\n    \"enableAsyncCommunication\": true,\n    \"engagementMessageText\": \"<string>\",\n    \"displayGetStartedButton\": true,\n    \"dynamicImageAspectRatio\": true,\n    \"enableCollectMetadata\": true,\n    \"enableConnectionStatusIndicator\": true,\n    \"enableDemoWebchat\": true,\n    \"enableFileUpload\": true,\n    \"enablePersistentMenu\": true,\n    \"enableSTT\": true,\n    \"enableTTS\": true,\n    \"enableUnreadMessageBadge\": true,\n    \"enableUnreadMessagePreview\": true,\n    \"enableUnreadMessageSound\": true,\n    \"enableUnreadMessageTitleIndicator\": true,\n    \"enableTypingIndicator\": true,\n    \"facebookPageToken\": \"<string>\",\n    \"focusInputAfterPostback\": true,\n    \"getStartedButtonText\": \"<string>\",\n    \"getStartedPayload\": \"<string>\",\n    \"getStartedText\": \"<string>\",\n    \"getStartedData\": \"<string>\",\n    \"headerLogoUrl\": \"<string>\",\n    \"hubSecret\": \"<string>\",\n    \"inputAutogrowMaxRows\": 123,\n    \"inputPlaceholder\": \"<string>\",\n    \"language\": \"<string>\",\n    \"lineChannelAccessToken\": \"<string>\",\n    \"lineChannelSecret\": \"<string>\",\n    \"maintenance\": {\n      \"enabled\": true,\n      \"mode\": \"<string>\",\n      \"text\": \"<string>\",\n      \"title\": \"<string>\"\n    },\n    \"mergeContactProfiles\": true,\n    \"messageDelay\": 123,\n    \"messageLogoUrl\": \"<string>\",\n    \"overwriteWebchatBundleUrl\": \"<string>\",\n    \"ratingTitleText\": \"<string>\",\n    \"ratingCommentText\": \"<string>\",\n    \"ratingMessageHistoryRatingText\": \"<string>\",\n    \"ratingMessageHistoryCommentText\": \"<string>\",\n    \"reparseAlexaSlots\": true,\n    \"requestFacebookProfileData\": true,\n    \"restEndpointAuthentication\": {},\n    \"sessionExpiration\": 123,\n    \"shouldOverwriteWebchatBundleUrl\": true,\n    \"showEngagementMessagesInChat\": true,\n    \"slackOAuthAccessToken\": \"<string>\",\n    \"slackVerifyToken\": \"<string>\",\n    \"sunshineConversationsChannelKeyId\": \"<string>\",\n    \"sunshineConversationsChannelSecret\": \"<string>\",\n    \"sunshineConversationsChannelUri\": \"<string>\",\n    \"tenantId\": \"<string>\",\n    \"updateContactProfileWithFacebookProfile\": true,\n    \"voice\": \"<string>\",\n    \"webhookEndpointAuthentication\": {},\n    \"webhookUrl\": \"<string>\",\n    \"skill\": {},\n    \"persistentMenu\": {}\n  },\n  \"transformer\": {\n    \"abortOnError\": true,\n    \"transformer\": \"<string>\",\n    \"transpiledTransformer\": \"<string>\",\n    \"inputTransformerEnabled\": true,\n    \"outputTransformerEnabled\": true,\n    \"finalPingTransformerEnabled\": true,\n    \"notifyTransformerEnabled\": true,\n    \"injectTransformerEnabled\": true\n  },\n  \"handoverSettings\": {\n    \"providerSettings\": {\n      \"forwardOnlyHandoverConversations\": true,\n      \"getQueueUpdates\": true,\n      \"apiVersion\": \"<string>\",\n      \"baseUrl\": \"<string>\",\n      \"apiAccessToken\": \"<string>\",\n      \"baseApiUrl\": \"<string>\",\n      \"realtimeAccessToken\": \"<string>\",\n      \"realtimeEndpointUrl\": \"<string>\",\n      \"webhookSecret\": \"<string>\",\n      \"botCategoryId\": \"<string>\",\n      \"agentCategoryId\": \"<string>\",\n      \"organizationId\": \"<string>\",\n      \"deploymentId\": \"<string>\",\n      \"buttonId\": \"<string>\"\n    },\n    \"agentAssistSettings\": {\n      \"agentAssistFlowId\": \"<string>\",\n      \"agentAssistConfigId\": \"<string>\",\n      \"enableTranscriptTile\": true,\n      \"enableTranscriptTileChatInput\": true,\n      \"redactTranscriptTileMessages\": true,\n      \"enableAgentCopilotAuthentication\": true,\n      \"blockNonJWTRequests\": true,\n      \"agentCopilotAuthentication\": \"<string>\",\n      \"oAuth2Connection\": \"<string>\"\n    }\n  },\n  \"orgDataPrivacySettings\": {\n    \"enabled\": true,\n    \"useAnalytics\": true,\n    \"storeDataPayload\": true,\n    \"useContactProfiles\": true,\n    \"useConversations\": true,\n    \"maskIPAddress\": true,\n    \"maskAnalytics\": true,\n    \"maskLogging\": true\n  }\n}")
  .asString();
```

```
require 'uri'
require 'net/http'

url = URI("https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"foreignId\": \"<string>\",\n  \"channel\": \"webchat3\",\n  \"flowId\": \"<string>\",\n  \"localeId\": \"<string>\",\n  \"URLToken\": \"f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f\",\n  \"name\": \"New Endpoint\",\n  \"entrypoint\": \"667ed4ae16d66f47dc2a9400\",\n  \"active\": true,\n  \"nluConnectorId\": \"cognigy\",\n  \"useConversations\": true,\n  \"maskIPAddress\": true,\n  \"maskAnalytics\": true,\n  \"maskLogging\": true,\n  \"useContactProfiles\": true,\n  \"useAnalytics\": true,\n  \"useDashbotAnalytics\": true,\n  \"dashbotApikey\": \"<string>\",\n  \"dashbotPlatform\": \"<string>\",\n  \"disableInputSanitization\": \"<string>\",\n  \"disableSkipUriTags\": \"<string>\",\n  \"overrideSnapshotConnections\": true,\n  \"settings\": {\n    \"accessScope\": \"<string>\",\n    \"accessToken\": \"<string>\",\n    \"appId\": \"<string>\",\n    \"appSecret\": \"<string>\",\n    \"backgroundImageUrl\": \"<string>\",\n    \"basicAuthPassword\": \"<string>\",\n    \"basicAuthUser\": \"<string>\",\n    \"botUserId\": \"<string>\",\n    \"businessHours\": {\n      \"businessHours\": [\n        {\n          \"startTime\": \"<string>\",\n          \"endTime\": \"<string>\",\n          \"weekDay\": \"<string>\"\n        }\n      ],\n      \"enabled\": true,\n      \"text\": \"<string>\",\n      \"mode\": \"<string>\",\n      \"timeZone\": \"<string>\",\n      \"title\": \"<string>\"\n    },\n    \"colorScheme\": \"<string>\",\n    \"connectionName\": \"<string>\",\n    \"customJSON\": \"<string>\",\n    \"designTemplate\": 123,\n    \"disableHtmlContentSanitization\": true,\n    \"disableInputAutocomplete\": true,\n    \"disableInputAutogrow\": true,\n    \"disableUrlButtonSanitization\": true,\n    \"enableGenericHTMLStyling\": true,\n    \"enableAsyncCommunication\": true,\n    \"engagementMessageText\": \"<string>\",\n    \"displayGetStartedButton\": true,\n    \"dynamicImageAspectRatio\": true,\n    \"enableCollectMetadata\": true,\n    \"enableConnectionStatusIndicator\": true,\n    \"enableDemoWebchat\": true,\n    \"enableFileUpload\": true,\n    \"enablePersistentMenu\": true,\n    \"enableSTT\": true,\n    \"enableTTS\": true,\n    \"enableUnreadMessageBadge\": true,\n    \"enableUnreadMessagePreview\": true,\n    \"enableUnreadMessageSound\": true,\n    \"enableUnreadMessageTitleIndicator\": true,\n    \"enableTypingIndicator\": true,\n    \"facebookPageToken\": \"<string>\",\n    \"focusInputAfterPostback\": true,\n    \"getStartedButtonText\": \"<string>\",\n    \"getStartedPayload\": \"<string>\",\n    \"getStartedText\": \"<string>\",\n    \"getStartedData\": \"<string>\",\n    \"headerLogoUrl\": \"<string>\",\n    \"hubSecret\": \"<string>\",\n    \"inputAutogrowMaxRows\": 123,\n    \"inputPlaceholder\": \"<string>\",\n    \"language\": \"<string>\",\n    \"lineChannelAccessToken\": \"<string>\",\n    \"lineChannelSecret\": \"<string>\",\n    \"maintenance\": {\n      \"enabled\": true,\n      \"mode\": \"<string>\",\n      \"text\": \"<string>\",\n      \"title\": \"<string>\"\n    },\n    \"mergeContactProfiles\": true,\n    \"messageDelay\": 123,\n    \"messageLogoUrl\": \"<string>\",\n    \"overwriteWebchatBundleUrl\": \"<string>\",\n    \"ratingTitleText\": \"<string>\",\n    \"ratingCommentText\": \"<string>\",\n    \"ratingMessageHistoryRatingText\": \"<string>\",\n    \"ratingMessageHistoryCommentText\": \"<string>\",\n    \"reparseAlexaSlots\": true,\n    \"requestFacebookProfileData\": true,\n    \"restEndpointAuthentication\": {},\n    \"sessionExpiration\": 123,\n    \"shouldOverwriteWebchatBundleUrl\": true,\n    \"showEngagementMessagesInChat\": true,\n    \"slackOAuthAccessToken\": \"<string>\",\n    \"slackVerifyToken\": \"<string>\",\n    \"sunshineConversationsChannelKeyId\": \"<string>\",\n    \"sunshineConversationsChannelSecret\": \"<string>\",\n    \"sunshineConversationsChannelUri\": \"<string>\",\n    \"tenantId\": \"<string>\",\n    \"updateContactProfileWithFacebookProfile\": true,\n    \"voice\": \"<string>\",\n    \"webhookEndpointAuthentication\": {},\n    \"webhookUrl\": \"<string>\",\n    \"skill\": {},\n    \"persistentMenu\": {}\n  },\n  \"transformer\": {\n    \"abortOnError\": true,\n    \"transformer\": \"<string>\",\n    \"transpiledTransformer\": \"<string>\",\n    \"inputTransformerEnabled\": true,\n    \"outputTransformerEnabled\": true,\n    \"finalPingTransformerEnabled\": true,\n    \"notifyTransformerEnabled\": true,\n    \"injectTransformerEnabled\": true\n  },\n  \"handoverSettings\": {\n    \"providerSettings\": {\n      \"forwardOnlyHandoverConversations\": true,\n      \"getQueueUpdates\": true,\n      \"apiVersion\": \"<string>\",\n      \"baseUrl\": \"<string>\",\n      \"apiAccessToken\": \"<string>\",\n      \"baseApiUrl\": \"<string>\",\n      \"realtimeAccessToken\": \"<string>\",\n      \"realtimeEndpointUrl\": \"<string>\",\n      \"webhookSecret\": \"<string>\",\n      \"botCategoryId\": \"<string>\",\n      \"agentCategoryId\": \"<string>\",\n      \"organizationId\": \"<string>\",\n      \"deploymentId\": \"<string>\",\n      \"buttonId\": \"<string>\"\n    },\n    \"agentAssistSettings\": {\n      \"agentAssistFlowId\": \"<string>\",\n      \"agentAssistConfigId\": \"<string>\",\n      \"enableTranscriptTile\": true,\n      \"enableTranscriptTileChatInput\": true,\n      \"redactTranscriptTileMessages\": true,\n      \"enableAgentCopilotAuthentication\": true,\n      \"blockNonJWTRequests\": true,\n      \"agentCopilotAuthentication\": \"<string>\",\n      \"oAuth2Connection\": \"<string>\"\n    }\n  },\n  \"orgDataPrivacySettings\": {\n    \"enabled\": true,\n    \"useAnalytics\": true,\n    \"storeDataPayload\": true,\n    \"useContactProfiles\": true,\n    \"useConversations\": true,\n    \"maskIPAddress\": true,\n    \"maskAnalytics\": true,\n    \"maskLogging\": true\n  }\n}"

response = http.request(request)
puts response.read_body
```

400

401

402

403

404

405

409

413

500

501

502

503

504

```
{
  "type": "Bad Request",
  "title": "Bad Request Error",
  "status": 400,
  "detail": "Validation failed. Missing payload.",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Unauthorized",
  "title": "Unauthorized Error",
  "status": 401,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 401,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Payment Required",
  "title": "Payment Required Error",
  "status": 402,
  "detail": "Validation failed. Missing payload.",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 402,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Forbidden",
  "title": "Forbidden Error",
  "status": 403,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Not Found",
  "title": "Not Found Error",
  "status": 404,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {},
  "logLevel": "error"
}
```

```
{
  "type": "Method Not Allowed",
  "title": "Method Not Allowed Error",
  "status": 405,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Conflict",
  "title": "Conflict Error",
  "status": 409,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1004,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Payload Too Large",
  "title": "Payload Too Large Error",
  "status": 413,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Internal Server Error",
  "title": "Internal Server Error",
  "status": 500,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Not Implemented",
  "title": "Not Implemented Error",
  "status": 501,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1009,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Bad Gateway",
  "title": "Bad Gateway Error",
  "status": 502,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Service Unavailable",
  "title": "Service Unavailable Error",
  "status": 503,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 503,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

```
{
  "type": "Gateway Timeout",
  "title": "Gateway Timeout Error",
  "status": 504,
  "detail": "<string>",
  "instance": "/v2.0/flows/5ce7c2d833ea1e04d7e6c432",
  "code": 1000,
  "traceId": "api--f84324f4-98eb-4f02-abdd-375a2e6c3c1f",
  "details": {}
}
```

#### Authorizations

APIKeyHeaderAPIKeyQueryParamCXoneTokenHeaderOAuth2APIKeyHeaderAPIKeyQueryParamCXoneTokenHeaderOAuth2

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#authorization-x-api-key)

X-API-Key

string

header

required

Supply the API Key in the HTTP-Header

#### Headers

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#parameter-accept)

Accept

enum<string>

The `Accept` header specifies the media type that the client expects in the response. Available options: `application/json`, `application/hal+json`, `application/xml`, `text/xml`, `text/csv`. The default value is `application/json`.

Available options:

`application/json`,

`application/hal+json`,

`application/xml`,

`text/xml`,

`text/csv`

#### Path Parameters

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#parameter-endpoint-id)

endpointId

string

required

The Id of the Endpoint

Required string length: `24`

Pattern: `^[a-z0-9]{24}$`

#### Body

application/json

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-foreign-id)

foreignId

string

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-channel)

channel

enum<string>

Available options:

`facebook`,

`alexa`,

`slack`,

`generic`,

`inject`,

`rest`,

`realtime`,

`socket`,

`adminconsole`,

`webchat2`,

`dialogflow`,

`twilio`,

`twilio-sms`,

`line`,

`intercom`,

`microsoftBotFramework`,

`microsoftTeams`,

`sunshineConversations`,

`admin-webchat`,

`avaya`,

`nonConversational`,

`voiceGateway2`,

`amazonLex`,

`workplace`,

`webhook`,

`abstractRest`,

`userlike`,

`ringCentralEngage`,

`audioCodes`,

`bandwidth`,

`whatsapp`,

`eightByEight`,

`genesysBotConnector`,

`niceCXOne`,

`agentAssistVoice`,

`webchat3`,

`niceCXOneAAH`,

`zoomContactCenter`,

`mcpServer`

Example:

`"webchat3"`

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-flow-id)

flowId

string

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-locale-id)

localeId

string

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-url-token)

URLToken

string

The URLToken of the endpoint

Example:

`"f65b289912c929c2a09523dd48eedb1249bb74384f6561f84b4ffc5e84d2f15f"`

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-name)

name

string

The name of the endpoint

Example:

`"New Endpoint"`

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-entrypoint)

entrypoint

string

The ID can be either a Snapshot ID or a Project ID. The Endpoint will refer to the chosen one.

Example:

`"667ed4ae16d66f47dc2a9400"`

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-active)

active

boolean

Toggle whether the endpoint is active or not

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-nlu-connector-id-one-of-0)

nluConnectorId

enum<string>stringenum<string>string

The NLU Connector type.

Available options:

`alexa`,

`dialogflow`,

`dialogflowBuiltIn`,

`amazonLexBuiltIn`,

`luis`,

`watson`,

`noNlu`,

`cognigy`,

`code`,

`generativeAI`,

`lex`

Example:

`"cognigy"`

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-use-conversations)

useConversations

boolean

Whether to collect conversations history for this endpoint

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-mask-ip-address)

maskIPAddress

boolean

Whether to mask sensitive IP address in input object and analytics data for this endpoint

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-mask-analytics)

maskAnalytics

boolean

Whether to mask sensitive data in analytics for this endpoint

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-mask-logging)

maskLogging

boolean

Whether to mask sensitive data in logs for this endpoint

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-use-contact-profiles)

useContactProfiles

boolean

Whether to use contact profiles for this endpoint

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-use-analytics)

useAnalytics

boolean

Whether we should store analytics for this endpoint

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-use-dashbot-analytics)

useDashbotAnalytics

boolean

Whether we should use Dashbot to collect analytics

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-dashbot-apikey)

dashbotApikey

string

The apikey for the dashbot bot

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-dashbot-platform)

dashbotPlatform

string

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-disable-input-sanitization)

disableInputSanitization

string

If true, disables input text sanitization after Input Transformer

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-disable-skip-uri-tags)

disableSkipUriTags

string

If true, disables skipping of uri tags

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-override-snapshot-connections)

overrideSnapshotConnections

boolean

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-settings)

settings

object

Showchild attributes

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-transformer)

transformer

object

Showchild attributes

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-handover-settings)

handoverSettings

object

Showchild attributes

[​](https://docs.cognigy.com/api-reference/endpoints/update-an-endpoint#body-org-data-privacy-settings)

orgDataPrivacySettings

object

Organisation data privacy settings overwrite the ones defined on endpoint-level

Showchild attributes

#### Response

200

The Endpoint was updated successfully.

Last modified onJuly 8, 2026

[Previous](https://docs.cognigy.com/api-reference/endpoints/delete-an-endpoint) [List Endpoint API KeysLists all API keys configured on the given Webhook/Generic Endpoint. The response never contains the SHA-256 hash or the plaintext key — only the masked preview, name, id, and creation timestamp.\\
\\
Next](https://docs.cognigy.com/api-reference/endpoints/list-endpoint-api-keys)

Ctrl+I

Update an Endpoint

cURL

```
import requests

url = "https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}"

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
```

```
<?php

$curl = curl_init();

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

```
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

url := "https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}"

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
	req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
```

```
require 'uri'
require 'net/http'

url = URI("https://api-trial.cognigy.ai/new/v2.0/endpoints/{endpointId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

response = http.request(request)
puts response.read_body
```

400

401

402

403

404

405

409

413

500

501

502

503

504

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 });
 }
 });
 }
 }
})();
