Create a dashboard

Creates a new dashboard, including its variables and other properties.

POST https://telemetry.betterstack.com/api/v2/dashboards

Headers

Authorization
required string

Body parameters

name
required string
dashboard_group_id
integer
refresh_interval
0 integer
date_range_from
now-3h string
date_range_to
now string
source_eligibility_sql
string
variables
array
team_name
string
201

Response body

{
  "data": {
    "id": "1234",
    "type": "dashboard",
    "attributes": {
      "name": "New API Dashboard",
      "dashboard_group_id": 789,
      "refresh_interval": 60,
      "date_range_from": "now-1h",
      "date_range_to": "now",
      "variables": [
        {
          "name": "environment",
          "variable_type": "string",
          "values": [
            "production"
          ],
          "default_values": [
            "production"
          ]
        }
      ]
    }
  }
}
422

Response body

{
  "errors": "Sorry, some values are incorrect",
  "invalid_values": {
    "name": [
      "can't be blank"
    ]
  }
}

Variables

Each object in the variables array defines a new variable. See Query variables for details.

  • name - Name of the variable, without the {{}}.
  • variable_type - Type of the variable.
  • values - An array of values for the variable.
  • default_values - An array of default values for the variable.
  • sql_definition - Required for select_with_sql type to populate options.

Example Request

cURL
curl --request POST \
  --url https://telemetry.betterstack.com/api/v2/dashboards \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "New API Dashboard",
    "dashboard_group_id": 789,
    "refresh_interval": 60,
    "date_range_from": "now-1h",
    "date_range_to": "now",
    "variables": [
      {
        "name": "environment",
        "variable_type": "string",
        "values": ["production"],
        "default_values": ["production"]
      },
      {
        "name": "service",
        "variable_type": "select_with_sql",
        "sql_definition": "SELECT DISTINCT service FROM logs"
      }
    ]
  }'