---
title: Delete tags for multiple metrics
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Metrics
---

# Delete tags for multiple metrics{% #delete-tags-for-multiple-metrics %}

{% tab title="v2" %}

| Datadog site      | API endpoint                                                         |
| ----------------- | -------------------------------------------------------------------- |
| ap1.datadoghq.com | DELETE https://api.ap1.datadoghq.com/api/v2/metrics/config/bulk-tags |
| ap2.datadoghq.com | DELETE https://api.ap2.datadoghq.com/api/v2/metrics/config/bulk-tags |
| app.datadoghq.eu  | DELETE https://api.datadoghq.eu/api/v2/metrics/config/bulk-tags      |
| app.ddog-gov.com  | DELETE https://api.ddog-gov.com/api/v2/metrics/config/bulk-tags      |
| us2.ddog-gov.com  | DELETE https://api.us2.ddog-gov.com/api/v2/metrics/config/bulk-tags  |
| app.datadoghq.com | DELETE https://api.datadoghq.com/api/v2/metrics/config/bulk-tags     |
| us3.datadoghq.com | DELETE https://api.us3.datadoghq.com/api/v2/metrics/config/bulk-tags |
| us5.datadoghq.com | DELETE https://api.us5.datadoghq.com/api/v2/metrics/config/bulk-tags |

### Overview

Delete all custom lists of queryable tag keys for a set of existing count, gauge, rate, and distribution metrics. Metrics are selected by passing a metric name prefix. Results can be sent to a set of account email addresses, just like the same operation in the Datadog web app. Can only be used with application keys of users with the `Manage Tags for Metrics` permission. This endpoint requires the `metric_tags_write` permission.

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field | Field                  | Type     | Description                                                                                 |
| ------------ | ---------------------- | -------- | ------------------------------------------------------------------------------------------- |
|              | data [*required*] | object   | Request object to bulk delete all tag configurations for metrics matching the given prefix. |
| data         | attributes             | object   | Optional parameters for bulk deleting metric tag configurations.                            |
| attributes   | emails                 | [string] | A list of account emails to notify when the configuration is applied.                       |
| data         | id [*required*]   | string   | A text prefix to match against metric names.                                                |
| data         | type [*required*] | enum     | The metric bulk configure tags resource. Allowed enum values: `metric_bulk_configure_tags`  |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "emails": [
        "sue@example.com",
        "bob@example.com"
      ]
    },
    "id": "kafka.lag",
    "type": "metric_bulk_configure_tags"
  }
}
```

{% /tab %}

### Response

{% tab title="202" %}
Accepted
{% tab title="Model" %}
Wrapper for a single bulk tag configuration status response.

| Parent field | Field                  | Type     | Description                                                                                                                                                                                                            |
| ------------ | ---------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data                   | object   | The status of a request to bulk configure metric tags. It contains the fields from the original request for reference.                                                                                                 |
| data         | attributes             | object   | Optional attributes for the status of a bulk tag configuration request.                                                                                                                                                |
| attributes   | emails                 | [string] | A list of account emails to notify when the configuration is applied.                                                                                                                                                  |
| attributes   | exclude_tags_mode      | boolean  | When set to true, the configuration will exclude the configured tags and include any other submitted tags. When set to false, the configuration will include the configured tags and exclude any other submitted tags. |
| attributes   | status                 | string   | The status of the request.                                                                                                                                                                                             |
| attributes   | tags                   | [string] | A list of tag names to apply to the configuration.                                                                                                                                                                     |
| data         | id [*required*]   | string   | A text prefix to match against metric names.                                                                                                                                                                           |
| data         | type [*required*] | enum     | The metric bulk configure tags resource. Allowed enum values: `metric_bulk_configure_tags`                                                                                                                             |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "emails": [
        "sue@example.com",
        "bob@example.com"
      ],
      "exclude_tags_mode": false,
      "status": "Accepted",
      "tags": [
        "host",
        "pod_name",
        "is_shadow"
      ]
    },
    "id": "kafka.lag",
    "type": "metric_bulk_configure_tags"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too Many Requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    "Bad Request"
  ]
}
```

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \## default
# 
 \# Curl command curl -X DELETE "https://api.datadoghq.com/api/v2/metrics/config/bulk-tags" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "emails": [
        "sue@example.com",
        "bob@example.com"
      ]
    },
    "id": "kafka.lag",
    "type": "metric_bulk_configure_tags"
  }
}
EOF 
                
##### 

