Use Synthetics label APIs

Owner or Admins

You can make API calls for Synthetics monitors or for monitor labels. These examples show cURL commands.

Requirements

Access to this feature depends on your subscription level.

To use the REST API for New Relic Synthetics, you must activate API access and generate your Admin User's API key from your account settings. Then you can make standard API calls from the command line.

You must use your Admin User's API key to make Synthetics REST API calls. The account's REST API key will not work.

API examples

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.

Add a label to a monitor

To add a label to a monitor in New Relic Synthetics, replace the {monitor_uuid} and {category:label} in the following example with your specific values.

curl -v -X POST -H 'X-Api-Key:{Admin_User_Key}' -H 'Content-Type: application/json'  https://synthetics.newrelic.com/synthetics/api/v4/monitors/{monitor_uuid}/labels -d '{category:label}'
Get all monitors using a specific label

To view a list of all monitors in New Relic Synthetics that have the same label, replace {category:label} in the following example with the specific value.

curl -v -H 'X-Api-Key:{Admin_User_Key}' https://synthetics.newrelic.com/synthetics/api/v4/monitors/labels/{category:label}
Delete a label from a monitor

To delete a label from an existing monitor in New Relic Synthetics, replace the {monitor_uuid} and {category:label} in the following example with your specific values.

curl -v -X DELETE -H 'X-Api-Key:{Admin_User_Key}' https://synthetics.newrelic.com/synthetics/api/v4/monitors/{monitor_uuid}/labels/{category:label}

For more help

Recommendations for learning more: