Appearance
Alerts API Reference
This guide provides detailed information about the Alerts API endpoints.
List Alerts
Retrieve a list of all alerts.
http
GET /alerts
Query Parameters
Parameter | Type | Description |
---|---|---|
page | integer | Page number (default: 1) |
per_page | integer | Items per page (default: 20) |
status | string | Filter by status (active/resolved) |
monitor_id | string | Filter by monitor ID |
Response
json
{
"data": [
{
"id": "alt_123",
"monitor_id": "mon_123",
"type": "down",
"status": "active",
"message": "Website is down",
"created_at": "2024-01-01T00:00:00Z"
}
],
"meta": {
"page": 1,
"per_page": 20,
"total": 1
}
}
Create Alert
Create a new alert.
http
POST /alerts
Request Body
json
{
"monitor_id": "mon_123",
"type": "down",
"message": "Website is down",
"channels": ["email", "slack"],
"threshold": {
"value": 1000,
"operator": ">",
"duration": 300
}
}
Response
json
{
"data": {
"id": "alt_123",
"monitor_id": "mon_123",
"type": "down",
"status": "active",
"message": "Website is down",
"created_at": "2024-01-01T00:00:00Z"
}
}
Get Alert
Retrieve details of a specific alert.
http
GET /alerts/:id
Response
json
{
"data": {
"id": "alt_123",
"monitor_id": "mon_123",
"type": "down",
"status": "active",
"message": "Website is down",
"created_at": "2024-01-01T00:00:00Z",
"resolved_at": null,
"notifications": [
{
"channel": "email",
"sent_at": "2024-01-01T00:00:05Z",
"status": "delivered"
}
]
}
}
Update Alert
Update an existing alert.
http
PUT /alerts/:id
Request Body
json
{
"status": "resolved",
"message": "Website is back up"
}
Response
json
{
"data": {
"id": "alt_123",
"monitor_id": "mon_123",
"type": "down",
"status": "resolved",
"message": "Website is back up",
"created_at": "2024-01-01T00:00:00Z",
"resolved_at": "2024-01-01T00:05:00Z"
}
}
Alert Types
Type | Description |
---|---|
down | Service is down |
up | Service is back up |
slow | Response time exceeds threshold |
error | Error rate exceeds threshold |
custom | Custom alert condition |
Notification Channels
Channel | Description |
---|---|
Email notifications | |
slack | Slack webhook notifications |
webhook | Custom webhook notifications |
sms | SMS notifications |
Error Codes
Code | Description |
---|---|
alert_not_found | The specified alert does not exist |
invalid_request | The request parameters are invalid |
rate_limit | Too many requests |