Server Monitor API v1

Read-only API for status, components, incidents, and webhooks. Build status pages, badges, and alerting pipelines.

Endpoints reference

All requests require authentication via X-API-Key or Authorization: Bearer. Success responses are wrapped as { "success": true, "data": { ... } }; errors as { "success": false, "error": "message" }.

GET /status

Returns overall status summary for your monitors: counts by status, overall state (operational/degraded), uptime percentage, and active incidents.

Method: GET

Path: /status

Example request:

curl -X GET "https://faciotech.com/modules/addons/faciotech_monitor/api.php/status" \
  -H "X-API-Key: your_api_key_here"

Example response (200):

{
  "success": true,
  "data": {
    "status": {
      "total": 5,
      "up": 4,
      "down": 1,
      "pending": 0,
      "paused": 0,
      "overall_status": "degraded",
      "uptime_percentage": 80.0
    },
    "active_incidents": [],
    "timestamp": "2026-02-07T12:00:00+00:00"
  }
}

Status codes: 200 OK, 401 Unauthorized, 429 Too Many Requests.

GET /monitors

List all monitors (components) for your account. Optional query filters: status, type.

Method: GET

Path: /monitors

Query parameters: status (optional), type (optional).

Example request:

curl -X GET "https://faciotech.com/modules/addons/faciotech_monitor/api.php/monitors?status=up" \
  -H "X-API-Key: your_api_key_here"

Example response (200):

{
  "success": true,
  "data": {
    "monitors": [
      {
        "id": 1,
        "name": "Web Server",
        "type": "https",
        "target": "https://example.com",
        "status": "up",
        "is_active": 1,
        "created_at": "2026-01-01 00:00:00",
        "updated_at": "2026-02-07 12:00:00"
      }
    ],
    "count": 1
  }
}

Status codes: 200 OK, 401, 429.

GET /monitors/{id}

Fetch a single monitor by ID. Optional query: include_logs=1, logs_limit (default 50, max 100); include_uptime=1, uptime_days (default 30, max 90).

Method: GET

Path: /monitors/{id}

Query parameters: include_logs, logs_limit, include_uptime, uptime_days.

Example request:

curl -X GET "https://faciotech.com/modules/addons/faciotech_monitor/api.php/monitors/1?include_uptime=1&uptime_days=30" \
  -H "X-API-Key: your_api_key_here"

Example response (200):

{
  "success": true,
  "data": {
    "monitor": {
      "id": 1,
      "name": "Web Server",
      "type": "https",
      "target": "https://example.com",
      "status": "up",
      "uptime": {
        "period_days": 30,
        "total_checks": 8640,
        "up_checks": 8620,
        "uptime_percentage": 99.77,
        "avg_response_time": 145.2
      }
    }
  }
}

Status codes: 200 OK, 404 Not Found, 401, 429.

GET /incidents

List incidents for your monitors. Supports pagination and filters.

Method: GET

Path: /incidents

Query parameters: monitor_id (optional), active (optional, for unresolved), page (default 1), per_page (default 25, max 100).

Example request:

curl -X GET "https://faciotech.com/modules/addons/faciotech_monitor/api.php/incidents?per_page=10&page=1" \
  -H "X-API-Key: your_api_key_here"

Example response (200):

{
  "success": true,
  "data": {
    "incidents": [
      {
        "id": 1,
        "monitor_id": 1,
        "monitor_name": "Web Server",
        "target": "https://example.com",
        "started_at": "2026-02-07T10:00:00",
        "ended_at": null,
        "title": "Elevated latency",
        "description": null
      }
    ],
    "pagination": {
      "total": 1,
      "per_page": 10,
      "current_page": 1,
      "total_pages": 1
    }
  }
}

Status codes: 200 OK, 401, 429.

GET /incidents/{id}

Fetch a single incident by ID.

Method: GET

Path: /incidents/{id}

Example request:

curl -X GET "https://faciotech.com/modules/addons/faciotech_monitor/api.php/incidents/1" \
  -H "X-API-Key: your_api_key_here"

Example response (200):

{
  "success": true,
  "data": {
    "incident": {
      "id": 1,
      "monitor_id": 1,
      "monitor_name": "Web Server",
      "target": "https://example.com",
      "started_at": "2026-02-07T10:00:00",
      "ended_at": null,
      "title": "Elevated latency",
      "description": null
    }
  }
}

Status codes: 200 OK, 404 Not Found, 401, 429.

GET /test

Health check: confirms the API is reachable and the key is valid. Returns a short success message and your client ID.

Method: GET

Path: /test

Example request:

curl -X GET "https://faciotech.com/modules/addons/faciotech_monitor/api.php/test" \
  -H "X-API-Key: your_api_key_here"

Example response (200):

{
  "success": true,
  "data": {
    "message": "API is working",
    "client_id": 123
  }
}

Status codes: 200 OK, 401, 429.

Planned endpoints

The following may be added in a future version:

  • GET /maintenance — List maintenance windows.
  • GET /metrics — Aggregated metrics (e.g. uptime over time).

Use GET /test as a simple health check today.

Error responses

On failure the API returns JSON with success: false and error message. HTTP status codes: 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 405 Method Not Allowed, 429 Too Many Requests, 500 Internal Server Error.