---
title: Related Assets to a Metric
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Metrics
---

# Related Assets to a Metric{% #related-assets-to-a-metric %}
Copy pageCopied
{% tab title="v2" %}

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

### Overview

Returns dashboards, monitors, notebooks, and SLOs that a metric is stored in, if any. Updated every 24 hours.

### Arguments

#### Path Parameters

| Name                          | Type   | Description             |
| ----------------------------- | ------ | ----------------------- |
| metric_name [*required*] | string | The name of the metric. |

### Response

{% tab title="200" %}
Success
{% tab title="Model" %}
Response object that includes related dashboards, monitors, notebooks, and SLOs.

| Parent field  | Field                  | Type            | Description                                                                                |
| ------------- | ---------------------- | --------------- | ------------------------------------------------------------------------------------------ |
|               | data                   | object          | Metric assets response data.                                                               |
| data          | id [*required*]   | string          | The metric name for this resource.                                                         |
| data          | relationships          | object          | Relationships to assets related to the metric.                                             |
| relationships | dashboards             | object          | An object containing the list of dashboards that can be referenced in the `included` data. |
| dashboards    | data                   | [object]        | A list of dashboards that can be referenced in the `included` data.                        |
| data          | id                     | string          | The related dashboard's ID.                                                                |
| data          | type                   | enum            | Dashboard resource type. Allowed enum values: `dashboards`                                 |
| relationships | monitors               | object          | A object containing the list of monitors that can be referenced in the `included` data.    |
| monitors      | data                   | [object]        | A list of monitors that can be referenced in the `included` data.                          |
| data          | id                     | string          | The related monitor's ID.                                                                  |
| data          | type                   | enum            | Monitor resource type. Allowed enum values: `monitors`                                     |
| relationships | notebooks              | object          | An object containing the list of notebooks that can be referenced in the `included` data.  |
| notebooks     | data                   | [object]        | A list of notebooks that can be referenced in the `included` data.                         |
| data          | id                     | string          | The related notebook's ID.                                                                 |
| data          | type                   | enum            | Notebook resource type. Allowed enum values: `notebooks`                                   |
| relationships | slos                   | object          | An object containing a list of SLOs that can be referenced in the `included` data.         |
| slos          | data                   | [object]        | A list of SLOs that can be referenced in the `included` data.                              |
| data          | id                     | string          | The SLO ID.                                                                                |
| data          | type                   | enum            | SLO resource type. Allowed enum values: `slos`                                             |
| data          | type [*required*] | enum            | The metric resource type. Allowed enum values: `metrics`                                   |
|               | included               | [ <oneOf>] | Array of objects related to the metric assets.                                             |
| included      | Option 1               | object          | A dashboard object with title and popularity.                                              |
| Option 1      | attributes             | object          | Attributes related to the dashboard, including title, popularity, and url.                 |
| attributes    | popularity             | double          | Value from 0 to 5 that ranks popularity of the dashboard.                                  |
| attributes    | tags                   | [string]        | List of tag keys used in the asset.                                                        |
| attributes    | title                  | string          | Title of the asset.                                                                        |
| attributes    | url                    | string          | URL path of the asset.                                                                     |
| Option 1      | id [*required*]   | string          | The related dashboard's ID.                                                                |
| Option 1      | type [*required*] | enum            | Dashboard resource type. Allowed enum values: `dashboards`                                 |
| included      | Option 2               | object          | A monitor object with title.                                                               |
| Option 2      | attributes             | object          | Assets related to the object, including title, url, and tags.                              |
| attributes    | tags                   | [string]        | List of tag keys used in the asset.                                                        |
| attributes    | title                  | string          | Title of the asset.                                                                        |
| attributes    | url                    | string          | URL path of the asset.                                                                     |
| Option 2      | id [*required*]   | string          | The related monitor's ID.                                                                  |
| Option 2      | type [*required*] | enum            | Monitor resource type. Allowed enum values: `monitors`                                     |
| included      | Option 3               | object          | A notebook object with title.                                                              |
| Option 3      | attributes             | object          | Assets related to the object, including title, url, and tags.                              |
| attributes    | tags                   | [string]        | List of tag keys used in the asset.                                                        |
| attributes    | title                  | string          | Title of the asset.                                                                        |
| attributes    | url                    | string          | URL path of the asset.                                                                     |
| Option 3      | id [*required*]   | string          | The related notebook's ID.                                                                 |
| Option 3      | type [*required*] | enum            | Notebook resource type. Allowed enum values: `notebooks`                                   |
| included      | Option 4               | object          | A SLO object with title.                                                                   |
| Option 4      | attributes             | object          | Assets related to the object, including title, url, and tags.                              |
| attributes    | tags                   | [string]        | List of tag keys used in the asset.                                                        |
| attributes    | title                  | string          | Title of the asset.                                                                        |
| attributes    | url                    | string          | URL path of the asset.                                                                     |
| Option 4      | id [*required*]   | string          | The SLO ID.                                                                                |
| Option 4      | type [*required*] | enum            | SLO resource type. Allowed enum values: `slos`                                             |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "id": "test.metric.latency",
    "relationships": {
      "dashboards": {
        "data": [
          {
            "id": "xxx-yyy-zzz",
            "type": "dashboards"
          }
        ]
      },
      "monitors": {
        "data": [
          {
            "id": "1775073",
            "type": "monitors"
          }
        ]
      },
      "notebooks": {
        "data": [
          {
            "id": "12345",
            "type": "notebooks"
          }
        ]
      },
      "slos": {
        "data": [
          {
            "id": "9ffef113b389520db54391d67d652dfb",
            "type": "slos"
          }
        ]
      }
    },
    "type": "metrics"
  },
  "included": [
    {
      "attributes": {
        "popularity": "number",
        "tags": [
          "env",
          "service",
          "host",
          "datacenter"
        ],
        "title": "string",
        "url": "string"
      },
      "id": "xxx-yyy-zzz",
      "type": "dashboards"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
API error response.
{% 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" %}
API error response.
{% 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" %}
API error response.
{% 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

##### 
                  \# Path parameters export metric_name="dist.http.endpoint.request" \# Curl command curl -X GET "https://api.datadoghq.com/api/v2/metrics/${metric_name}/assets" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Related Assets to a Metric 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_metric_assets(
        metric_name="system.cpu.user",
    )

    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
# Related Assets to a Metric returns "Success" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::MetricsAPI.new
p api_instance.list_metric_assets("system.cpu.user")
```

#### 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
// Related Assets to a Metric 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.ListMetricAssets(ctx, "system.cpu.user")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `MetricsApi.ListMetricAssets`:\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
// Related Assets to a Metric 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.MetricAssetsResponse;

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

    try {
      MetricAssetsResponse result = apiInstance.listMetricAssets("system.cpu.user");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling MetricsApi#listMetricAssets");
      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
// Related Assets to a Metric returns "Success" response
use datadog_api_client::datadog;
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_metric_assets("system.cpu.user".to_string()).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
/**
 * Related Assets to a Metric returns "Success" response
 */

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

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

const params: v2.MetricsApiListMetricAssetsRequest = {
  metricName: "system.cpu.user",
};

apiInstance
  .listMetricAssets(params)
  .then((data: v2.MetricAssetsResponse) => {
    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 %}
