API Reference

Manage your monitors programmatically with personal API tokens.

Authentication

All API requests require a personal API token. Create one in Settings → API tokens. Pass the token as a Bearer token in the Authorization header.

curl -H "Authorization: Bearer vtk_your_token_here" \
     https://vigilmon.online/api/v1/monitors

Base URL

https://vigilmon.online/api/v1

Monitors

GET /api/v1/monitors

List all monitors for the authenticated user. Paginated (20 per page).

Example

curl -H "Authorization: Bearer vtk_your_token" \
     https://vigilmon.online/api/v1/monitors
{
  "data": [
    {
      "id": 1,
      "name": "Production API",
      "url": "https://api.example.com/health",
      "method": "GET",
      "check_interval_seconds": 60,
      "is_active": true,
      "current_status": "up",
      "last_checked_at": "2024-01-15T10:30:00+00:00"
    }
  ],
  "meta": { "current_page": 1, "total": 1 }
}
POST /api/v1/monitors

Create a new monitor.

Request body

{
  "name": "Production API",          // required
  "url": "https://api.example.com",  // required
  "method": "GET",                   // optional, default GET
  "expected_status_code": 200,       // optional, default 200
  "check_interval_seconds": 60,      // optional, plan minimum applies
  "keyword": "healthy",              // optional, check response body
  "regions": ["us-east", "eu-west"]  // optional
}

Example

curl -X POST \
     -H "Authorization: Bearer vtk_your_token" \
     -H "Content-Type: application/json" \
     -d '{"name":"Prod API","url":"https://api.example.com","check_interval_seconds":60}' \
     https://vigilmon.online/api/v1/monitors
GET /api/v1/monitors/{id}

Get monitor details including uptime percentages for the last 24h, 7d, and 30d.

curl -H "Authorization: Bearer vtk_your_token" \
     https://vigilmon.online/api/v1/monitors/1
{
  "data": {
    "id": 1,
    "name": "Production API",
    "url": "https://api.example.com/health",
    "current_status": "up",
    "uptime": {
      "24h": 100.0,
      "7d": 99.95,
      "30d": 99.87
    }
  }
}
GET /api/v1/monitors/{id}/incidents

List incidents for a monitor. Returns the 30 most recent per page, ordered newest first. Each incident includes start time, resolution time, duration, and status.

curl -H "Authorization: Bearer vtk_your_token" \
     https://vigilmon.online/api/v1/monitors/1/incidents
{
  "data": [
    {
      "id": 42,
      "started_at": "2024-01-15T08:12:00+00:00",
      "resolved_at": "2024-01-15T08:34:00+00:00",
      "duration_seconds": 1320,
      "cause": "HTTP 503 Service Unavailable",
      "confirmed_regions": ["za-vps"],
      "status": "resolved"
    },
    {
      "id": 41,
      "started_at": "2024-01-10T22:05:00+00:00",
      "resolved_at": null,
      "duration_seconds": null,
      "cause": "Connection timed out",
      "confirmed_regions": ["za-vps", "eu-west"],
      "status": "ongoing"
    }
  ],
  "meta": { "current_page": 1, "total": 2 }
}
PATCH /api/v1/monitors/{id}

Update a monitor. All fields are optional — only send what you want to change.

curl -X PATCH \
     -H "Authorization: Bearer vtk_your_token" \
     -H "Content-Type: application/json" \
     -d '{"check_interval_seconds":30}' \
     https://vigilmon.online/api/v1/monitors/1
DELETE /api/v1/monitors/{id}

Permanently delete a monitor. Returns 204 No Content on success.

curl -X DELETE \
     -H "Authorization: Bearer vtk_your_token" \
     https://vigilmon.online/api/v1/monitors/1

Error responses

Status Meaning
401Missing or invalid token
403Token does not own this monitor
404Monitor not found
422Validation error (check errors key)
429Rate limit exceeded (60 req/min)

CI/CD integration example

Pause monitoring during a deployment so you don't get false-positive alerts:

TOKEN="vtk_your_token"
MONITOR_ID=1

# Pause before deploy
curl -X PATCH \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"is_active":false}' \
     https://vigilmon.online/api/v1/monitors/$MONITOR_ID

# ... run your deployment ...

# Resume after deploy
curl -X PATCH \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"is_active":true}' \
     https://vigilmon.online/api/v1/monitors/$MONITOR_ID