Monitor API
The Monitor API allows you to programmatically create, configure, and manage monitoring for your websites, APIs, and services.
Creating a Website Monitor
To create a new website monitor, send a POST request:
curl -X POST "https://api.uptimekeeper.com/v1/monitors" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"type": "http",
"name": "Company Website",
"url": "https://example.com",
"check_frequency": 60,
"timeout": 30,
"regions": ["us-east", "eu-west", "asia-east"],
"validation": {
"status_code": 200,
"content_check": "Welcome to our site"
}
}'
API Parameters for Website Monitors
Parameter | Type | Description |
---|---|---|
type | string | Monitor type (http, https, tcp, etc.) |
name | string | Display name for the monitor |
url | string | URL to monitor |
check_frequency | integer | Seconds between checks |
timeout | integer | Seconds to wait before timing out |
regions | array | Geographic regions to check from |
validation | object | Criteria for successful check |
Creating an API Monitor
For API endpoint monitoring:
curl -X POST "https://api.uptimekeeper.com/v1/monitors" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"type": "api",
"name": "Payment API",
"url": "https://api.example.com/health",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token123"
},
"body": "{\"test\": true}",
"validation": {
"status_code": 200,
"json_path": "$.status",
"json_value": "healthy"
}
}'
Creating Other Monitor Types
The API supports various monitor types including TCP, DNS, SSL, and Ping:
# Example of an SSL certificate monitor
curl -X POST "https://api.uptimekeeper.com/v1/monitors" \
-H "X-API-Key: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"type": "ssl",
"name": "Website SSL",
"hostname": "example.com",
"alert_days_before_expiry": 14
}'