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.
DELETESaaShttps://{your-environment-id}.live.dynatrace.com/api/v2/metrics/{metricKey}
Environment ActiveGateCluster ActiveGatehttps://{your-activegate-domain}:9999/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

Parameter
Type
Description
In
Required
metricKey
string

The key of the required metric.

path
required

Response

Response codes

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

4XX

Client side error.

5XX

Server side error.

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