---
title: Manage scripted browser monitors
source: https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/scripted-browser-monitor
---

New Relic allows you use NerdGraph to create [scripted browser monitors](https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/scripting-monitors/introduction-scripted-browser-monitors). Scripted browser monitors execute custom JavaScript code in a real browser environment, allowing you to simulate complex user interactions and multi-step workflows. This tutorial provides examples of how to use the NerdGraph API to automate the creation of scripted browser monitors.

## Create a scripted browser monitor [#create-scripted-browser]

You can create a scripted browser monitor using the `syntheticsCreateScriptBrowserMonitor` mutation. This mutation allows you to set up custom scripted monitoring that executes your JavaScript code in a browser.

### Input parameters

| Parameter                                                    | Data Type | Is it Required? | Description                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------ | --------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `accountId`                                                  | Integer   | Yes             | Your New Relic [account ID](https://docs.newrelic.com/docs/accounts/accounts-billing/account-structure/account-id) where the monitor will be created.                                                                                                                                                                                                                                  |
| `monitor.browsers`                                           | Array     | Yes             | Browser(s) that the monitor will use to execute jobs. Supported browsers: `CHROME`, `FIREFOX`.                                                                                                                                                                                                                                                                                         |
| `monitor.devices`                                            | Array     | Yes             | Devices that the monitor will use to execute jobs. Supported devices: `DESKTOP`, `MOBILE_LANDSCAPE`, `MOBILE_PORTRAIT`, `TABLET_LANDSCAPE`, `TABLET_PORTRAIT`.                                                                                                                                                                                                                         |
| `monitor.locations`                                          | Object    | Yes             | The geographic locations where the monitor will execute. `monitor.location` allows two values: private locations and public locations. You can select either private locations, public locations, or both:• `private`: Private location GUIDs (e.g., `{ private: ["PRIVATE_LOCATION_GUID"] }`)• `public`: Public location identifiers (e.g., `{ public: ["US_EAST_1", "US_WEST_1"] }`) |
| `monitor.name`                                               | String    | Yes             | The display name for your scripted browser monitor.                                                                                                                                                                                                                                                                                                                                    |
| `monitor.period`                                             | Enum      | Yes             | How often the monitor runs. Options: `EVERY_MINUTE`, `EVERY_5_MINUTES`, `EVERY_10_MINUTES`, `EVERY_15_MINUTES`, `EVERY_30_MINUTES`, `EVERY_HOUR`, `EVERY_6_HOURS`, `EVERY_12_HOURS`, `EVERY_DAY`.                                                                                                                                                                                      |
| `monitor.runtime.runtimeType`                                | String    | Yes             | The runtime type used by your monitor. `CHROME_BROWSER` is the only accepted value.                                                                                                                                                                                                                                                                                                    |
| `monitor.runtime.runtimeTypeVersion`                         | String    | Yes             | The runtime type version used by your monitor. Use `LATEST` to automatically use the most recent Chrome version (recommended). Older specific versions like `134` or `140` are also accepted but will be deprecated.                                                                                                                                                                   |
| `monitor.runtime.scriptLanguage`                             | String    | Yes             | The language used in your monitor. `JAVASCRIPT` is the only accepted value.                                                                                                                                                                                                                                                                                                            |
| `monitor.script`                                             | String    | Yes             | The JavaScript code that the monitor executes. This should be plain text, not base64 encoded. The script can use Selenium WebDriver APIs to control the browser.                                                                                                                                                                                                                       |
| `monitor.status`                                             | Enum      | Yes             | The monitor status. Options: `ENABLED` (monitor is active and performing checks), `DISABLED` (monitor is inactive).                                                                                                                                                                                                                                                                    |
| `monitor.advancedOptions.enableScreenshotOnFailureAndScript` | Boolean   | No              | Captures a screenshot during job execution when a failure occurs or a script is executed.                                                                                                                                                                                                                                                                                              |
| `monitor.apdexTarget`                                        | Float     | No              | The monitor's Apdex target in seconds, used to populate SLA reports. Defaults to 7.0 seconds.                                                                                                                                                                                                                                                                                          |

### Sample request

```graphql
mutation {
  syntheticsCreateScriptBrowserMonitor(
    accountId: ACCOUNT_ID
    monitor: {
      browsers: [BROWSERS]
      devices: [DEVICES]
      locations: { public: ["LOCATION_1", "LOCATION_2"] }
      name: "MONITOR_NAME"
      period: PERIOD
      runtime: {
        runtimeType: "RUNTIME_TYPE"
        runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
        scriptLanguage: "SCRIPT_LANGUAGE"
      }
      script: "SCRIPT_CONTENT"
      status: STATUS
      advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT }
      apdexTarget: APDEX_TARGET
    }
  ) {
    errors {
      description
      type
    }
  }
}
```

### Sample response

A successful response returns `null` for errors:

```json
{
  "data": {
    "syntheticsCreateScriptBrowserMonitor": {
      "errors": null
    }
  }
}
```

If there are any issues creating the monitor, the `errors` array will contain objects with `description` and `type` fields explaining what went wrong.

## Update a scripted browser monitor [#update-scripted-browser]

You can update an existing scripted browser monitor using the `syntheticsUpdateScriptBrowserMonitor` mutation. This allows you to modify the configuration of a scripted browser monitor that has already been created.

### Input parameters

| Parameter                                                    | Data Type | Is it Required? | Description                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------ | --------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `guid`                                                       | String    | Yes             | The unique entity [GUID](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/query-synthetics-data#query-monitors) of the monitor you want to update.                                                                                                                                                                                                                            |
| `monitor.browsers`                                           | Array     | No              | Browser(s) that the monitor will use to execute jobs. Supported browsers: `CHROME`, `FIREFOX`.                                                                                                                                                                                                                                                                                                     |
| `monitor.devices`                                            | Array     | No              | Devices that the monitor will use to execute jobs. Supported devices: `DESKTOP`, `MOBILE_LANDSCAPE`, `MOBILE_PORTRAIT`, `TABLET_LANDSCAPE`, `TABLET_PORTRAIT`.                                                                                                                                                                                                                                     |
| `monitor.locations`                                          | Object    | No              | The geographic locations where the monitor will execute. `monitor.location` allows two values. 1. is private locations and 2. is public locations. You can select either private locations, public locations, or both:• `private`: Private location GUIDs (e.g., `{ private: ["PRIVATE_LOCATION_GUID"] }`)• `public`: Public location identifiers (e.g., `{ public: ["US_EAST_1", "US_WEST_1"] }`) |
| `monitor.name`                                               | String    | No              | The updated display name for your scripted browser monitor.                                                                                                                                                                                                                                                                                                                                        |
| `monitor.period`                                             | Enum      | No              | How often the monitor runs. Options: `EVERY_MINUTE`, `EVERY_5_MINUTES`, `EVERY_10_MINUTES`, `EVERY_15_MINUTES`, `EVERY_30_MINUTES`, `EVERY_HOUR`, `EVERY_6_HOURS`, `EVERY_12_HOURS`, `EVERY_DAY`.                                                                                                                                                                                                  |
| `monitor.runtime.runtimeType`                                | String    | No              | The runtime type used by your monitor. `CHROME_BROWSER` is the only accepted value.                                                                                                                                                                                                                                                                                                                |
| `monitor.runtime.runtimeTypeVersion`                         | String    | No              | The runtime type version used by your monitor. Use `LATEST` to automatically use the most recent Chrome version (recommended). Older specific versions like `134` or `140` are also accepted but will be deprecated.                                                                                                                                                                               |
| `monitor.runtime.scriptLanguage`                             | String    | No              | The language used in your monitor. `JAVASCRIPT` is the only accepted value.                                                                                                                                                                                                                                                                                                                        |
| `monitor.script`                                             | String    | No              | The JavaScript code that the monitor executes. This should be plain text, not base64 encoded.                                                                                                                                                                                                                                                                                                      |
| `monitor.status`                                             | Enum      | No              | The monitor status. Options: `ENABLED` (monitor is active and performing checks), `DISABLED` (monitor is inactive).                                                                                                                                                                                                                                                                                |
| `monitor.advancedOptions.enableScreenshotOnFailureAndScript` | Boolean   | No              | Captures a screenshot during job execution when a failure occurs or a script is executed.                                                                                                                                                                                                                                                                                                          |
| `monitor.apdexTarget`                                        | Float     | No              | The monitor's Apdex target in seconds, used to populate SLA reports. Defaults to 7.0 seconds.                                                                                                                                                                                                                                                                                                      |

### Sample request

```graphql
mutation {
  syntheticsUpdateScriptBrowserMonitor(
    guid: ENTITY_GUID
    monitor: {
      browsers: [BROWSERS]
      devices: [DEVICES]
      locations: { public: ["LOCATION_1", "LOCATION_2"] }
      name: "MONITOR_NAME"
      period: PERIOD
      runtime: {
        runtimeType: "RUNTIME_TYPE"
        runtimeTypeVersion: "RUNTIME_TYPE_VERSION"
        scriptLanguage: "SCRIPT_LANGUAGE"
      }
      script: "SCRIPT_CONTENT"
      status: STATUS
      advancedOptions: { enableScreenshotOnFailureAndScript: ENABLE_SCREENSHOT }
      apdexTarget: APDEX_TARGET
    }
  ) {
    errors {
      description
      type
    }
  }
}
```

### Sample response

A successful response returns `null` for errors:

```json
{
  "data": {
    "syntheticsUpdateScriptBrowserMonitor": {
      "errors": null
    }
  }
}
```

If there are any issues updating the monitor, the `errors` array will contain objects with `description` and `type` fields explaining what went wrong.

## Upgrade a scripted browser monitor's runtime [#upgrade-monitor-runtime]

You can upgrade a scripted browser monitor to use the newer Chrome runtime. We recommend using the `LATEST` version to ensure your monitor automatically stays up-to-date with the most recent Chrome releases.

> #### ⚠️ IMPORTANT
>
> **Chrome version management**: New Relic is transitioning to a `LATEST` version model for Chrome runtimes. Specific Chrome versions (such as 134 and 140) will reach end-of-life and only `LATEST` will be maintained going forward. On **Aug 18, 2026**, monitors still on older Chrome versions will be force upgraded to the latest stable version (Chrome 147 or higher). When Chrome releases a new version, it will be available in scripted browser monitors as `LATEST` within one week. To ensure your monitors automatically receive the latest Chrome updates and features, upgrade to `runtimeTypeVersion: "LATEST"` before this date.

### Input parameters

| Parameter                            | Data Type | Is it Required? | Description                                                                                                                                                                                |
| ------------------------------------ | --------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `guid`                               | String    | Yes             | The unique entity [GUID](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/query-synthetics-data#query-monitors) of the monitor you want to upgrade.                   |
| `monitor.runtime.runtimeType`        | String    | Yes             | The runtime type. `CHROME_BROWSER` is the only accepted value.                                                                                                                             |
| `monitor.runtime.runtimeTypeVersion` | String    | Yes             | The runtime version. Use `LATEST` to automatically use the most recent Chrome version (recommended). Older specific versions like `134` or `140` are also accepted but will be deprecated. |
| `monitor.runtime.scriptLanguage`     | String    | Yes             | The scripting language. `JAVASCRIPT` is the only accepted value.                                                                                                                           |

### Sample request

Upgrade to the LATEST Chrome version (recommended):

```graphql
mutation {
  syntheticsUpdateScriptBrowserMonitor(
    guid: "ENTITY_GUID"
    monitor: {
      runtime: {
        runtimeType: "CHROME_BROWSER"
        runtimeTypeVersion: "LATEST"
        scriptLanguage: "JAVASCRIPT"
      }
    }
  ) {
    errors {
      description
      type
    }
  }
}
```

### Sample response

A successful response returns `null` for errors:

```json
{
  "data": {
    "syntheticsUpdateScriptBrowserMonitor": {
      "errors": null
    }
  }
}
```

If there are any issues upgrading the monitor runtime, the `errors` array will contain objects with `description` and `type` fields explaining what went wrong.

## Delete a scripted browser monitor [#delete-monitor]

When a scripted browser monitor is no longer needed, you can permanently remove it using the `syntheticsDeleteMonitor` mutation.

To delete a monitor, refer to the [Delete Synthetic monitor](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/ping-monitor/#delete-monitor) section.

## Query scripted browser monitors [#query-scripted-browser-monitors]

Use NerdGraph to retrieve metadata, scripts, map IDs, or check the status of your scripted browser monitors.

For more information, refer to:

-   [Query all monitors](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/query-synthetics-data#query-monitors): To list all synthetic monitors and their configurations.
-   [Map monitor ID to entity GUID](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/query-synthetics-data#query-guid-mapping): To migrate legacy monitor IDs to entity GUIDs.
-   [Runtime upgrade status](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/query-synthetics-data#query-runtime-upgrade-all): To check if your monitors are ready for the latest runtime upgrades.
-   [Query monitor script](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/query-synthetics-data#query-monitor-script) - Retrieve JavaScript code from scripted monitors.

To view complete list of query examples, refer to the [Query synthetics data](https://docs.newrelic.com/docs/apis/nerdgraph/examples/synthetics-api/query-synthetics-data) document.