```python
"""
Delete tags for multiple metrics returns "Accepted" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.metrics_api import MetricsApi
from datadog_api_client.v2.model.metric_bulk_configure_tags_type import MetricBulkConfigureTagsType
from datadog_api_client.v2.model.metric_bulk_tag_config_delete import MetricBulkTagConfigDelete
from datadog_api_client.v2.model.metric_bulk_tag_config_delete_attributes import MetricBulkTagConfigDeleteAttributes
from datadog_api_client.v2.model.metric_bulk_tag_config_delete_request import MetricBulkTagConfigDeleteRequest
from datadog_api_client.v2.model.metric_bulk_tag_config_email_list import MetricBulkTagConfigEmailList

body = MetricBulkTagConfigDeleteRequest(
    data=MetricBulkTagConfigDelete(
        attributes=MetricBulkTagConfigDeleteAttributes(
            emails=MetricBulkTagConfigEmailList(
                [
                    "sue@example.com",
                    "bob@example.com",
                ]
            ),
        ),
        id="kafka.lag",
        type=MetricBulkConfigureTagsType.BULK_MANAGE_TAGS,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = MetricsApi(api_client)
    response = api_instance.delete_bulk_tags_metrics_configuration(body=body)

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
##### 

```ruby
# Delete tags for multiple metrics returns "Accepted" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::MetricsAPI.new

body = DatadogAPIClient::V2::MetricBulkTagConfigDeleteRequest.new({
  data: DatadogAPIClient::V2::MetricBulkTagConfigDelete.new({
    attributes: DatadogAPIClient::V2::MetricBulkTagConfigDeleteAttributes.new({
      emails: [
        "sue@example.com",
        "bob@example.com",
      ],
    }),
    id: "kafka.lag",
    type: DatadogAPIClient::V2::MetricBulkConfigureTagsType::BULK_MANAGE_TAGS,
  }),
})
p api_instance.delete_bulk_tags_metrics_configuration(body)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
##### 

```go
// Delete tags for multiple metrics returns "Accepted" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.MetricBulkTagConfigDeleteRequest{
		Data: datadogV2.MetricBulkTagConfigDelete{
			Attributes: &datadogV2.MetricBulkTagConfigDeleteAttributes{
				Emails: []string{
					"sue@example.com",
					"bob@example.com",
				},
			},
			Id:   "kafka.lag",
			Type: datadogV2.METRICBULKCONFIGURETAGSTYPE_BULK_MANAGE_TAGS,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewMetricsApi(apiClient)
	resp, r, err := api.DeleteBulkTagsMetricsConfiguration(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `MetricsApi.DeleteBulkTagsMetricsConfiguration`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `MetricsApi.DeleteBulkTagsMetricsConfiguration`:\n%s\n", responseContent)
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
##### 

```java
// Delete tags for multiple metrics returns "Accepted" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.MetricsApi;
import com.datadog.api.client.v2.model.MetricBulkConfigureTagsType;
import com.datadog.api.client.v2.model.MetricBulkTagConfigDelete;
import com.datadog.api.client.v2.model.MetricBulkTagConfigDeleteAttributes;
import com.datadog.api.client.v2.model.MetricBulkTagConfigDeleteRequest;
import com.datadog.api.client.v2.model.MetricBulkTagConfigResponse;
import java.util.Arrays;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    MetricsApi apiInstance = new MetricsApi(defaultClient);

    MetricBulkTagConfigDeleteRequest body =
        new MetricBulkTagConfigDeleteRequest()
            .data(
                new MetricBulkTagConfigDelete()
                    .attributes(
                        new MetricBulkTagConfigDeleteAttributes()
                            .emails(Arrays.asList("sue@example.com", "bob@example.com")))
                    .id("kafka.lag")
                    .type(MetricBulkConfigureTagsType.BULK_MANAGE_TAGS));

    try {
      MetricBulkTagConfigResponse result = apiInstance.deleteBulkTagsMetricsConfiguration(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling MetricsApi#deleteBulkTagsMetricsConfiguration");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
##### 

```rust
// Delete tags for multiple metrics returns "Accepted" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_metrics::MetricsAPI;
use datadog_api_client::datadogV2::model::MetricBulkConfigureTagsType;
use datadog_api_client::datadogV2::model::MetricBulkTagConfigDelete;
use datadog_api_client::datadogV2::model::MetricBulkTagConfigDeleteAttributes;
use datadog_api_client::datadogV2::model::MetricBulkTagConfigDeleteRequest;

#[tokio::main]
async fn main() {
    let body = MetricBulkTagConfigDeleteRequest::new(
        MetricBulkTagConfigDelete::new(
            "kafka.lag".to_string(),
            MetricBulkConfigureTagsType::BULK_MANAGE_TAGS,
        )
        .attributes(MetricBulkTagConfigDeleteAttributes::new().emails(vec![
            "sue@example.com".to_string(),
            "bob@example.com".to_string(),
        ])),
    );
    let configuration = datadog::Configuration::new();
    let api = MetricsAPI::with_config(configuration);
    let resp = api.delete_bulk_tags_metrics_configuration(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
##### 

```typescript
/**
 * Delete tags for multiple metrics returns "Accepted" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.MetricsApi(configuration);

const params: v2.MetricsApiDeleteBulkTagsMetricsConfigurationRequest = {
  body: {
    data: {
      attributes: {
        emails: ["sue@example.com", "bob@example.com"],
      },
      id: "kafka.lag",
      type: "metric_bulk_configure_tags",
    },
  },
};

apiInstance
  .deleteBulkTagsMetricsConfiguration(params)
  .then((data: v2.MetricBulkTagConfigResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
{% /tab %}
