# Roll back a dashboard

Roll back a dashboard to one of its versions. The whole dashboard goes back to how it was in that version, and every change since, by anyone, is rolled back. Charts and alerts added since are removed, and ones removed since come back. Returns the full dashboard. An alert that still exists keeps its paused state. An alert that comes back starts checking at once and can open incidents. The rollback is itself kept as a new version, so it can be rolled back too.

[endpoint]
method = "POST"
base_url = "https://telemetry.betterstack.com"
path = "/api/v4/dashboards/{id}/rollback"

[[path_param]]
name = "id"
required = true
type = "string"
description = "The ID of the dashboard."

[[body_param]]
name = "version"
required = true
type = "integer"
description = "The `number` of the dashboard version to go back to. The dashboard goes back to how it was right before the change listed with that version. To roll back everything one person, token or AI SRE conversation changed, pass the version listed with their first change."

[[query_param]]
name = "team_id"
type = "string"
description = "Team to use, such as `t123`. Get the ID via [List teams](/docs/uptime/api/teams/list/). Required when you can access more than one team."

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

[[header]]
name = "Content-Type"
description = "application/json"
required = false
type = "string"
[/endpoint]

[responses]
[[response]]
status = 200
description = "Returns the dashboard."
body = '''
{
  "data": {
    "id": "123456789",
    "type": "dashboard",
    "attributes": {
      "name": "Sample Dashboard",
      "dashboard_group_id": "789",
      "refresh_interval": 30,
      "date_range_from": "now-3h",
      "date_range_to": "now",
      "source_eligibility_sql": "SELECT countMerge(events_count) FROM {{source}} WHERE name = 'node_cpu_seconds_total' LIMIT 1",
      "variables": [
        {
          "name": "environment",
          "variable_type": "string",
          "values": [
            "production"
          ],
          "default_values": [
            "production"
          ],
          "allow_multiple_values": false
        }
      ],
      "charts": [
        {
          "id": "567",
          "chart_type": "line_chart",
          "name": "CPU Usage",
          "x": 0,
          "y": 0,
          "w": 6,
          "h": 4
        }
      ],
      "sections": [
        {
          "id": "890",
          "name": "Key Metrics",
          "y": 0,
          "collapsed": false
        }
      ],
      "has_overlaps": false,
      "product": "rum",
      "created_at": "2025-01-20T15:00:00.000Z",
      "updated_at": "2025-01-21T10:00:00.000Z",
      "url": "https://telemetry.betterstack.com/team/t123456/dashboards/123",
      "team_id": "t123456",
      "team_name": "example-team"
    }
  },
  "rollback": {
    "version": 2,
    "version_created_at": "2026-11-20T20:20:58.511Z",
    "changes": [
      "CPU renamed"
    ],
    "change_count": 1
  }
}
'''

[[response]]
status = 401
description = "The API token is missing or invalid."
body = '''
{
  "errors": "Invalid Team API token. How to find your Team API token: https://betterstack.com/docs/logs/api/getting-started/#obtaining-a-logtail-api-token"
}
'''

[[response]]
status = 403
description = "The dashboard belongs to another team and is shared into this one. Only your own teams' dashboards can be rolled back. Also returned when, with an OAuth token, the user's role can't change the dashboard or one of the alerts the rollback would change."
body = '''
{
  "errors": "Dashboard 123 belongs to another team. The API only changes your own teams' dashboards."
}
'''

[[response]]
status = 404
description = "The dashboard doesn't exist, or the token can't access it."
body = '''
{
  "errors": "Resource with the provided ID was not found"
}
'''

[[response]]
status = 422
description = "The `version` attribute is missing or isn't a whole number, the version isn't in the dashboard's history, which keeps only the newest versions, or the dashboard already looks the way it did then, so nothing was changed. `invalid_values.version` says which, or `required_attributes` when `version` is missing. Any other attribute is listed in `invalid_attributes`."
[/responses]

[params]
title = "Response attributes"

[[param]]
name = "id"
type = "string"
description = "The ID of the dashboard."

[[param]]
name = "type"
type = "string"
description = "Always `dashboard`."

[[param]]
name = "name"
type = "string"
description = "Dashboard name."

