---
title: Search widgets
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Widgets
---

# Search widgets{% #search-widgets %}

{% tab title="v2" %}

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

### Overview



Search and list widgets for a given experience type, with filtering, sorting, and pagination.

**Response meta** carries totals scoped to the current filter:

- `filtered_total` — widgets matching the filter.
- `created_by_you_total` — among the matches, how many the current user created.
- `favorited_by_you_total` — among the matches, how many the current user has favorited.
- `created_by_anyone_total` — total widgets in the experience type, ignoring filters.

Each returned widget includes `is_favorited` reflecting the current user's favorite status. Favoriting itself is performed through the shared favorites API, not this endpoint.
This endpoint requires any of the following permissions:`cloud_cost_management_read``generate_log_reports``manage_log_reports``product_analytics_saved_widgets_read` 


### Arguments

#### Path Parameters

| Name                              | Type   | Description                         |
| --------------------------------- | ------ | ----------------------------------- |
| experience_type [*required*] | string | The experience type for the widget. |

#### Query Strings

| Name                  | Type    | Description                                                                                                                                                                 |
| --------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filter[widgetType]    | enum    | Filter widgets by widget type. Allowed enum values: `bar_chart, change, cloud_cost_summary, cohort, funnel, geomap, list_stream, query_table, query_value, retention_curve` |
| filter[creatorHandle] | string  | Filter widgets by the email handle of the creator.                                                                                                                          |
| filter[isFavorited]   | boolean | Filter to only widgets favorited by the current user.                                                                                                                       |
| filter[title]         | string  | Filter widgets by title (substring match).                                                                                                                                  |
| filter[tags]          | string  | Filter widgets by tags. Format as bracket-delimited CSV, e.g. `[tag1,tag2]`.                                                                                                |
| sort                  | string  |                                                                                                                                                                             |
| page[number]          | integer | Page number for pagination (0-indexed).                                                                                                                                     |
| page[size]            | integer | Number of widgets per page.                                                                                                                                                 |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Response containing a list of widgets.

