For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/api/latest/reporting-and-sharing/create-a-graph-snapshot.md. A documentation index is available at /llms.txt.

Create a graph snapshot

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

POST https://api.ap1.datadoghq.com/api/v2/snapshothttps://api.ap2.datadoghq.com/api/v2/snapshothttps://api.datadoghq.eu/api/v2/snapshothttps://api.ddog-gov.com/api/v2/snapshothttps://api.us2.ddog-gov.com/api/v2/snapshothttps://api.uk1.datadoghq.com/api/v2/snapshothttps://api.datadoghq.com/api/v2/snapshothttps://api.us3.datadoghq.com/api/v2/snapshothttps://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)

Expand All

Field

Type

Description

data [required]

object

Data envelope for snapshot creation.

attributes [required]

object

Attributes for snapshot creation.

additional_config

object

Additional configuration options for snapshot creation.

template_variables

[object]

List of template variable definitions for snapshot rendering.

name [required]

string

The template variable name.

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.

values [required]

[string]

The list of scoped values for this template variable.

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

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.

end [required]

int64

End of the time window for the snapshot, in milliseconds since Unix epoch.

height

int64

The height of the rendered snapshot in pixels.

is_authenticated

boolean

Whether the snapshot requires authentication to view. Authenticated snapshots are scoped to the creating organization.

start [required]

int64

Start of the time window for the snapshot, in milliseconds since Unix epoch.

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

widget_definition [required]

object

The widget definition to render as a snapshot. Must include a valid type field and non-empty requests array.

width

int64

The width of the rendered snapshot in pixels.

type [required]

enum

The type identifier for snapshot creation resources. Allowed enum values: create_snapshot

{
  "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"
  }
}

Response

OK

Response body for a snapshot creation request.

Expand All

Field

Type

Description

data [required]

object

Data envelope for the snapshot creation response.

attributes [required]

object

Attributes of the created snapshot.

url [required]

string

The URL to access the rendered snapshot image.

id [required]

string

The unique identifier of the created snapshot.

type [required]

enum

The type identifier for snapshot creation resources. Allowed enum values: create_snapshot

{
  "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"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

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

Unauthorized

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

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

Forbidden

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

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

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

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

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.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