Create an exploration 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
on_missing_data
string
check_period
required integer
query_period
integer
aggregation_interval
integer
confirmation_period
integer
recovery_period
integer
anomaly_sensitivity
number
anomaly_trigger
string
anomaly_training_range_days
integer
series_names
array
series_names_except
array
additional_conditions
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": "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, table_chart, or tail_chart. The query must also include the {{time}} variable.

Example requests

Threshold alert Relative alert Anomaly alert String value 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": 5,
    "anomaly_trigger": "higher",
    "escalation_target": { "policy_id": 456 }
  }'
curl --request POST \
  --url https://telemetry.betterstack.com/api/v2/explorations/123/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
{
  "attributes": {
    "alert_type": "threshold",
    "operator": "higher_than",
    "value": 100,
    "string_value": null,
    "check_period": 300,
    "on_missing_data": "dont_fire"
  }
}
{
  "attributes": {
    "alert_type": "anomaly_rrcf",
    "anomaly_sensitivity": 5.0,
    "anomaly_trigger": "any",
    "anomaly_training_range_days": 7
  }
}

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

Multiple conditions

Use additional_conditions to require more than one condition before an incident opens. Each condition is combined with the primary condition, the alert's own operator, value, and series scope, using logical AND. The alert only fires where every condition is breached in the same time bucket, so a series that falls outside any one condition's scope never alerts. You can add up to 4 additional conditions.

Each condition is an object with these fields:

  • alert_type: threshold or relative. Anomaly detection cannot be an additional condition, but an anomaly_rrcf alert can still carry threshold and relative conditions.
  • operator: the comparison operator for the condition's alert_type, using the same values as the primary operator.
  • value: the numeric threshold or percentage change. Omit it when you set string_value.
  • string_value: an exact string to match instead of value, only with the equal or not_equal operators.
  • series_names: an array limiting the condition to specific data series. Cannot be combined with series_names_except.
  • series_names_except: an array excluding specific data series. Cannot be combined with series_names.

Send an empty array to clear all additional conditions.

Alert with two conditions
{
  "name": "CPU high and still climbing",
  "alert_type": "threshold",
  "operator": "higher_than",
  "value": 1.5,
  "check_period": 300,
  "additional_conditions": [
    {
      "alert_type": "relative",
      "operator": "increases_by",
      "value": 10
    }
  ]
}

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