---
title: Get a list of metrics
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Metrics
---

# Get a list of metrics{% #get-a-list-of-metrics %}
Copy pageCopied
{% tab title="v2" %}

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

### Overview



Get a list of actively reporting metrics for your organization. Pagination is optional using the `page[cursor]` and `page[size]` query parameters.

Query parameters use bracket notation (for example, `filter[tags]`, `filter[queried][window][seconds]`). Pass them as standard URL query strings, URL-encoding the brackets if your client does not handle them. For example: `GET /api/v2/metrics?filter[tags]=env:prod&window[seconds]=86400&page[size]=500`.
This endpoint requires the `metrics_read` permission.
OAuth apps require the `metrics_read` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#metrics) to access this endpoint.



### Arguments

#### Query Strings

| Name                             | Type    | Description                                                                                                                                                                                                                                                                                                                                                                 |
| -------------------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filter[configured]               | boolean | Only return custom metrics that have been configured with Metrics Without Limits.                                                                                                                                                                                                                                                                                           |
| filter[tags_configured]          | string  | Only return metrics that have the given tag key(s) in their Metrics Without Limits configuration (included or excluded).                                                                                                                                                                                                                                                    |
| filter[metric_type]              | enum    | Only return metrics of the given metric type. Allowed enum values: `non_distribution, distribution`                                                                                                                                                                                                                                                                         |
| filter[include_percentiles]      | boolean | Only return distribution metrics that have percentile aggregations enabled (true) or disabled (false).                                                                                                                                                                                                                                                                      |
| filter[queried]                  | boolean | Only return metrics that have been queried (true) or not queried (false) in the look back window. Set the window with `filter[queried][window][seconds]`; if omitted, a default window is used.                                                                                                                                                                             |
| filter[queried][window][seconds] | integer | This parameter has no effect unless `filter[queried]` is also set. Only return metrics that have been queried or not queried in the specified window. The default value is 2,592,000 seconds (30 days), the maximum value is 15,552,000 seconds (180 days), and the minimum value is 1 second. For example: `filter[queried]=true&filter[queried][window][seconds]=604800`. |
| filter[tags]                     | string  | Only return metrics that were submitted with tags matching this expression. You can use AND, OR, IN, and wildcards. For example: `filter[tags]=env IN (staging,test) AND service:web*`.                                                                                                                                                                                     |
| filter[related_assets]           | boolean | Only return metrics that are used in at least one dashboard, monitor, notebook, or SLO.                                                                                                                                                                                                                                                                                     |
| window[seconds]                  | integer | Only return metrics that have been actively reporting in the specified window. The default value is 3600 seconds (1 hour), the maximum value is 2,592,000 seconds (30 days), and the minimum value is 1 second.                                                                                                                                                             |
| page[size]                       | integer | Maximum number of results per page. Send `page[size]` on the first request to opt in to pagination. On each subsequent request, send `page[cursor]` set to the value of `meta.pagination.next_cursor` from the previous response. The default value is 10000, the maximum value is 10000, and the minimum value is 1.                                                       |
| page[cursor]                     | string  | Cursor for pagination. Use `page[size]` to opt-in to pagination and get the first page; for subsequent pages, use the value from `meta.pagination.next_cursor` in the response. Pagination is complete when `next_cursor` is null.                                                                                                                                          |

### Response

{% tab title="200" %}
Success
{% tab title="Model" %}
Response object that includes metrics and metric tag configurations.

