v1

latestOpenAPI 3.1.02026-07-2687120159.0 KB

Create an alert rule

Create a new alert rule. The account_id is derived from the X-API-KEY header.

post/v1/alert-rules

Request body

namestring required

Alert rule name

project_idstring nullable

Project ID (optional)

metric'turn_latency_p50' | 'turn_latency_p95' | 'api_errors' | 'function_errors' | 'call_crashes' | 'call_volume' required

Metric to monitor.

operator'>' | '<' | '>=' | '<=' required

Comparison operator used by the alert rule.

threshold_valueinteger required

Threshold value

window_duration'5m' | '10m' | '60m' required

Evaluation window duration. Allowed values: 5m, 10m, or 60m.

enabledboolean

Whether the alert is enabled

Example request

{
  "name": "High turn latency (p95)",
  "project_id": "proj_abc123",
  "metric": "turn_latency_p95",
  "operator": ">=",
  "threshold_value": 1500,
  "window_duration": "5m",
  "enabled": true
}

Response

Alert rule created successfully.

idstring required

Alert rule ID

namestring required

Alert rule name

project_idstring nullable

Project ID

metric'turn_latency_p50' | 'turn_latency_p95' | 'api_errors' | 'function_errors' | 'call_crashes' | 'call_volume' required

Metric to monitor.

operator'>' | '<' | '>=' | '<=' required

Comparison operator used by the alert rule.

threshold_valueinteger required

Threshold value

window_duration'5m' | '10m' | '60m' required

Evaluation window duration. Allowed values: 5m, 10m, or 60m.

enabledboolean required

Whether the alert is enabled

current_state'ok' | 'alert' | 'no_data' | 'unknown'

Current state of an alert rule.

sincestring date-time nullable

When the current state started

last_evaluated_atstring date-time nullable

Last evaluation timestamp

current_valueinteger nullable

Current metric value

created_atstring date-time required

Creation timestamp

updated_atstring date-time required

Last update timestamp

Example response

{
  "id": "ar_0Kx4mNpQ8rWvYb2dFgHjLs"
}