---
title: List insights
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Governance Console
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# List insights{% #list-insights %}
Copy pageCopied
{% tab title="v2" %}
**Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).
| Datadog site      | API endpoint                                                 |
| ----------------- | ------------------------------------------------------------ |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/governance/insights |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/governance/insights |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/governance/insights      |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/governance/insights      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/governance/insights  |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/governance/insights |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/governance/insights     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/governance/insights |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/governance/insights |

### Overview

Retrieve the list of governance insights available to the organization. Each insight reports the query used to compute it, so that the value can be computed client-side. Insights can be filtered by product. This endpoint requires any of the following permissions:
`metrics_read``events_read``audit_logs_read``governance_console_read` 


OAuth apps require the `events_read, metrics_read` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#governance-console) to access this endpoint.



### Arguments

#### Query Strings

| Name            | Type  | Description                                                                                                                                     |
| --------------- | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| filter[product] | array | Restrict the results to insights belonging to the given products. May be repeated to filter by multiple products. Matching is case-insensitive. |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
A list of governance insights.

| Parent field      | Field                                        | Type     | Description                                                                                                                                                                                                                             |
| ----------------- | -------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                   | data [*required*]                       | [object] | An array of governance insight resources.                                                                                                                                                                                               |
| data              | attributes [*required*]                 | object   | The attributes of a governance insight. Exactly one of `metric_query`, `event_query`, `usage_query`, `audit_query`, or `percentage_query` is populated, depending on the data source the insight is computed from; the rest are `null`. |
| attributes        | audit_query                                  | object   | An audit log query used to compute an insight value.                                                                                                                                                                                    |
| audit_query       | compute [*required*]                    | object   | The aggregation applied to an audit log query.                                                                                                                                                                                          |
| compute           | aggregation [*required*]                | string   | The aggregation function to apply.                                                                                                                                                                                                      |
| compute           | interval [*required*]                   | int64    | The aggregation time window, in milliseconds.                                                                                                                                                                                           |
| compute           | metric [*required*]                     | string   | The metric or attribute to aggregate.                                                                                                                                                                                                   |
| compute           | rollup                                       | string   | An optional secondary aggregation applied to the audit query result.                                                                                                                                                                    |
| audit_query       | indexes [*required*]                    | [string] | The audit log indexes the query runs against.                                                                                                                                                                                           |
| audit_query       | query [*required*]                      | string   | The audit log search query string.                                                                                                                                                                                                      |
| audit_query       | source [*required*]                     | string   | The data source the query runs against.                                                                                                                                                                                                 |
| attributes        | description [*required*]                | string   | A human-readable description of what the insight measures.                                                                                                                                                                              |
| attributes        | display_name [*required*]               | string   | Human-readable name of the insight.                                                                                                                                                                                                     |
| attributes        | event_query                                  | object   | An event query used to compute an insight value.                                                                                                                                                                                        |
| event_query       | compute                                      | object   | The aggregation applied to an event query.                                                                                                                                                                                              |
| compute           | aggregation [*required*]                | string   | The aggregation function to apply.                                                                                                                                                                                                      |
| compute           | interval [*required*]                   | int64    | The aggregation time window, in milliseconds.                                                                                                                                                                                           |
| event_query       | indexes [*required*]                    | [string] | The event indexes the query runs against.                                                                                                                                                                                               |
| event_query       | query [*required*]                      | string   | The event search query string.                                                                                                                                                                                                          |
| attributes        | metric_query                                 | object   | A metric query used to compute an insight value.                                                                                                                                                                                        |
| metric_query      | query [*required*]                      | string   | The query string.                                                                                                                                                                                                                       |
| metric_query      | reducer [*required*]                    | string   | How the query result series is reduced to a single value.                                                                                                                                                                               |
| metric_query      | source [*required*]                     | string   | The data source the query runs against.                                                                                                                                                                                                 |
| attributes        | percentage_query                             | object   | A percentage query that computes an insight value as a ratio of two metric queries.                                                                                                                                                     |
| percentage_query  | denominator_query [*required*]          | object   | A metric query used to compute an insight value.                                                                                                                                                                                        |
| denominator_query | query [*required*]                      | string   | The query string.                                                                                                                                                                                                                       |
| denominator_query | reducer [*required*]                    | string   | How the query result series is reduced to a single value.                                                                                                                                                                               |
| denominator_query | source [*required*]                     | string   | The data source the query runs against.                                                                                                                                                                                                 |
| percentage_query  | numerator_query [*required*]            | object   | A metric query used to compute an insight value.                                                                                                                                                                                        |
| numerator_query   | query [*required*]                      | string   | The query string.                                                                                                                                                                                                                       |
| numerator_query   | reducer [*required*]                    | string   | How the query result series is reduced to a single value.                                                                                                                                                                               |
| numerator_query   | source [*required*]                     | string   | The data source the query runs against.                                                                                                                                                                                                 |
| attributes        | product [*required*]                    | string   | The product the insight belongs to.                                                                                                                                                                                                     |
| attributes        | query_config                                 | object   | Query execution context for running insight queries directly.                                                                                                                                                                           |
| query_config      | chart_type                                   | string   | The chart type used to render the insight.                                                                                                                                                                                              |
| query_config      | comparison_shift [*required*]           | string   | The window used for the previous value comparison; for example, `week` or `month`.                                                                                                                                                      |
| query_config      | default_value                                | int64    | The default value to display when no data is available.                                                                                                                                                                                 |
| query_config      | directionality                               | enum     | Whether an increase in the insight's value is good, bad, or neutral. Allowed enum values: `neutral,increase_better,decrease_better`                                                                                                     |
| query_config      | effective_time_window_days [*required*] | int64    | The number of days the insight value is computed over.                                                                                                                                                                                  |
| attributes        | sub_product [*required*]                | string   | The sub-product the insight belongs to, if any.                                                                                                                                                                                         |
| attributes        | time_range [*required*]                 | string   | The time range the insight value is computed over, if applicable.                                                                                                                                                                       |
| attributes        | unit_name [*required*]                  | string   | The unit that the insight's value is measured in.                                                                                                                                                                                       |
| attributes        | usage_query                                  | object   | A usage query used to compute an insight value.                                                                                                                                                                                         |
| usage_query       | query [*required*]                      | string   | The usage query string.                                                                                                                                                                                                                 |
| usage_query       | reducer [*required*]                    | string   | How the query result series is reduced to a single value.                                                                                                                                                                               |
| data              | id [*required*]                         | string   | The unique identifier of the insight.                                                                                                                                                                                                   |
| data              | type [*required*]                       | enum     | JSON:API resource type for a governance insight. Allowed enum values: `insight`                                                                                                                                                         |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "attributes": {
        "audit_query": {
          "compute": {
            "aggregation": "cardinality",
            "interval": 86400000,
            "metric": "@usr.id",
            "rollup": ""
          },
          "indexes": [
            "main"
          ],
          "query": "@evt.name:Dashboard",
          "source": "audit"
        },
        "description": "Number of users who have used the Dashboard in the last 30 days",
        "display_name": "Active Dashboards",
        "event_query": {
          "compute": {
            "aggregation": "count",
            "interval": 86400000
          },
          "indexes": [
            "main"
          ],
          "query": "source:cloudtrail"
        },
        "metric_query": {
          "query": "avg:system.cpu.user{*}",
          "reducer": "avg",
          "source": "metrics"
        },
        "percentage_query": {
          "denominator_query": {
            "query": "avg:system.cpu.user{*}",
            "reducer": "avg",
            "source": "metrics"
          },
          "numerator_query": {
            "query": "avg:system.cpu.user{*}",
            "reducer": "avg",
            "source": "metrics"
          }
        },
        "product": "Usage",
        "query_config": {
          "chart_type": "line",
          "comparison_shift": "month",
          "default_value": 0,
          "directionality": "neutral",
          "effective_time_window_days": 30
        },
        "sub_product": "Indexes",
        "time_range": "month",
        "unit_name": "active dashboards",
        "usage_query": {
          "query": "logs_indexed_events",
          "reducer": "sum"
        }
      },
      "id": "498ee21f-8037-48b8-a961-a488692902f4",
      "type": "insight"
    }
  ]
}
```

{% /tab %}

{% /tab %}

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

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="401" %}
Unauthorized
{% tab title="Model" %}
API error response.

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

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

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "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/governance/insights" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
List insights returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.governance_console_api import GovernanceConsoleApi

configuration = Configuration()
configuration.unstable_operations["list_governance_insights"] = True
with ApiClient(configuration) as api_client:
    api_instance = GovernanceConsoleApi(api_client)
    response = api_instance.list_governance_insights()

    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
# List insights returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.list_governance_insights".to_sym] = true
end
api_instance = DatadogAPIClient::V2::GovernanceConsoleAPI.new
p api_instance.list_governance_insights()
```