[[param]]
name = "dashboard_group_id"
type = "string or null"
description = "Group this dashboard belongs to."

[[param]]
name = "refresh_interval"
type = "integer"
description = "How often the dashboard refreshes its charts, in seconds. `0` turns automatic refresh off."

[[param]]
name = "date_range_from"
type = "string"
description = "Default range start, for example now-3h."

[[param]]
name = "date_range_to"
type = "string"
description = "Default range end, for example now."

[[param]]
name = "source_eligibility_sql"
type = "string or null"
description = "SQL that decides which sources this dashboard's charts can read. Returned when you get one dashboard."

[[param]]
name = "variables"
type = "array of objects"
description = "The dashboard's variables, which chart queries use by name, such as `{{source}}`. Returned when you get one dashboard. See [Query variables](/docs/logs/dashboards/variables/). Every dashboard has the built-in `time`, `start_time`, `end_time` and `source` variables, which are added when you leave them out and keep their own type. An update replaces all variables, so a variable you leave out is removed, except the built-in ones. For a variable that already exists, any of `variable_type`, `default_values`, `sql_definition`, `structured_value` and `allow_multiple_values` you leave out keeps its value, and `null` clears any of them except `variable_type`. A variable's `values` aren't kept between updates, so send them again. A `source` variable keeps its sources when you leave out both `values` and `structured_value`. Changing `variable_type` clears the old `default_values`, `sql_definition` and `structured_value`. `sql_definition` is accepted only on `select_with_sql` and `multi_select_with_sql` variables. When a variable is saved with empty `values`, a `select_value` variable gets the first of its `default_values`, and a `string`, `number`, `boolean` or `sql_expression` variable gets all of them. A `select_with_sql` variable whose `sql_definition` is new or changed gets the first option its SQL returns. An ISO 8601 date in a `date` or `datetime` variable is saved in `values` as a Unix timestamp in microseconds. A new or changed `sql_definition` or filter `sql` runs against the selected source, and the change is refused when the query fails."

[[param]]
name = "variables[].name"
type = "string"
description = "The name of the variable, used as `{{name}}` in queries."

[[param]]
name = "variables[].variable_type"
type = "string"
description = "The type of the variable, `source`, `date`, `datetime`, `string`, `number`, `sql_expression`, `select_value`, `boolean`, `select_with_sql` or `select_predefined_sql`."

[[param]]
name = "variables[].values"
type = "array of strings"
description = "The variable's current values as strings, or an empty list when it has none. For a `source` variable, the IDs of the selected sources."

[[param]]
name = "variables[].default_values"
type = "array of strings"
description = "The variable's default values as strings, or an empty list when it has none."

[[param]]
name = "variables[].sql_definition"
type = "string"
description = "The SQL expression whose distinct values are the options of a `select_with_sql` variable, such as `JSONExtractString(raw, 'service')`. The expression runs against the variable's source over the selected range."

[[param]]
name = "variables[].structured_value"
type = "object"
description = "The variable's other settings, such as the selected sources of a `source` variable in `canonicalSourceIds` and its services in `serviceIds`, or the saved filters of a `select_predefined_sql` variable. Left out when not set."

[[param]]
name = "variables[].structured_value.selected_label"
type = "string"
description = "Label of the selected value."

[[param]]
name = "variables[].structured_value.canonicalSourceIds"
type = "array of strings"
description = "Selected sources of a source variable. Source IDs in `values` set them."

[[param]]
name = "variables[].structured_value.serviceIds"
type = "array of strings"
description = "Selected services of a source variable."

[[param]]
name = "variables[].structured_value.filters"
type = "array of objects"
description = "Saved filters, each a label and the SQL that lists its values."

[[param]]
name = "variables[].structured_value.filters[].label"
type = "string"
description = "The filter's label, shown in the variable's menu."

[[param]]
name = "variables[].structured_value.filters[].sql"
type = "string"
description = "A complete query that returns one column with the filter's options."

[[param]]
name = "variables[].allow_multiple_values"
type = "boolean"
description = "Whether a `select_value` or `select_with_sql` variable accepts more than one value at a time."

[[param]]
name = "variables[].source_ids"
type = "array of strings"
description = "The IDs of the sources a `source` variable selects. Each must be one of your sources."

