---
title: Get a widget
description: Retrieve a widget by its UUID for a given experience type.
breadcrumbs: ドキュメント > API > Get a widget
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Get a widget

## v2 (latest)

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

### Overview

Retrieve a widget by its UUID for a given experience type.

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

| Field                        | Type   | Description                                                                                                                 |
| ---------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------- |
| experience_type [*required*] | enum   | The experience type for the widget. Allowed enum values: `ccm_reports`, `logs_reports`, `csv_reports`, `product_analytics`. |
| uuid [*required*]            | string | The UUID of the widget.                                                                                                     |

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response containing a single widget.

| Parent field  | Field                     | Type     | Description                                                                                                                                                                                                                                                                                                                                                     |
| ------------- | ------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|               | data [*required*]         | object   | A widget resource object.                                                                                                                                                                                                                                                                                                                                       |
| 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`, `sankey`, `sunburst`, `timeseries`, `toplist`, `treemap`. |
| 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 widget.                                                                                                                                                                                                                                                                                                                  |
| 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.                                                                                                                                                                                                                                                                                                                                            |
{% /tab %}

{% tab label="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"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export experience_type="ccm_reports"
export uuid="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/widgets/${experience_type}/${uuid}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}

{% tab label="Go" %}
```go
// Get a widget 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"
	"github.com/google/uuid"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewWidgetsApi(apiClient)
	resp, r, err := api.GetWidget(ctx, datadogV2.WIDGETEXPERIENCETYPE_CCM_REPORTS, uuid.MustParse("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"))

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

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// Get a widget 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.WidgetResponse;
import java.util.UUID;

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

    try {
      WidgetResponse result =
          apiInstance.getWidget(
              WidgetExperienceType.CCM_REPORTS,
              UUID.fromString("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"));
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling WidgetsApi#getWidget");
      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://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Get a widget returns "OK" response
"""

from os import environ
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
from uuid import UUID

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
    api_instance = WidgetsApi(api_client)
    response = api_instance.get_widget(
        experience_type=WidgetExperienceType.CCM_REPORTS,
        uuid=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"),
    )

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Get a widget returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::WidgetsAPI.new
p api_instance.get_widget(WidgetExperienceType::CCM_REPORTS, "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d")
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Get a widget returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_widgets::WidgetsAPI;
use datadog_api_client::datadogV2::model::WidgetExperienceType;
use uuid::Uuid;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = WidgetsAPI::with_config(configuration);
    let resp = api
        .get_widget(
            WidgetExperienceType::CCM_REPORTS,
            Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"),
        )
        .await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Get a widget returns "OK" response
 */

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

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
const apiInstance = new v2.WidgetsApi(configuration);

const params: v2.WidgetsApiGetWidgetRequest = {
  experienceType: "ccm_reports",
  uuid: "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
};

apiInstance
  .getWidget(params)
  .then((data: v2.WidgetResponse) => {
    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://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
