{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getuptimely-com/json-schema/getuptimely-com-monitor-status-history-schema.json",
  "title": "MonitorStatusHistory",
  "description": "A monitor's status timeline over a look-back window.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getuptimely-com-openapi.json#/components/schemas/MonitorStatusHistory",
  "type": "object",
  "properties": {
    "monitor": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "monitor_type": {
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "monitor_type"
      ],
      "additionalProperties": false,
      "description": "The monitor the history belongs to."
    },
    "window_days": {
      "type": "integer",
      "minimum": -9007199254740991,
      "maximum": 9007199254740991,
      "description": "The look-back window actually applied (1-90)."
    },
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/$defs/MonitorStatusRef"
          },
          "starts_at": {
            "type": "string",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
            "format": "date-time",
            "description": "When the monitor entered this status."
          },
          "ends_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the status ended; null while it is still current."
          },
          "root_cause": {
            "description": "Recorded cause of the transition, when available.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "status",
          "starts_at",
          "ends_at",
          "root_cause"
        ],
        "additionalProperties": false
      },
      "description": "Status segments, newest first."
    }
  },
  "required": [
    "monitor",
    "window_days",
    "data"
  ],
  "additionalProperties": false,
  "$defs": {
    "MonitorStatusRef": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string",
          "description": "Current status name, e.g. \"Operational\" or \"Offline\"."
        },
        "color": {
          "description": "Display color of the status (hex), when configured.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "name",
        "color"
      ],
      "additionalProperties": false,
      "description": "The monitor's current status."
    }
  }
}