[[param]]
name = "variables[].filters"
type = "array of objects"
description = "The saved filters of a `select_predefined_sql` variable."

[[param]]
name = "variables[].filters[].label"
type = "string"
description = "The filter's label, shown in the variable's menu."

[[param]]
name = "variables[].filters[].sql"
type = "string"
description = "A complete query that returns one column with the filter's options."

[[param]]
name = "variables[].selected_label"
type = "string"
description = "The label of the selected filter of a `select_predefined_sql` variable. When not sent, the first filter is selected. A label that matches none of `filters` is refused."

[[param]]
name = "charts"
type = "array of objects"
description = "A summary of each chart on the dashboard, ordered top to bottom, then left to right. Returned when you get one dashboard. Use [Get dashboard chart](/docs/logs/api/charts/get/) for a chart's queries and settings."

[[param]]
name = "charts[].id"
type = "string"
description = "The chart's ID."

[[param]]
name = "charts[].chart_type"
type = "string"
description = "The chart's type, `line_chart`, `table_chart`, `bar_chart`, `number_chart`, `heatmap_chart`, `anomalies_chart`, `pie_chart`, `scatter_chart`, `gauge_chart`, `tail_chart`, `static_text_chart`, `map_chart`, `text_chart`, `funnel_chart`, `funnel_trend_chart` or `hierarchy_chart`."

[[param]]
name = "charts[].name"
type = "string"
description = "The chart's name."

[[param]]
name = "charts[].x"
type = "integer"
description = "The chart's horizontal position on the 12-column grid, from `0` at the left."

[[param]]
name = "charts[].y"
type = "integer"
description = "The chart's vertical position on the grid, from `0` at the top."

[[param]]
name = "charts[].w"
type = "integer"
description = "The chart's width in grid columns, from `1` to `12`."

[[param]]
name = "charts[].h"
type = "integer"
description = "The chart's height in grid rows."

[[param]]
name = "sections"
type = "array of objects"
description = "Sections on the dashboard. Returned when you get one dashboard."

[[param]]
name = "sections[].id"
type = "string"
description = "The section's ID."

[[param]]
name = "sections[].name"
type = "string or null"
description = "The section's name."

[[param]]
name = "sections[].y"
type = "integer"
description = "The section's vertical position on the grid, from `0` at the top. A section spans the full width."

[[param]]
name = "sections[].collapsed"
type = "boolean"
description = "Whether the section is collapsed."

[[param]]
name = "has_overlaps"
type = "boolean"
description = "Whether any charts overlap on the grid. Returned when you get one dashboard."

[[param]]
name = "product"
type = "string"
description = "The product the dashboard belongs to. Defaults to `telemetry`, and it can't be changed after create.<br/>Valid values:<br/>`telemetry`: A dashboard over logs, metrics and traces.<br/>`rum`: A Real User Monitoring dashboard."

[[param]]
name = "created_at"
type = "datetime"
description = "When the dashboard was created. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "updated_at"
type = "datetime"
description = "When the dashboard was last updated. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "url"
type = "string"
description = "Link to this dashboard's page in the Better Stack web app."

[[param]]
name = "team_id"
type = "string"
description = "Team that owns the dashboard, such as `t123`."

[[param]]
name = "team_name"
type = "string"
description = "Name of the team that owns the dashboard."

[[param]]
name = "rollback"
type = "object"
description = "What the rollback did, next to `data`."

[[param]]
name = "rollback.version"
type = "integer"
description = "The number of the version the dashboard went back to."

[[param]]
name = "rollback.version_created_at"
type = "datetime"
description = "When that version was saved. In ISO 8601 format, such as `2026-07-01T12:00:00Z`."

[[param]]
name = "rollback.changes"
type = "array of strings"
description = "Up to 25 of the changes the rollback made, in plain words."

[[param]]
name = "rollback.change_count"
type = "integer"
description = "How many changes the rollback made."
[/params]

#### Example cURL

```shell
[label Roll back a dashboard]
curl --request POST \
  --url https://telemetry.betterstack.com/api/v4/dashboards/1234/rollback \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "version": 2
}'
```
