Create an alert

Creates a new alert for a specific exploration.

POST https://telemetry.betterstack.com/api/v2/explorations/{exploration_id}/alerts

URL parameters

exploration_id
required integer

Headers

Authorization
required string

Body parameters

name
required string
alert_type
required string
operator
string
value
number
string_value
string
anomaly_sensitivity
number
anomaly_trigger
string
query_period
integer
confirmation_period
required integer
recovery_period
integer
check_period
integer
aggregation_interval
integer
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
team_name
string
201

Response body

{
  "data": {
    "id": 789,
    "type": "alert",
    "attributes": {
      "name": "High Error Rate Alert",
      "alert_type": "threshold",
      "operator": "higher_than",
      "value": 100.0,
      "query_period": 300,
      "confirmation_period": 0,
      "recovery_period": 300,
      "escalation_target": {
        "policy_id": 456
      },
      "paused": false,
      "paused_reason": null,
      "incident_cause": "Error rate exceeded threshold",
      "metadata": {
        "environment": "production",
        "service": "api"
      },
      "created_at": "2026-02-20T10:00:00Z",
      "updated_at": "2026-02-20T10:00:00Z"
    }
  }
}
422

Response body

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

Alerts can only be created on explorations with compatible chart types: line_chart, bar_chart, number_chart, or tail_chart. The query must also include the {{time}} variable.

Example requests

Threshold alert Relative alert Anomaly alert
curl --request POST \
  --url https://telemetry.betterstack.com/api/v2/explorations/123/alerts \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "High error rate",
    "alert_type": "threshold",
    "operator": "higher_than",
    "value": 100,
    "confirmation_period": 0,
    "check_period": 300,
    "escalation_target": "current_team"
  }'
curl --request POST \
  --url https://telemetry.betterstack.com/api/v2/explorations/123/alerts \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Sign-ups Dropped",
    "alert_type": "relative",
    "operator": "decreases_by",
    "value": 50,
    "check_period": 600,
    "query_period": 3600,
    "escalation_target": { "team_name": "My team" }
  }'
curl --request POST \
  --url https://telemetry.betterstack.com/api/v2/explorations/123/alerts \
  --header "Authorization: Bearer $TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Anomalous CPU usage",
    "alert_type": "anomaly_rrcf",
    "confirmation_period": 0,
    "check_period": 900,
    "anomaly_sensitivity": 75,
    "anomaly_trigger": "higher",
    "escalation_target": { "policy_id": 456 }
  }'



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