Currently New Relic supports two versions of the synthetic monitoring API: v1 and v3. Version 3 was released October 2016. Version 1 is deprecated and will eventually no longer be available. No termination date has been announced. However, no further development or modifications will be made to v1.
Recommendation: Create new monitors using the v3 synthetics API and migrate v1 scripts to their v3 equivalent.
To use the REST API for New Relic's synthetic monitoring, you must activate API access and generate your Admin User's API key from your account settings. Then you can make standard API calls via the command line.
Managing simple and scripted monitors
You must use your Admin User's API key to make synthetics REST API calls. The account's REST API key will not work.
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.
These examples show curl commands:
Managing scripted monitors
In addition to the general API, there are several API methods for the scripted browser (
SCRIPT_BROWSER) and api test (
SCRIPT_API) monitor types.
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.
Here are the attributes used with Synthetics REST API calls, listed in alphabetical order.
Synthetics API attribute
String: The version number.
Array of strings: Email addresses for alert notifications with New Relic.
Integer: Number of minutes between checks. Valid values include 1, 5, 15, 30, 60, 360, 720, and 1440.
The UUID for the specific synthetic monitor.
Array of strings: Array of locations by full label.
String: The monitor's name.
String: The BASE64 encoded text for scripted monitors.
Double: Value for the Synthetics SLA report, in seconds.
String: Valid values include
String: Type of monitor. Valid values include:
String: The URI for
Integer: The specific user ID.
Specific monitor endpoint
When making REST API calls for a specific monitor, include the
monitor_uuid as part of the endpoint. The
monitor_uuid is the GUID which is part of the URL. For example, a selected synthetics monitor has this URL:
monitor_uuid is the value that follows