Important
The REST API for labels has reached end of life as of June 30, 2022 (extended from March 31, 2022). For more information, see our documentation about tags and our Support Forum post about the EOL.
List existing labels
To list the labels that exist in your account, use this command:
curl 'https://api.newrelic.com/v2/labels.json' \ -H "Api-Key:NEW_RELIC_USER_KEY" -i
View the output
The output for the label includes:
- The full key name for the label (for example,
Staging:Test1
), as well as the component and name for the key - The application
health_status
(red, orange, green, gray) and application IDs for the label in each category - Apps that have this label; for example, the label
Staging:Test1
has been applied to one application (4937390) and two hosts (3801143 and 5879721)
The output for a label listing will appear similar to this:
{ "labels": [ { "key": "Production:Main", "category": "Production", "name": "Main", "application_health_status": { "green": [], "orange": [], "red": [], "gray": [] }, "links": { "applications": [], } }, { "key": "Staging:Test1", "category": "Staging", "name": "Test1", "application_health_status": { "green": [], "orange": [], "red": [ 4937390 ], "gray": [] }, "links": { "applications": [ 4937390 ], } },...}