Skip to main content

Services API

In AlertifyPro, a service is a monitored endpoint. The API uses the term "service" — this maps to what users call "monitors" in the dashboard.

Base path: /api/v1/services

All endpoints require a valid JWT Bearer token.


List services​

GET /api/v1/services

Optional query params:

  • ?org=<org-slug> — specify organization by slug if not resolved from JWT
curl http://localhost:3001/api/v1/services \
-H "Authorization: Bearer <token>"

Response:

[
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"organization_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "Production API",
"description": "Main REST API",
"environment": "production",
"endpoint": "https://api.yourapp.com/health",
"check_type": "HTTP",
"check_interval_seconds": 60,
"timeout_seconds": 10,
"status": "GREEN",
"tags": []
}
]

Get a service​

GET /api/v1/services/{id}
curl http://localhost:3001/api/v1/services/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer <token>"

Create a service​

POST /api/v1/services
Content-Type: application/json

Required fields:

FieldTypeDescription
namestringDisplay name
endpointstringURL or host:port to check
check_typestringCheck protocol (see table below)

Optional fields:

FieldTypeDefaultDescription
organization_idstringFrom JWTOverride org (if multiple)
descriptionstring—Human-readable description
environmentstring—e.g. production, staging
check_interval_secondsint60How often to check (seconds)
timeout_secondsint10Timeout per check (seconds)

Example:

curl -X POST http://localhost:3001/api/v1/services \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API",
"endpoint": "https://api.yourapp.com/health",
"check_type": "HTTP",
"check_interval_seconds": 60,
"environment": "production"
}'

Response: 201 Created with the full service object.


Supported check types​

Check types are normalized to uppercase internally. Either case is accepted in requests.

check_typeProtocolEndpoint format
HTTP / HTTPSHTTP/HTTPS GEThttps://example.com/health
TCP / TELNETTCP connectionhost:port
PING / ICMPICMP pinghostname or IP
DNSDNS resolutionhostname
WEBSOCKET / WSWebSocket upgradewss://example.com/ws
SMTPSMTP greeting (220)smtp.example.com:587
IMAPIMAP banner (* OK)mail.example.com:993
FTPFTP greeting (220)ftp.example.com:21
SSHSSH bannerserver.example.com:22
REDISRedis PING → +PONGredis.example.com:6379
MYSQL / MARIADBTCP port checkdb.example.com:3306
MONGODB / MONGOTCP port checkmongo.example.com:27017
POSTGRES / POSTGRESQLTCP port checkdb.example.com:5432
GRPCTCP port checkgrpc.example.com:50051

Status values​

StatusMeaning
GREENCheck passed within normal response time
YELLOWCheck passed but response time > 1000ms (degraded)
REDCheck failed (connection refused, timeout, bad response)

Update a service​

PUT /api/v1/services/{id}
Content-Type: application/json
{
"name": "Production API v2",
"endpoint": "https://api.yourapp.com/v2/health",
"check_interval_seconds": 30,
"timeout_seconds": 15
}

Delete a service​

DELETE /api/v1/services/{id}

Returns 204 No Content on success.


Trigger an immediate check​

POST /api/v1/services/{id}/check

Enqueues an immediate ad-hoc check for the service.

Response: 202 Accepted

{ "status": "check enqueued" }

Service sub-resources​

PathDescription
GET /api/v1/services/{id}/metricsUptime and response time history
GET /api/v1/services/{id}/uptimeUptime percentage for a period
GET /api/v1/services/{id}/checksRaw check log