Alerts API

Alerts API

1.0.1OAS 3.1

Manage alert rules and query active alerts.

API Base URL
  • Server 1:https://api.{region}.poly.ai
    Variables
    region:
Security
polyApiKey (apiKey)

An API key is a token that you provide when making API calls. Include the token in a header parameter called X-API-KEY.

Example: X-API-KEY: 123

List Alert Rules

List alert rules with optional filters.

Query params:

  • enabled: Filter by enabled status
  • metric: Filter by metric type
  • project_id: Filter by project ID
  • state: Filter by current alert state (OK|ALERT|NO_DATA|UNKNOWN)
get
https://api.dev.poly.ai/v1/alert-rules

Query Parameters

enabledboolean

Filter by enabled status

metric

Filter by metric

Allowed values:turn_latency_p50turn_latency_p95api_errorsfunction_errorscall_crashescall_volume

project_idstring

Filter by project ID

state

Filter by current state

Allowed values:okalertno_dataunknown

Response

application/json

Successful Response

AlertRuleListResponse

Every alert rule in scope, each with its current state.

dataarray[object]required

An alert rule: its trigger condition, evaluation window, and current state.

Show Child Parameters
get/v1/alert-rules
 
application/json

Create Alert Rule

Create a new alert rule.

The account_id is derived from the X-API-KEY header.

post
https://api.dev.poly.ai/v1/alert-rules

Body

application/json

AlertRuleCreateRequest

Fields for creating a new alert rule: which metric to watch, the
threshold condition, and how long it must hold to fire.

namestringrequired

Alert rule name

project_idstring

Project ID (optional)

metricrequired

Metric to monitor

Allowed values:turn_latency_p50turn_latency_p95api_errorsfunction_errorscall_crashescall_volume

operatorrequired

Comparison operator

Allowed values:><>=<=

threshold_valueintegerrequired

Threshold value

>= 0

window_durationrequired

Window duration (5m, 10m, or 60m)

Allowed values:5m10m60m

enabledboolean

Whether the alert is enabled

Default:true

Response

application/json

Successful Response

AlertRuleResponse

An alert rule: its trigger condition, evaluation window, and current state.

idstringrequired

Alert rule ID

namestringrequired

Alert rule name

project_idstring

Project ID

metricstringrequired

Metric being monitored

operatorstringrequired

Comparison operator

threshold_valueintegerrequired

Threshold value

window_durationstringrequired

Window duration (5m, 10m, or 60m)

enabledbooleanrequired

Whether the alert is enabled

current_statestring

Current alert state

sincestring(date-time)

When the current state started

last_evaluated_atstring(date-time)

Last evaluation timestamp

current_valueinteger

Current metric value

created_atstring(date-time)required

Creation timestamp

updated_atstring(date-time)required

Last update timestamp

post/v1/alert-rules

Body

{ "name": "name", "metric": "turn_latency_p50", "operator": ">", "threshold_value": 0, "window_duration": "5m" }
 
application/json