Monitors API
Create, read, update, and delete uptime monitors.
List Monitors
GET /api/v1/monitorsRetrieve all monitors for your organization.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
active | boolean | Filter by active status |
limit | integer | Maximum results (default: 50, max: 100) |
offset | integer | Pagination offset (default: 0) |
Response
{
"monitors": [
{
"id": "mon_abc123",
"name": "Production API",
"url": "https://api.example.com/health",
"method": "GET",
"checkType": "http",
"frequency": 60,
"timeout": 30,
"expectedCode": 200,
"active": true,
"status": "up",
"uptime24h": 99.95,
"createdAt": "2024-01-01T00:00:00Z"
}
],
"count": 1
}Example
curl -X GET "https://statly.live/api/v1/monitors?active=true" \
-H "Authorization: Bearer sk_live_xxx"Create Monitor
POST /api/v1/monitorsCreate a new monitor.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display name (max 100 chars) |
url | string | Yes | URL to monitor |
method | string | No | HTTP method (default: GET) |
checkType | string | No | http, tcp, dns, websocket, api |
frequency | integer | No | Check interval in seconds (60-3600) |
timeout | integer | No | Request timeout (1-120) |
expectedCode | integer | No | Expected HTTP status (default: 200) |
headers | object | No | Custom request headers |
body | string | No | Request body for POST/PUT |
active | boolean | No | Enable/disable (default: true) |
Example
curl -X POST "https://statly.live/api/v1/monitors" \
-H "Authorization: Bearer sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API",
"url": "https://api.example.com/health",
"method": "GET",
"frequency": 60,
"timeout": 10,
"expectedCode": 200
}'Response
{
"id": "mon_abc123",
"name": "Production API",
"url": "https://api.example.com/health",
"method": "GET",
"checkType": "http",
"frequency": 60,
"timeout": 10,
"expectedCode": 200,
"active": true,
"createdAt": "2024-01-15T12:00:00Z"
}Get Monitor
GET /api/v1/monitors/{id}Get details of a specific monitor, including recent heartbeats.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Monitor ID |
Response
{
"id": "mon_abc123",
"name": "Production API",
"url": "https://api.example.com/health",
"status": "up",
"uptime24h": 99.95,
"uptime7d": 99.90,
"uptime30d": 99.85,
"heartbeats": [
{
"timestamp": "2024-01-15T12:00:00Z",
"status": "up",
"responseTime": 145,
"region": "us-east-1"
}
]
}Update Monitor
PATCH /api/v1/monitors/{id}Update an existing monitor.
Request Body
All fields are optional. Only include fields you want to update.
curl -X PATCH "https://statly.live/api/v1/monitors/mon_abc123" \
-H "Authorization: Bearer sk_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Name",
"frequency": 120,
"active": false
}'Response
Returns the updated monitor object.
Delete Monitor
DELETE /api/v1/monitors/{id}Delete a monitor. This is a soft delete; the monitor is deactivated but data is retained.
Example
curl -X DELETE "https://statly.live/api/v1/monitors/mon_abc123" \
-H "Authorization: Bearer sk_live_xxx"Response
HTTP/1.1 204 No ContentGet Heartbeats
GET /api/v1/monitors/{id}/heartbeatsGet heartbeat history for a monitor.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
from | string | Start time (ISO 8601) |
to | string | End time (ISO 8601) |
limit | integer | Max results (default: 100, max: 1000) |
Example
curl -X GET "https://statly.live/api/v1/monitors/mon_abc123/heartbeats?limit=50" \
-H "Authorization: Bearer sk_live_xxx"Response
{
"heartbeats": [
{
"timestamp": "2024-01-15T12:00:00Z",
"status": "up",
"responseTime": 145,
"region": "us-east-1"
},
{
"timestamp": "2024-01-15T11:59:00Z",
"status": "up",
"responseTime": 132,
"region": "eu-west-1"
}
],
"count": 50
}