Monitoring API

RESTful API for managing monitors, notifications, and accessing monitoring data

Authentication: Use Bearer API key for programmatic access or Supabase session for browser access

Authentication

Header Format

Authorization: Bearer YOUR_SECRET

API Key Management

POST /api/keys
{
  "name": "My API Key",
  "scopes": ["monitors:read", "monitors:write"]
}
GET /api/keysDELETE /api/keys/:id

Available Scopes

monitors:readmonitors:writeproviders:readproviders:write
Quick Start
1
Create an API key in your account settings
2
Include the key in your Authorization header
3
Start making API calls

Base URL

https://your-domain.com/api
Monitors API

List Monitors

GET
GET /api/monitors
?status=up|down
&type=http|ping
&page=1&pageSize=20

Create Monitor

POST
POST /api/monitors
{
  "friendly_name": "My Website",
  "url": "https://example.com",
  "type": "http",
  "interval": 60,
  "is_active": true
}

Get Monitor Details

GET
GET /api/monitors/:id

Update Monitor

PUT
PUT /api/monitors/:id
{
  "friendly_name": "Updated Name",
  "is_active": false
}

Get Monitor Incidents

GET
GET /api/monitors/:id/incidents?window=24h|30d|6mo|1y
Notification Providers API

List Providers

GET
GET /api/providers

Create Email Provider

POST
POST /api/providers
{
  "provider_type": "email",
  "recipient_email": "alerts@example.com"
}

Provider Types & Required Fields

email
recipient_email
slack
webhook_url, channel?, username?
telegram
chat_id, token
SMS
phone_number
Monitor Notifications API

List Assignments

GET
GET /api/monitors/:id/notifications

Create Assignment

POST
POST /api/monitors/:id/notifications
{
  "provider_id": 1,
  "enabled": true
}

Remove Assignment

DELETE
DELETE /api/monitors/:id/notifications
{
  "provider_id": 1
}
Test Notifications API

Test Provider

POST
POST /api/providers/:id/test

# Sends a test notification to verify provider configuration
# Returns success/error message
Test Message Examples:
Email: "🧪 Test notification from your monitoring system..."Slack: "🧪 Test notification from your monitoring system..."Telegram: "🧪 Test notification from your monitoring system..."SMS: "Test notification from your monitoring system..."
Important Notes

Per-User Access

All endpoints enforce user-level access. API keys are tied to a single user account.

Scope-Based Authorization

API keys require specific scopes for read/write access to different resources.

Row Level Security

Database-level RLS policies are active on monitors, providers, and assignments.

Rate Limiting

API requests are rate limited to ensure service stability and fair usage.