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

New Relic allows you use NerdGraph to create [ping monitors](https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/using-monitors/add-edit-monitors) (also known as simple monitors). Ping monitors check if a URL or endpoint is accessible by making HTTP requests at regular intervals. This tutorial provides examples of how to use the NerdGraph API to automate the creation of ping monitors.

## Create a ping monitor [#create-ping-monitor]

You can create a ping monitor using the `syntheticsCreateSimpleMonitor` mutation. This mutation allows you to configure monitoring for any publicly accessible URL or endpoint.

### 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.locations.public`                       | Array     | Yes             | Array of [public location](https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/using-monitors/add-edit-monitors/#setting-location) identifiers where the monitor will run checks (e.g., `["US_EAST_1", "US_WEST_1"]`). |
| `monitor.name`                                   | String    | Yes             | The display name for your ping 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.status`                                 | Enum      | Yes             | The monitor status. Options: `ENABLED` (monitor is active and performing checks), `DISABLED` (monitor is inactive).                                                                                                               |
| `monitor.uri`                                    | String    | Yes             | The URL or endpoint to monitor (e.g., `https://example.com`).                                                                                                                                                                     |
| `monitor.advancedOptions.responseValidationText` | String    | No              | Text that must appear in the response for the check to pass. If specified, the monitor will fail if this text is not found in the response body.                                                                                  |
| `monitor.advancedOptions.useTlsValidation`       | Boolean   | No              | Whether to validate the TLS/SSL certificate. Set to `true` to verify the validity of the SSL certificate chain.                                                                                                                   |
| `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 {
  syntheticsCreateSimpleMonitor(
    accountId: ACCOUNT_ID
    monitor: {
      locations: { public: ["LOCATION_1", "LOCATION_2"] }
      name: "YOUR_MONITOR_NAME"
      period: PERIOD
      status: STATUS
      uri: "MONITORED_URI"
      advancedOptions: {
        customHeaders: { name: "HEADER_NAME", value: "HEADER_VALUE" }
        redirectIsFailure: REDIRECT_IS_FAILURE
        responseValidationText: "VALIDATION_TEXT"
        shouldBypassHeadRequest: BYPASS_HEAD_REQUEST
        useTlsValidation: TLS_VALIDATION
      }
      apdexTarget: APDEX_TARGET
    }
  ) {
    errors {
      description
      type
    }
  }
}
```

### Sample response

A successful response returns `null` for errors:

```json
{
  "data": {
    "syntheticsCreateSimpleMonitor": {
      "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 ping monitor [#update-ping-monitor]

You can update an existing ping monitor using the `syntheticsUpdateSimpleMonitor` mutation. This allows you to modify the configuration of a ping 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.locations.public`                        | Array     | No              | Array of [public location](https://docs.newrelic.com/docs/synthetics/synthetic-monitoring/using-monitors/add-edit-monitors/#setting-location) identifiers where the monitor will run checks (e.g., `["US_EAST_1", "US_WEST_1"]`). |
| `monitor.name`                                    | String    | No              | The updated display name for your ping 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.status`                                  | Enum      | No              | The monitor status. Options: `ENABLED` (monitor is active and performing checks), `DISABLED` (monitor is inactive).                                                                                                               |
| `monitor.uri`                                     | String    | No              | The URL or endpoint to monitor (e.g., `https://example.com`).                                                                                                                                                                     |
| `monitor.advancedOptions.customHeaders`           | Object    | No              | Custom HTTP headers to include in the request. Each header has a `name` and `value` property.                                                                                                                                     |
| `monitor.advancedOptions.redirectIsFailure`       | Boolean   | No              | If `true`, the monitor will treat HTTP redirects (3xx status codes) as failures.                                                                                                                                                  |
| `monitor.advancedOptions.responseValidationText`  | String    | No              | Text that must appear in the response for the check to pass. If specified, the monitor will fail if this text is not found in the response body.                                                                                  |
| `monitor.advancedOptions.shouldBypassHeadRequest` | Boolean   | No              | If `true`, the monitor will skip the initial HEAD request and only make a GET request.                                                                                                                                            |
| `monitor.advancedOptions.useTlsValidation`        | Boolean   | No              | Whether to validate the TLS/SSL certificate. Set to `true` to verify the validity of the SSL certificate chain.                                                                                                                   |
| `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 {
  syntheticsUpdateSimpleMonitor(
    guid: "ENTITY_GUID"
    monitor: {
      locations: { public: ["LOCATION_1", "LOCATION_2"] }
      name: "YOUR_MONITOR_NAME"
      period: PERIOD
      status: STATUS
      uri: "MONITORED_URI"
      advancedOptions: {
        customHeaders: { name: "HEADER_NAME", value: "HEADER_VALUE" }
        redirectIsFailure: REDIRECT_IS_FAILURE
        responseValidationText: "VALIDATION_TEXT"
        shouldBypassHeadRequest: BYPASS_HEAD_REQUEST
        useTlsValidation: TLS_VALIDATION
      }
      apdexTarget: APDEX_TARGET
    }
  ) {
    errors {
      description
      type
    }
  }
}
```

### Sample response

A successful response returns `null` for errors:

```json
{
  "data": {
    "syntheticsUpdateSimpleMonitor": {
      "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.

## Delete a synthetic monitor [#delete-monitor]

This API allows you to delete an existing monitor using the `syntheticsDeleteMonitor` mutation with the guid parameter.

### 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 delete. |

### Sample request

```graphql
mutation {
  syntheticsDeleteMonitor(
    guid: "ENTITY_GUID"
  ) {
    deletedGuid
  }
}
```

### Sample response

A successful deletion returns the GUID of the deleted monitor:

```json
{
  "data": {
    "syntheticsDeleteMonitor": {
      "deletedGuid": "ENTITY_GUID"
    }
  }
}
```

If there are any issues deleting the monitor, an error will be returned with details about what went wrong.

## Query ping monitors [#query-ping-monitors]

Use NerdGraph to retrieve metadata, map IDs, or check the status of your ping 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.

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.
