Delete labels from apps (v2)

To delete labels from your apps using the New Relic REST API, substitute your account's REST API key or Admin user's API key for ${API_KEY} in this example.

This API call will remove all instances of the label from both applications and hosts. If you want to remove a label from a specific application or host, you must use the New Relic user interface.

Delete labels

Use a command similar to the following example to delete a label from your account.

curl -X DELETE 'https://api.newrelic.com/v2/labels/Production:Main.json' \
     -H "X-Api-Key:${API_KEY}" -i

You can also use the New Relic REST API Explorer (v2) to delete labels.

View the output

The output for deleting a label will appear similar to the following example for a single application. This example will delete the label Production:Main from all locations where it was applied for the account's REST API key.

The output for deleting labels includes:

  • The full key name for the label (for example, Production:Main), as well as the component and name for the key
  • The application health_status (red, orange, green, gray) and the IDs for the label in each category; for example, the health status for app ID 546917 is green (the app is fine)
  • Apps that have this label; for example, the label Production:Main has been removed from one application (546917)
{
  "label": {
    "key": "Production:Main",
    "category": "Production",
    "name": "Main",
    "application_health_status": {
      "green": [
        546917
      ],
      "orange": [],
      "red": [],
      "gray": []
    },
    "links": {
      "applications": [
        546917
      ],
    }
  },
  ....
}

Review return status

There are two possible return statuses when deleting labels:

Return status Definition
200 OK An attempt to delete a label was successful.
404 Not Modified An attempt was made to delete a non-existent label.

For more help

Recommendations for learning more: