# Move and resize dashboard charts

Move and resize several charts on a dashboard at once. Every move is checked against the 12-column grid and against the final layout, so charts can swap places. The moves are applied together or not at all, and charts then move up to fill any gaps. Returns the full dashboard. The dashboard's version before the moves is kept, so the layout can be rolled back.

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

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

[[body_param]]
name = "charts"
required = true
type = "array of objects"
description = "The charts to move, each with its new place. Values out of range are moved to the nearest allowed value."

[[body_param]]
name = "charts[].id"
required = true
type = "string"
description = "ID of the chart to move."

[[body_param]]
name = "charts[].x"
required = true
type = "integer"
description = "New grid x position, from 0 to 11."

[[body_param]]
name = "charts[].y"
required = true
type = "integer"
description = "New grid y position, from 0."

[[body_param]]
name = "charts[].w"
type = "integer or null"
description = "New width, from 1 to 12. Leave it out or send `null` to keep the chart's width."

[[body_param]]
name = "charts[].h"
type = "integer or null"
description = "New height, from 1 to 50. Leave it out or send `null` to keep the chart's height."

[[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"
    }
  }
}
'''

[[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, or, with an OAuth token, the user's role can't change it."
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 = "Two charts would overlap, a chart would extend beyond the grid, a chart isn't on this dashboard, or no moves were sent. `invalid_values.charts` says which."

[[response]]
status = 422
description = "The `charts` attribute is missing or isn't a list, an entry has a key other than `id`, `x`, `y`, `w` and `h`, or misses `id`, `x` or `y`, or a value isn't a whole number. The entry is named by its position, such as `charts[0].x`."
[/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."
[/params]

#### Example cURL

```shell
[label Move charts]
curl --request PUT \
  --url https://telemetry.betterstack.com/api/v4/dashboards/1234/layout \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "charts": [
    {
      "id": "18718",
      "x": 6,
      "y": 0
    },
    {
      "id": "18719",
      "x": 0,
      "y": 0,
      "w": 6,
      "h": 4
    }
  ]
}'
```
