Create a dashboard alert

Creates a new alert for a specific dashboard chart.

POST https://telemetry.betterstack.com/api/v2/dashboards/{dashboard_id}/charts/{chart_id}/alerts

URL parameters

dashboard_id
required integer
chart_id
required integer

Headers

Authorization
required string

Body parameters

name
required string
alert_type
required string
operator
string
value
number
string_value
string
check_period
required integer
query_period
integer
aggregation_interval
integer
confirmation_period
integer
recovery_period
integer
anomaly_sensitivity
number
anomaly_trigger
string
series_names
array
source_variable
string
source_mode
string
source_platforms
array
incident_cause
string
incident_per_series
boolean
escalation_target
object
call
boolean
sms
boolean
email
boolean
push
boolean
critical_alert
boolean
metadata
object
paused
boolean
201

Response body

{
  "data": {
    "id": "790",
    "type": "alert",
    "attributes": {
      "name": "High Error Rate",
      "alert_type": "threshold",
      "operator": "higher_than",
      "value": 100.0,
      "paused": false
    }
  }
}
422

Response body

{
  "errors": "Sorry, some values are incorrect",
  "invalid_values": {
    "chart_type": "Alerts are not supported for chart type 'pie_chart'."
  }
}

Alerts can only be created on charts with compatible types: line_chart, bar_chart, number_chart, tail_chart, or table_chart.

Example requests

Threshold alert String value alert
curl --request POST \
  --url https://telemetry.betterstack.com/api/v2/dashboards/123/charts/456/alerts \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "High Error Rate",
    "alert_type": "threshold",
    "operator": "higher_than",
    "value": 100,
    "check_period": 300,
    "confirmation_period": 0,
    "escalation_target": { "policy_name": "Critical Policy" },
    "metadata": { "runbook": "http://runbook/high-errors" }
  }'
curl --request POST \
  --url https://telemetry.betterstack.com/api/v2/dashboards/123/charts/456/alerts \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Status is Error",
    "alert_type": "threshold",
    "operator": "equal",
    "string_value": "error",
    "check_period": 300,
    "confirmation_period": 0
  }'


Alert types and attributes

The attributes in the alert response vary based on the alert_type.

Threshold/Relative Response Anomaly Response
{
  "operator": "higher_than",
  "value": 100,
  "string_value": null,
  "check_period": 300
}
{
  "anomaly_sensitivity": 75.0,
  "anomaly_trigger": "any"
}

For threshold and relative alerts, the fields anomaly_sensitivity and anomaly_trigger are omitted. For anomaly_rrcf alerts, the fields operator, value, string_value, and check_period are omitted.

Escalation targets

The escalation_target object determines where notifications are sent:

  • For current team, use "current_team" as a string.

  • Reference a different team using { "team_id": 123 } or { "team_name": "Ops Team" }.

  • Reference an escalation policy using { "policy_id": 456 } or { "policy_name": "Critical Policy" }. When escalating to a policy, notification channels (call, sms, etc.) are managed by the policy itself and are ignored in the API request.

Metadata

The metadata object allows you to attach custom key-value pairs to an alert. This information is included in incident notifications for extra context. Both keys and values must be strings.

Metadata example
{
  "metadata": {
    "environment": "production",
    "runbook": "https://wiki.example.com/runbooks/high-error-rate"
  }
}