New Relic One already has the capability to unify the tools you use to tag (or label) your services, applications, and monitors. As of July 20, 2020, the New Relic One tagging functionality will replace synthetic labels and the ability to organize Synthetics and APM tags into groups.
You can start migrating to this change now. (As of July 8, 2020, automatic migration begins for existing Synthetics tags.) For more information, including how to migrate your existing tags through the UI or NerdGraph tagging API, see New Relic's Explorers Hub post.
You can make API calls for synthetic monitors or for monitor labels. These examples show curl commands.
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 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.
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 '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 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
- Dissociate a label from a monitor
curl -v -X DELETE -H 'X-Api-Key:Admin_User_Key' https://synthetics.newrelic.com/synthetics/api/v4/monitors/monitor_uuid/labels/category:label