| Parent field  | Field                          | Type     | Description                                                                                                                                                                                                                                                                                      |
| ------------- | ------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|               | data [*required*]         | [object] | List of widget resources.                                                                                                                                                                                                                                                                        |
| data          | attributes [*required*]   | object   | Attributes of a widget resource.                                                                                                                                                                                                                                                                 |
| attributes    | created_at [*required*]   | string   | ISO 8601 timestamp of when the widget was created.                                                                                                                                                                                                                                               |
| attributes    | definition [*required*]   | object   | The definition of a widget, including its type and configuration.                                                                                                                                                                                                                                |
| definition    | title [*required*]        | string   | The display title of the widget.                                                                                                                                                                                                                                                                 |
| definition    | type [*required*]         | enum     | Widget types that are allowed to be stored as individual records. This is not a complete list of dashboard and notebook widget types. Allowed enum values: `bar_chart,change,cloud_cost_summary,cohort,funnel,geomap,list_stream,query_table,query_value,retention_curve`                        |
| attributes    | is_favorited [*required*] | boolean  | Whether the current user has favorited this widget. Populated on get, batch_get, update, and search responses; create responses always return `false` because a widget can only be favorited after it exists. Favoriting itself is performed through the shared favorites API, not this service. |
| attributes    | modified_at [*required*]  | string   | ISO 8601 timestamp of when the widget was last modified.                                                                                                                                                                                                                                         |
| attributes    | tags [*required*]         | [string] | User-defined tags for organizing widgets.                                                                                                                                                                                                                                                        |
| data          | id [*required*]           | string   | The unique identifier of the widget.                                                                                                                                                                                                                                                             |
| data          | relationships                  | object   | Relationships of the widget resource.                                                                                                                                                                                                                                                            |
| relationships | created_by                     | object   | The user who created the widget.                                                                                                                                                                                                                                                                 |
| created_by    | data                           | object   | Relationship data referencing a user resource.                                                                                                                                                                                                                                                   |
| data          | id [*required*]           | string   | The unique identifier of the user.                                                                                                                                                                                                                                                               |
| data          | type [*required*]         | string   | Users resource type.                                                                                                                                                                                                                                                                             |
| relationships | modified_by                    | object   | The user who last modified the widget.                                                                                                                                                                                                                                                           |
| modified_by   | data                           | object   | Relationship data referencing a user resource.                                                                                                                                                                                                                                                   |
| data          | id [*required*]           | string   | The unique identifier of the user.                                                                                                                                                                                                                                                               |
| data          | type [*required*]         | string   | Users resource type.                                                                                                                                                                                                                                                                             |
| data          | type [*required*]         | string   | Widgets resource type.                                                                                                                                                                                                                                                                           |
|               | included                       | [object] | Array of user resources related to the widgets.                                                                                                                                                                                                                                                  |
| included      | attributes                     | object   | Attributes of an included user resource.                                                                                                                                                                                                                                                         |
| attributes    | handle                         | string   | The email handle of the user.                                                                                                                                                                                                                                                                    |
| attributes    | name                           | string   | The display name of the user.                                                                                                                                                                                                                                                                    |
| included      | id [*required*]           | string   | The unique identifier of the user.                                                                                                                                                                                                                                                               |
| included      | type [*required*]         | string   | Users resource type.                                                                                                                                                                                                                                                                             |
|               | meta                           | object   | Metadata about the search results.                                                                                                                                                                                                                                                               |
| meta          | created_by_anyone_total        | int64    | Total number of widgets created by anyone.                                                                                                                                                                                                                                                       |
| meta          | created_by_you_total           | int64    | Total number of widgets created by the current user.                                                                                                                                                                                                                                             |
| meta          | favorited_by_you_total         | int64    | Total number of widgets favorited by the current user.                                                                                                                                                                                                                                           |
| meta          | filtered_total                 | int64    | Total number of widgets matching the current filter criteria.                                                                                                                                                                                                                                    |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "attributes": {
        "created_at": "2024-01-15T00:00:00.000Z",
        "definition": {
          "title": "My Widget",
          "type": "bar_chart"
        },
        "is_favorited": false,
        "modified_at": "2024-01-15T00:00:00.000Z",
        "tags": [
          "team:my-team"
        ]
      },
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "relationships": {
        "created_by": {
          "data": {
            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
            "type": "users"
          }
        },
        "modified_by": {
          "data": {
            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
            "type": "users"
          }
        }
      },
      "type": "widgets"
    }
  ],
  "included": [
    {
      "attributes": {
        "handle": "john.doe@example.com",
        "name": "John Doe"
      },
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "type": "users"
    }
  ],
  "meta": {
    "created_by_anyone_total": "integer",
    "created_by_you_total": "integer",
    "favorited_by_you_total": "integer",
    "filtered_total": "integer"
  }
}
```

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

##### 
                  \# Path parameters export experience_type="ccm_reports" \# Curl command curl -X GET "https://api.datadoghq.com/api/v2/widgets/${experience_type}" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Search widgets returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.widgets_api import WidgetsApi
from datadog_api_client.v2.model.widget_experience_type import WidgetExperienceType

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = WidgetsApi(api_client)
    response = api_instance.search_widgets(
        experience_type=WidgetExperienceType.CCM_REPORTS,
    )

    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
# Search widgets returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::WidgetsAPI.new
p api_instance.search_widgets(WidgetExperienceType::CCM_REPORTS)
```

#### 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
// Search widgets 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()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewWidgetsApi(apiClient)
	resp, r, err := api.SearchWidgets(ctx, datadogV2.WIDGETEXPERIENCETYPE_CCM_REPORTS, *datadogV2.NewSearchWidgetsOptionalParameters())

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

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

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.WidgetsApi;
import com.datadog.api.client.v2.model.WidgetExperienceType;
import com.datadog.api.client.v2.model.WidgetListResponse;

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

    try {
      WidgetListResponse result = apiInstance.searchWidgets(WidgetExperienceType.CCM_REPORTS);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling WidgetsApi#searchWidgets");
      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
// Search widgets returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_widgets::SearchWidgetsOptionalParams;
use datadog_api_client::datadogV2::api_widgets::WidgetsAPI;
use datadog_api_client::datadogV2::model::WidgetExperienceType;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = WidgetsAPI::with_config(configuration);
    let resp = api
        .search_widgets(
            WidgetExperienceType::CCM_REPORTS,
            SearchWidgetsOptionalParams::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
/**
 * Search widgets returns "OK" response
 */

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

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

const params: v2.WidgetsApiSearchWidgetsRequest = {
  experienceType: "ccm_reports",
};

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