#### 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
// List insights returns "OK" 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()
	configuration.SetUnstableOperationEnabled("v2.ListGovernanceInsights", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewGovernanceConsoleApi(apiClient)
	resp, r, err := api.ListGovernanceInsights(ctx, *datadogV2.NewListGovernanceInsightsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `GovernanceConsoleApi.ListGovernanceInsights`:\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
// List insights returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.GovernanceConsoleApi;
import com.datadog.api.client.v2.model.GovernanceInsightsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.listGovernanceInsights", true);
    GovernanceConsoleApi apiInstance = new GovernanceConsoleApi(defaultClient);

    try {
      GovernanceInsightsResponse result = apiInstance.listGovernanceInsights();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling GovernanceConsoleApi#listGovernanceInsights");
      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
// List insights returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_governance_console::GovernanceConsoleAPI;
use datadog_api_client::datadogV2::api_governance_console::ListGovernanceInsightsOptionalParams;

#[tokio::main]
async fn main() {
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListGovernanceInsights", true);
    let api = GovernanceConsoleAPI::with_config(configuration);
    let resp = api
        .list_governance_insights(ListGovernanceInsightsOptionalParams::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
/**
 * List insights returns "OK" response
 */

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

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listGovernanceInsights"] = true;
const apiInstance = new v2.GovernanceConsoleApi(configuration);

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