Export a dashboard

Retrieves the full configuration of a dashboard or a public template as a JSON object. This is useful for backing up dashboards or creating new dashboards via the import endpoint.

This endpoint can be used to export both your own dashboards and dashboard templates.

GET https://telemetry.betterstack.com/api/v2/dashboards/{id}/export

URL parameters

id
required string

Headers

Authorization
required string
200

Response body

{
  "id": "12345",
  "name": "Better Stack Collector Dashboard",
  "data": {
    "refresh_interval": 30,
    "date_range_from": "now-3h",
    "date_range_to": "now",
    "source_eligibility_sql": null,
    "preset": {
      "id": 67890,
      "preset_type": "implicit",
      "preset_variables": [
        {
          "name": "service",
          "variable_type": "select_value",
          "values": [
            "web"
          ],
          "default_values": [
            "web",
            "api"
          ],
          "sql_definition": "SELECT DISTINCT service FROM logs"
        }
      ]
    },
    "charts": [
      {
        "chart_type": "line_chart",
        "name": "CPU Usage",
        "x": 0,
        "y": 0,
        "w": 6,
        "h": 4,
        "transform_with": "async (existingDataByQuery, newDataByQuery, lastRun) => { return newDataByQuery; }",
        "settings": {
          "unit": "percent",
          "y_axis_scale": "linear"
        },
        "chart_queries": [
          {
            "query_type": "sql_expression",
            "sql_query": "SELECT {{time}} as time, avg(cpu_usage) as value FROM metrics WHERE service = '{{service}}' GROUP BY time"
          }
        ],
        "chart_alerts": []
      }
    ],
    "sections": [
      {
        "name": "System Metrics",
        "y": 0,
        "collapsed": false
      }
    ]
  }
}
401
404

Response body

{
  "errors": "Resource with provided ID was not found"
}

Example cURL

Example
curl --request GET \
  --url "https://telemetry.betterstack.com/api/v2/dashboards/1234/export" \
  --header "Authorization: Bearer $TOKEN"