| Parent field | Field                   | Type            | Description                                                                                                                                                                                                                                                         |
| ------------ | ----------------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data                    | [ <oneOf>] | Array of metrics and metric tag configurations.                                                                                                                                                                                                                     |
| data         | Option 1                | object          | Object for a single metric tag configuration.                                                                                                                                                                                                                       |
| Option 1     | id                      | string          | The metric name for this resource.                                                                                                                                                                                                                                  |
| Option 1     | type                    | enum            | The metric resource type. Allowed enum values: `metrics`                                                                                                                                                                                                            |
| data         | Option 2                | object          | Object for a single metric tag configuration.                                                                                                                                                                                                                       |
| Option 2     | attributes              | object          | Object containing the definition of a metric tag configuration attributes.                                                                                                                                                                                          |
| attributes   | aggregations            | [object]        | Deprecated. You no longer need to configure specific time and space aggregations for Metrics Without Limits.                                                                                                                                                        |
| aggregations | space [*required*] | enum            | A space aggregation for use in query. Allowed enum values: `avg,max,min,sum`                                                                                                                                                                                        |
| aggregations | time [*required*]  | enum            | A time aggregation for use in query. Allowed enum values: `avg,count,max,min,sum`                                                                                                                                                                                   |
| attributes   | created_at              | date-time       | Timestamp when the tag configuration was created.                                                                                                                                                                                                                   |
| 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. Defaults to false. Requires `tags` property. |
| attributes   | include_percentiles     | boolean         | Toggle to include or exclude percentile aggregations for distribution metrics. Only present when the `metric_type` is `distribution`.                                                                                                                               |
| attributes   | metric_type             | enum            | The metric's type. Allowed enum values: `gauge,count,rate,distribution`                                                                                                                                                                                             |
| attributes   | modified_at             | date-time       | Timestamp when the tag configuration was last modified.                                                                                                                                                                                                             |
| attributes   | tags                    | [string]        | List of tag keys on which to group.                                                                                                                                                                                                                                 |
| Option 2     | id                      | string          | The metric name for this resource.                                                                                                                                                                                                                                  |
| Option 2     | type                    | enum            | The metric tag configuration resource type. Allowed enum values: `manage_tags`                                                                                                                                                                                      |
|              | links                   | object          | Pagination links. Only present if pagination query parameters were provided.                                                                                                                                                                                        |
| links        | first                   | string          | Link to the first page.                                                                                                                                                                                                                                             |
| links        | last                    | string          | Link to the last page.                                                                                                                                                                                                                                              |
| links        | next                    | string          | Link to the next page.                                                                                                                                                                                                                                              |
| links        | prev                    | string          | Link to previous page.                                                                                                                                                                                                                                              |
| links        | self                    | string          | Link to current page.                                                                                                                                                                                                                                               |
|              | meta                    | object          | Response metadata object.                                                                                                                                                                                                                                           |
| meta         | pagination              | object          | Paging attributes. Only present if pagination query parameters were provided.                                                                                                                                                                                       |
| pagination   | cursor                  | string          | The cursor used to get the current results, if any.                                                                                                                                                                                                                 |
| pagination   | limit                   | int32           | Number of results returned                                                                                                                                                                                                                                          |
| pagination   | next_cursor             | string          | The cursor used to get the next results, if any.                                                                                                                                                                                                                    |
| pagination   | type                    | enum            | Type of metric pagination. Allowed enum values: `cursor_limit`                                                                                                                                                                                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "id": "test.metric.latency",
      "type": "metrics"
    }
  ],
  "links": {
    "first": "string",
    "last": "string",
    "next": "string",
    "prev": "string",
    "self": "string"
  },
  "meta": {
    "pagination": {
      "cursor": "string",
      "limit": "integer",
      "next_cursor": "string",
      "type": "cursor_limit"
    }
  }
}
```

{% /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="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

##### 
                  \# Curl command curl -X GET "https://api.datadoghq.com/api/v2/metrics" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Get a list of metrics returns "Success" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.metrics_api import MetricsApi

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

    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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
##### 

```ruby
# Get a list of metrics returns "Success" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::MetricsAPI.new
p api_instance.list_tag_configurations()
```

#### 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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```go
// Get a list of metrics returns "Success" 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewMetricsApi(apiClient)
	resp, r, err := api.ListTagConfigurations(ctx, *datadogV2.NewListTagConfigurationsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `MetricsApi.ListTagConfigurations`:\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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
##### 

```java
// Get a list of metrics returns "Success" 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.MetricsAndMetricTagConfigurationsResponse;

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

    try {
      MetricsAndMetricTagConfigurationsResponse result = apiInstance.listTagConfigurations();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling MetricsApi#listTagConfigurations");
      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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
##### 

```rust
// Get a list of metrics returns "Success" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_metrics::ListTagConfigurationsOptionalParams;
use datadog_api_client::datadogV2::api_metrics::MetricsAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = MetricsAPI::with_config(configuration);
    let resp = api
        .list_tag_configurations(ListTagConfigurationsOptionalParams::default())
        .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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
##### 

```typescript
/**
 * Get a list of metrics returns "Success" response
 */

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

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

apiInstance
  .listTagConfigurations()
  .then((data: v2.MetricsAndMetricTagConfigurationsResponse) => {
    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="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"
{% /tab %}
