For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/api/latest/reporting-and-sharing/create-a-graph-snapshot.md. A documentation index is available at /llms.txt.
Language
Datadog site

Create a graph snapshot

WARNINGNote: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.
POSThttps://api.datadoghq.com/api/v2/snapshothttps://api.us3.datadoghq.com/api/v2/snapshothttps://api.us5.datadoghq.com/api/v2/snapshothttps://api.datadoghq.eu/api/v2/snapshothttps://api.ap1.datadoghq.com/api/v2/snapshothttps://api.ap2.datadoghq.com/api/v2/snapshothttps://api.uk1.datadoghq.com/api/v2/snapshothttps://api.ddog-gov.com/api/v2/snapshothttps://api.us2.ddog-gov.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)

Field
Type
Description
data [required]
object

Data envelope for snapshot creation.

Response

OK

Response body for a snapshot creation request.

Field
Type
Description
data [required]
object

Data envelope for the snapshot creation response.

Code Example

Create a graph snapshot
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="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 POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF
# Set your Datadog site and credentials
export DD_SITE="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 POST "https://api.${DD_SITE}/api/v2/snapshot" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "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"
  }
}
EOF