{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hookpulse/json-schema/hookpulse-monitor-schema.json",
  "title": "Monitor",
  "description": "A dead-man switch: the thing you make ping. If the ping stops for longer than `interval_sec`, it becomes `overdue` and the alert goes out.",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hookpulse-endpoints-api-openapi.yml#/components/schemas/Monitor",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Monitor ID; it is the `:id` of the ingest URL."
    },
    "name": {
      "type": "string",
      "description": "Name you gave it, to recognise it in the alert."
    },
    "interval_sec": {
      "type": "integer",
      "description": "Tolerated silence, in seconds. Past that, it is a miss."
    },
    "alert_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "E-mail alerted on a miss."
    },
    "alert_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "HTTPS URL that receives a POST on a miss (Slack, Discord, n8n)."
    },
    "last_event_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "Last ping received (UTC); `null` while it never pinged."
    },
    "last_status": {
      "type": [
        "integer",
        "null"
      ],
      "description": "HTTP status the last ping sent, when it did."
    },
    "last_latency_ms": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Latency reported in the last ping, in ms."
    },
    "miss_count": {
      "type": "integer",
      "description": "How many times this monitor has gone silent."
    },
    "alerted_at": {
      "type": [
        "string",
        "null"
      ],
      "description": "When the last alert went out — it is what holds the 1 alert/24h cap."
    },
    "active": {
      "type": "boolean",
      "description": "Whether the monitor is on."
    },
    "healthy": {
      "type": "boolean",
      "description": "`true` when it has pinged at least once and is not overdue."
    },
    "overdue": {
      "type": "boolean",
      "description": "`true` when the silence passed `interval_sec`."
    },
    "waiting_first_ping": {
      "type": "boolean",
      "description": "`true` while it never pinged. Neither healthy nor overdue: nobody has wired it yet."
    },
    "created_at": {
      "type": "string",
      "description": "When the monitor was created (UTC)."
    },
    "ingest_url": {
      "type": "string",
      "description": "The URL your cron/webhook calls to prove life."
    },
    "token": {
      "type": "string",
      "description": "Read token of this monitor. Only comes on creation and to the owner."
    },
    "status_url": {
      "type": "string",
      "description": "Status of this monitor with the token already in the query."
    },
    "events_url": {
      "type": "string",
      "description": "Latest pings with the token already in the query."
    },
    "curl_example": {
      "type": "string",
      "description": "The ingest `curl`, ready to paste in the cron."
    },
    "templates": {
      "allOf": [
        {
          "$ref": "#/$defs/Templates"
        }
      ],
      "description": "Ingest snippets and the alert body, with this monitor already in them."
    }
  },
  "required": [
    "id",
    "name",
    "interval_sec",
    "alert_to",
    "alert_url",
    "last_event_at",
    "last_status",
    "last_latency_ms",
    "miss_count",
    "alerted_at",
    "active",
    "healthy",
    "overdue",
    "waiting_first_ping",
    "created_at",
    "ingest_url"
  ],
  "$defs": {
    "Templates": {
      "type": "object",
      "properties": {
        "ingest_curl": {
          "type": "string",
          "description": "A `curl` that works as proof of life."
        },
        "ingest_cron": {
          "type": "string",
          "description": "The equivalent crontab line."
        },
        "ingest_n8n": {
          "type": "string",
          "description": "How to call the ingest from n8n."
        },
        "miss_json": {
          "type": "string",
          "description": "The exact JSON we POST to `alert_url` when the silence becomes a miss."
        },
        "miss_url_hint": {
          "type": "string",
          "description": "What works as `alert_url` — public HTTPS only."
        }
      },
      "required": [
        "ingest_curl",
        "ingest_cron",
        "ingest_n8n",
        "miss_json",
        "miss_url_hint"
      ],
      "description": "How to ping and what we send when it fails. It is what saves guessing the format."
    }
  }
}