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.

DELETE
  • Managed https://{your-domain}/e/{your-environment-id}/api/v2/metrics/{metricKey}
  • SaaS https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/{metricKey}
  • Environment ActiveGate https://{your-activegate-domain}/e/{your-environment-id}/api/v2/metrics/{metricKey}

Authentication

To execute this request, you need the Write metrics (metrics.write) permission assigned to your API token. To learn how to obtain and use it, see Tokens and authentication.

Parameters

Parameter Type Description In Required
metricKey string

The key of the required metric.

path required

Response

Response codes

Code Description
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.

Response body

A successful request doesn't return any content.

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

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

Request URL

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

Response code

202