• /
  • Log in

Manage synthetic monitors via REST API

Use the Synthetics REST API to create and manage synthetic monitors of all types: ping, simple browser, scripted browser, and API test monitors. All synthetic monitoring data is available via the REST API.

To use the Synthetics REST API, you must have a user role that allows that capability and a user key.

For an overview of all available New Relic APIs, see Intro to APIs.

Features

The newest version of the Synthetics API (v3) adds these features:

Synthetics API (v3)

Features

Options field for POST and PUT request

You can specify the options for SIMPLE and BROWSER type monitors, similar to the way these options are available in the UI.

PATCH request

You can update only the fields of a monitor you want to change, rather than having to specify the entire monitor entity in a PUT. You can also specify the OPTION, assuming you are using the appropriate type of monitor.

More detail with 400 Bad Request errors

As of v3, the Synthetics API attempts to return as much information as possible when a validation failure occurs. This will help you figure out what might be wrong with the request. The API runs all validations and returns any failed validation messages, rather than failing on the first validation error as occurred in previous API versions.

Pagination

Large API responses are properly paginated.

You can also use NRQL queries to analyze past changes made via the API.

Monitor types in API

These are the monitor types and how they're referred to in the API:

Monitor type

API name

Ping

SIMPLE

Simple browser

BROWSER

Scripted browser

SCRIPT_BROWSER

API test

SCRIPT_API

Use the API

To use the Synthetics REST API, you must have the ability to manage synthetics monitors and use a user key (the REST API key won't work).

This API can be used for all Synthetics monitors. (Additional API methods for scripted browser and API test monitors are also available to update the script associated with those monitors.) All Synthetics data is available via the API. API examples show cURL commands.

For US-based accounts, use the following endpoint:

https://synthetics.newrelic.com/synthetics/api

For EU-based accounts, use the following endpoint:

https://synthetics.eu.newrelic.com/synthetics/api

Caution

The Synthetics REST API limits an account's rate of requests to three requests per second. Requests made in excess of this threshold will return a 429 response code.

Script API for scripted browser and API test monitors

In addition to the general API, there are several API methods for the scripted browsers (SCRIPT_BROWSER) and API test browsers (SCRIPT_API). These examples show cURL commands.

Scripted browser example

Here is an example of using New Relic's REST API and the bash script to create a scripted browser monitor.

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.