Skip to content

v0.2.19

Choose a tag to compare

@zigazajc007 zigazajc007 released this 14 Feb 11:16
· 29 commits to main since this release

Admin API

This release introduces the Admin API. A full set of REST endpoints for managing your Uptime Monitor configuration programmatically. Create, read, update, and delete monitors, groups, status pages, notification channels, and pulse monitors without manually editing config.toml.

Getting Started

Add this to your config.toml to enable the Admin API:

[adminAPI]
enabled = true
token = "your-secure-admin-token-here"

All endpoints are authenticated via Authorization: Bearer <token>.

Endpoints

Resource List / Create Get / Update / Delete
Configuration GET /v1/admin/config -
Monitors GET/POST /v1/admin/monitors GET/PUT/DELETE /v1/admin/monitors/:id
Groups GET/POST /v1/admin/groups GET/PUT/DELETE /v1/admin/groups/:id
Status Pages GET/POST /v1/admin/status-pages GET/PUT/DELETE /v1/admin/status-pages/:id
Notification Channels GET/POST /v1/admin/notifications GET/PUT/DELETE /v1/admin/notifications/:id
Pulse Monitors GET/POST /v1/admin/pulse-monitors GET/PUT/DELETE /v1/admin/pulse-monitors/:id

Highlights

  • Safe for production - all inputs are validated before writing. If a config reload fails after write, the previous configuration is automatically restored.
  • Automatic reference cleanup - deleting a group removes its groupId from monitors, its ID from status page items, and its parentId from child groups. Same applies to monitors, notification channels, and pulse monitors.
  • Partial updates - PUT endpoints accept only the fields you want to change. Set a field to null to remove optional values.
  • Conflict detection - duplicate IDs, tokens, and slugs are rejected with 409 Conflict.
  • OpenAPI spec updated - all admin endpoints are fully documented in /openapi.json

Example: Create a Monitor

curl -X POST http://localhost:3000/v1/admin/monitors \
  -H "Authorization: Bearer your-secure-admin-token-here" \
  -H "Content-Type: application/json" \
  -d '{
    "id": "api-staging",
    "name": "Staging API",
    "token": "tk_staging_api_secret",
    "interval": 30,
    "maxRetries": 2,
    "resendNotification": 0,
    "groupId": "staging",
    "notificationChannels": ["critical"]
  }'

Documentation