Skip to main content
POST
Create a monitor alert rule

Authorizations

Authorization
string
header
required

API key authorization. Pass your API key in the Authorization header as a Bearer token. Both new (gsk_*) and legacy (gsk-) API keys are accepted, e.g. Authorization: Bearer gsk_... or Authorization: Bearer gsk-....

Path Parameters

monitorId
string
required

Monitor ID

Example:

"monitor_123"

Body

application/json
type
enum<string>
required

The condition that opens the alert

Available options:
BAD_SESSION_COUNT,
NO_SCORE_RATE,
AVERAGE_SCORE
Example:

"BAD_SESSION_COUNT"

metricGroupId
string
required

A metric family this monitor scores

Minimum string length: 1
Example:

"metricGroup_123"

window
enum<string>
required

The trailing window the rule evaluates

Available options:
FIFTEEN_MINUTES,
ONE_HOUR,
SIX_HOURS,
TWENTY_FOUR_HOURS
Example:

"ONE_HOUR"

threshold
number
required

The count, percentage, or score the rule fires on, by type

Example:

3

recipients
string[]
required

Free-text email addresses notified when the rule fires (1 to 20)

Required array length: 1 - 20 elements
Example:
badSessionScore
number | null

BAD_SESSION_COUNT only: a session counts as bad at or below this score.

Example:

0.5

Response

Alert rule created successfully

id
string
required
Example:

"monitorAlertRule_123"

monitorId
string
required
Example:

"monitor_123"

type
enum<string>
required
Available options:
BAD_SESSION_COUNT,
NO_SCORE_RATE,
AVERAGE_SCORE
Example:

"BAD_SESSION_COUNT"

metricGroupId
string
required
Example:

"metricGroup_123"

window
enum<string>
required
Available options:
FIFTEEN_MINUTES,
ONE_HOUR,
SIX_HOURS,
TWENTY_FOUR_HOURS
Example:

"ONE_HOUR"

badSessionScore
number | null
required
Example:

0.5

threshold
number
required
Example:

3

recipients
string[]
required
Example:
userId
string | null
required
Example:

"user_123"

createdAt
string<date-time>
required
pausedAt
string<date-time> | null
required

When the rule was paused; null while it is active

Example:

null