---
title: Create a graph snapshot
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Reporting And Sharing
---

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

# Create a graph snapshot{% #create-a-graph-snapshot %}
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 | POST https://api.ap1.datadoghq.com/api/v2/snapshot |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/snapshot |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/snapshot      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/snapshot      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/snapshot  |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/snapshot |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/snapshot     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/snapshot |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/snapshot |

### Overview

Create a snapshot of a graph widget. The snapshot is rendered asynchronously; the returned URL can be polled until the image is ready.

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field       | Field                               | Type     | Description                                                                                                                                                                                             |
| ------------------ | ----------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                    | data [*required*]              | object   | Data envelope for snapshot creation.                                                                                                                                                                    |
| data               | attributes [*required*]        | object   | Attributes for snapshot creation.                                                                                                                                                                       |
| attributes         | additional_config                   | object   | Additional configuration options for snapshot creation.                                                                                                                                                 |
| additional_config  | template_variables                  | [object] | List of template variable definitions for snapshot rendering.                                                                                                                                           |
| template_variables | name [*required*]              | string   | The template variable name.                                                                                                                                                                             |
| template_variables | prefix [*required*]            | string   | The tag prefix associated with the template variable. For example, a prefix of `host` with a value of `web-server-1` scopes the snapshot to `host:web-server-1`.                                        |
| template_variables | values [*required*]            | [string] | The list of scoped values for this template variable.                                                                                                                                                   |
| additional_config  | timeseries_legend_type              | enum     | The legend display type for timeseries widgets. A value of `none` hides the legend entirely; omitting the field lets the frontend choose automatically. Allowed enum values: `compact,expanded,none`    |
| additional_config  | timezone_offset_minutes             | int64    | Timezone offset in minutes from UTC. Positive values are west of UTC (for example, `300` for UTC-5). Use `0` for UTC.                                                                                   |
| attributes         | end [*required*]               | int64    | End of the time window for the snapshot, in milliseconds since Unix epoch.                                                                                                                              |
| attributes         | height                              | int64    | The height of the rendered snapshot in pixels.                                                                                                                                                          |
| attributes         | is_authenticated                    | boolean  | Whether the snapshot requires authentication to view. Authenticated snapshots are scoped to the creating organization.                                                                                  |
| attributes         | start [*required*]             | int64    | Start of the time window for the snapshot, in milliseconds since Unix epoch.                                                                                                                            |
| attributes         | ttl                                 | enum     | The time-to-live for the snapshot. This value corresponds to storage lifecycle policies that automatically delete the snapshot after the specified period. Allowed enum values: `30d,60d,90d,1y,2y,inf` |
| attributes         | widget_definition [*required*] | object   | The widget definition to render as a snapshot. Must include a valid `type` field and non-empty `requests` array.                                                                                        |
| attributes         | width                               | int64    | The width of the rendered snapshot in pixels.                                                                                                                                                           |
| data               | type [*required*]              | enum     | The type identifier for snapshot creation resources. Allowed enum values: `create_snapshot`                                                                                                             |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "additional_config": {
        "template_variables": [
          {
            "name": "host",
            "prefix": "host",
            "values": [
              "web-server-1",
              "web-server-2"
            ]
          }
        ],
        "timeseries_legend_type": "expanded",
        "timezone_offset_minutes": 300
      },
      "end": 1692464800000,
      "height": 185,
      "is_authenticated": false,
      "start": 1692464000000,
      "ttl": "60d",
      "widget_definition": {
        "requests": [
          {
            "q": "avg:system.cpu.user{*}"
          }
        ],
        "type": "timeseries"
      },
      "width": 300
    },
    "type": "create_snapshot"
  }
}
```

{% /tab %}

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Response body for a snapshot creation request.

| Parent field | Field                        | Type   | Description                                                                                 |
| ------------ | ---------------------------- | ------ | ------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object | Data envelope for the snapshot creation response.                                           |
| data         | attributes [*required*] | object | Attributes of the created snapshot.                                                         |
| attributes   | url [*required*]        | string | The URL to access the rendered snapshot image.                                              |
| data         | id [*required*]         | string | The unique identifier of the created snapshot.                                              |
| data         | type [*required*]       | enum   | The type identifier for snapshot creation resources. Allowed enum values: `create_snapshot` |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "url": "https://app.datadoghq.com/api/v2/snapshot/view/public/60d/00000000-0000-0000-0000-000000000000/1692464400000-12345678-1234-5678-9abc-def123456789.png"
    },
    "id": "12345678-1234-5678-9abc-def123456789",
    "type": "create_snapshot"
  }
}
```

{% /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="404" %}
Not Found
{% 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 POST "https://api.datadoghq.com/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "additional_config": {
        "template_variables": [
          {
            "name": "host",
            "prefix": "host",
            "values": [
              "web-server-1",
              "web-server-2"
            ]
          }
        ]
      },
      "end": 1692464800000,
      "start": 1692464000000,
      "widget_definition": {
        "requests": [
          {
            "q": "avg:system.cpu.user{*}"
          }
        ],
        "type": "timeseries"
      }
    },
    "type": "create_snapshot"
  }
}
EOF 
                
{% /tab %}
