• Home
  • Dynatrace API
  • Environment
  • Metrics v2
  • DELETE a custom metric

Metrics API - DELETE a custom metric

Deletes the specified custom ingested metric. Deletion cannot be undone!

  • You can't delete a metric if it has data points ingested within the last two hours.
  • You can only delete metrics that have been ingested via the Metrics v2 API.
DELETEManagedDynatrace for Governmenthttps://{your-domain}/e/{your-environment-id}/api/v2/metrics/{metricKey}
SaaShttps://{your-environment-id}.live.dynatrace.com/api/v2/metrics/{metricKey}
Environment ActiveGatehttps://{your-activegate-domain}/e/{your-environment-id}/api/v2/metrics/{metricKey}

Authentication

To execute this request, you need an access token with metrics.write scope.

To learn how to obtain and use it, see Tokens and authentication.

Parameters

ParameterTypeDescriptionInRequired
metricKeystring

The key of the required metric.

pathrequired

Response

Response codes

CodeDescription
202

Success. The deletion of the metric has been triggered.

400

Failed. The metric has been written within the last two hours.

404

Failed. The metric cannot be found or the key cannot be parsed.

500

Failed. The deletion of metric dimensions failed.

Example

In this example, the request deletes the cpu.temperature metric. The response code of 202 indicates that the deletion has been triggered successfully.

The API token is passed in the Authorization header.

Curl

bash
curl --request DELETE \ --url https://mySampleEnv.live.dynatrace.com/api/v2/metrics/cpu.temperature \ --header 'Authorization: Api-Token dt0c01.abc123.abcdefjhij1234567890'

Request URL

plaintext
https://mySampleEnv.live.dynatrace.com/api/v2/metrics/cpu.temperature

Response code

202

Related topics
  • Extend metric observability

    Learn how to extend metric observability in Dynatrace.