# 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](https://betterstack.com/docs/logs/api/dashboards/import/).

This endpoint can be used to export both your [own dashboards](https://betterstack.com/docs/logs/api/dashboards/list/) and [dashboard templates](https://betterstack.com/docs/logs/api/dashboards/templates/).

[endpoint]
base_url = "https://telemetry.betterstack.com"
path = "/api/v2/dashboards/{id}/export"
method = "GET"

[[path_param]]
name = "id"
description = "The unique identifier of the dashboard or template to export."
required = true
type = "string"

[[header]]
name = "Authorization"
description = "Bearer `$TOKEN`"
required = true
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = "The dashboard configuration in JSON format."
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,
      "name": null,
      "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
      }
    ]
  }
}
'''

[[response]]
status = 401
description = "Invalid or missing authentication token."

[[response]]
status = 404
description = '''Resource with the provided ID was not found.'''
body = '''
{
  "errors": "Resource with the provided ID was not found"
}
'''
[/responses]

## Example cURL

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