On July 20, 2020, our tagging implementation replaced labels, which means that using the REST API for labels/tags is deprecated. For more information on this change, see this Explorers Hub post. To learn how to use tags, see Tags.
You can make API calls for synthetic monitors or for monitor labels. These examples show curl commands.
The use of the REST API for labels/tags is deprecated. For current recommendations for how to add tags, see Tags.
You can user the user 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.
- Add a label to a monitor
curl -v -X POST -H 'Api-Key:NEW_RELIC_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 that have the same label, replace category:label in the following example with the specific value.
curl -v -H 'Api-Key:NEW_RELIC_USER_KEY' https://synthetics.newrelic.com/synthetics/api/v4/monitors/labels/category:label
- Dissociate a label from a monitor
curl -v -X DELETE -H 'Api-Key:NEW_RELIC_USER_KEY' https://synthetics.newrelic.com/synthetics/api/v4/monitors/monitor_uuid/labels/category:label