{
  "openapi": "3.0.3",
  "info": {
    "title": "Uptriva API",
    "version": "1.0.0",
    "description": "REST API for Uptriva monitoring: monitors, status pages, incidents, maintenance, agents, webhooks and push metrics. Authenticate with a personal API token (`Bearer sk_shx_...`).\n\nDocs: https://shxrk.systems/docs",
    "contact": {
      "url": "https://shxrk.systems"
    }
  },
  "servers": [
    {
      "url": "https://api.shxrk.systems/api/v1/uptime",
      "description": "Uptime API"
    },
    {
      "url": "https://api.shxrk.systems/api/v2/uptime",
      "description": "Uptime API v2 (legacy aliases)"
    },
    {
      "url": "https://api.shxrk.systems/api/v1",
      "description": "Core API"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "sk_shx_...",
        "description": "Personal API token from the dashboard (Security → API Tokens)"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      },
      "Monitor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/MonitorType"
          },
          "target": {
            "type": "string"
          },
          "interval": {
            "type": "integer",
            "description": "Seconds between checks"
          },
          "status": {
            "type": "string",
            "enum": [
              "up",
              "down",
              "degraded",
              "paused",
              "pending",
              "unknown"
            ]
          },
          "status_page_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "group_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "agent_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "When set, the check is executed by your own agent (private pinger) instead of the public pinger network — required for internal/private targets."
          },
          "is_internal": {
            "type": "boolean",
            "description": "True when the target is a private/internal address executed via agent_id"
          },
          "parent_monitor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Set when this monitor is a member of a composite monitor — it is hidden from the public status page and only the composite is shown"
          },
          "failure_threshold": {
            "type": "integer"
          },
          "recovery_threshold": {
            "type": "integer"
          },
          "regions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "last_check": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "MonitorType": {
        "type": "string",
        "enum": [
          "http",
          "https",
          "icmp",
          "ping",
          "tcp",
          "udp",
          "dns",
          "smtp",
          "pop3",
          "imap",
          "telnet",
          "postgres",
          "mysql",
          "redis",
          "ssl",
          "domain",
          "agent",
          "heartbeat",
          "api",
          "game_server",
          "composite"
        ]
      },
      "MonitorCreate": {
        "type": "object",
        "required": [
          "name",
          "type"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/MonitorType"
          },
          "target": {
            "type": "string"
          },
          "status_page_id": {
            "type": "string",
            "format": "uuid"
          },
          "group_id": {
            "type": "string",
            "format": "uuid"
          },
          "agent_id": {
            "type": "string",
            "format": "uuid",
            "description": "Assign the check to one of your agents — it then runs as a private pinger inside your network (required for private/internal targets)."
          },
          "interval": {
            "type": "integer"
          },
          "http_method": {
            "type": "string",
            "enum": [
              "GET",
              "POST",
              "PUT",
              "DELETE",
              "PATCH",
              "HEAD",
              "OPTIONS"
            ]
          },
          "http_headers": {
            "type": "string"
          },
          "http_body": {
            "type": "string"
          },
          "expected_status": {
            "type": "integer"
          },
          "expected_body": {
            "type": "string"
          },
          "expected_body_match_type": {
            "type": "string",
            "enum": [
              "contains",
              "exact",
              "regex",
              "not_contains"
            ]
          },
          "expected_keywords": {
            "type": "string"
          },
          "latency_threshold_ms": {
            "type": "integer"
          },
          "follow_redirects": {
            "type": "boolean"
          },
          "verify_ssl": {
            "type": "boolean"
          },
          "failure_threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "recovery_threshold": {
            "type": "integer",
            "minimum": 1,
            "maximum": 20
          },
          "degraded_timeout_seconds": {
            "type": "integer"
          },
          "expected_interval": {
            "type": "integer",
            "description": "Heartbeat interval (seconds)"
          },
          "auto_create_incident": {
            "type": "boolean"
          },
          "auto_publish_incident": {
            "type": "boolean"
          },
          "incident_severity": {
            "type": "string",
            "enum": [
              "minor",
              "major",
              "critical"
            ]
          },
          "game_type": {
            "type": "string",
            "enum": [
              "fivem",
              "minecraft",
              "rust",
              "cs2",
              "ark",
              "valheim",
              "custom"
            ]
          },
          "query_method": {
            "type": "string",
            "enum": [
              "query",
              "rest_api",
              "push",
              "tcp_connect"
            ]
          },
          "query_port": {
            "type": "integer"
          },
          "regions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "child_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 50,
            "description": "For type=composite: member monitors to aggregate. Members must belong to the same status page, cannot be composites themselves, and are hidden from the public status page — the composite renders as one entry (down if any member is down, degraded if any is degraded)."
          }
        }
      },
      "StatusPage": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "custom_domain": {
            "type": "string",
            "nullable": true
          },
          "is_public": {
            "type": "boolean"
          },
          "show_branding": {
            "type": "boolean"
          },
          "timezone": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "StatusPageCreate": {
        "type": "object",
        "required": [
          "name",
          "slug"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "custom_domain": {
            "type": "string"
          },
          "monitors": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "logo_url": {
            "type": "string"
          },
          "brand_color": {
            "type": "string"
          },
          "is_public": {
            "type": "boolean"
          },
          "incident_system_enabled": {
            "type": "boolean"
          },
          "show_branding": {
            "type": "boolean"
          },
          "footer_text": {
            "type": "string"
          },
          "footer_links": {
            "type": "string"
          },
          "ssl_type": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "auto_create_incident": {
            "type": "boolean"
          },
          "auto_publish_incident": {
            "type": "boolean"
          },
          "failure_threshold": {
            "type": "integer"
          }
        }
      },
      "Incident": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status_page_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "minor",
              "major",
              "critical"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring",
              "resolved"
            ]
          },
          "is_public": {
            "type": "boolean"
          },
          "started_at": {
            "type": "string",
            "format": "date-time"
          },
          "resolved_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "IncidentCreate": {
        "type": "object",
        "required": [
          "status_page_id",
          "title"
        ],
        "properties": {
          "status_page_id": {
            "type": "string",
            "format": "uuid"
          },
          "monitor_id": {
            "type": "string",
            "format": "uuid"
          },
          "monitor_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "group_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "impact": {
            "type": "string"
          },
          "severity": {
            "type": "string",
            "enum": [
              "minor",
              "major",
              "critical"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring",
              "resolved"
            ]
          },
          "is_public": {
            "type": "boolean"
          },
          "assigned_to_id": {
            "type": "string"
          },
          "tags": {
            "type": "string"
          }
        }
      },
      "MaintenanceWindow": {
        "type": "object",
        "required": [
          "status_page_id",
          "title",
          "start_time",
          "end_time"
        ],
        "properties": {
          "status_page_id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "start_time": {
            "type": "string",
            "format": "date-time"
          },
          "end_time": {
            "type": "string",
            "format": "date-time"
          },
          "is_public": {
            "type": "boolean"
          },
          "targets": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "target_type": {
                  "type": "string",
                  "enum": [
                    "monitor",
                    "group"
                  ]
                },
                "target_id": {
                  "type": "string",
                  "format": "uuid"
                }
              }
            }
          },
          "recurrence_type": {
            "type": "string",
            "enum": [
              "none",
              "daily",
              "weekly",
              "monthly"
            ]
          },
          "recurrence_interval": {
            "type": "integer"
          },
          "recurrence_end_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "recurrence_day_of_week": {
            "type": "integer",
            "nullable": true
          },
          "recurrence_day_of_month": {
            "type": "integer",
            "nullable": true
          }
        }
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "provider": {
            "type": "string",
            "enum": [
              "generic",
              "discord",
              "slack",
              "telegram",
              "telegram_bot"
            ],
            "description": "telegram_bot = managed Uptriva bot connected via /telegram/link; telegram = your own bot token"
          },
          "events": {
            "type": "string",
            "description": "JSON array of event names; empty = all. Known events: monitor.down, monitor.degraded, monitor.up, incident.created, incident.resolved, maintenance.started, maintenance.ended, test_event"
          },
          "status_page_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "is_active": {
            "type": "boolean"
          },
          "is_team_only": {
            "type": "boolean"
          }
        }
      },
      "Agent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "hostname": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "online",
              "offline"
            ]
          },
          "region": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "status_page_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          }
        }
      },
      "APIMetricPush": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "status_code": {
            "type": "integer"
          },
          "latency_ms": {
            "type": "integer"
          },
          "is_error": {
            "type": "boolean"
          },
          "metrics": {
            "type": "object",
            "description": "Arbitrary custom metrics"
          }
        }
      },
      "GameServerMetricPush": {
        "type": "object",
        "properties": {
          "player_count": {
            "type": "integer"
          },
          "max_players": {
            "type": "integer"
          },
          "fps": {
            "type": "number"
          },
          "map_name": {
            "type": "string"
          },
          "server_name": {
            "type": "string"
          },
          "resources": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "state": {
                  "type": "string"
                }
              }
            }
          },
          "custom_metrics": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing or invalid credentials",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Unauthorized"
            }
          }
        }
      },
      "RateLimited": {
        "description": "Rate limit exceeded",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        },
        "headers": {
          "Retry-After": {
            "schema": {
              "type": "integer"
            }
          }
        }
      }
    }
  },
  "paths": {
    "/monitors": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "List monitors",
        "parameters": [
          {
            "name": "status_page_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Monitor"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      },
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Create a monitor",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MonitorCreate"
              },
              "example": {
                "name": "API Gateway",
                "type": "http",
                "target": "https://api.example.com/health",
                "status_page_id": "3f8a1b2c-0000-4000-8000-000000000000",
                "interval": 60,
                "http_method": "GET",
                "expected_status": 200,
                "failure_threshold": 3,
                "recovery_threshold": 2,
                "latency_threshold_ms": 2000,
                "auto_create_incident": true,
                "regions": [
                  "eu-central"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created monitor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Monitor"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "Plan limit or monitor type not available in tier"
          }
        }
      }
    },
    "/monitors/{id}": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Monitor detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Monitor"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        }
      },
      "put": {
        "tags": [
          "Monitors"
        ],
        "summary": "Update a monitor",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MonitorCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated monitor",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Monitor"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Monitors"
        ],
        "summary": "Delete a monitor",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/monitors/{id}/latency-baseline": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Learned latency baseline",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Baseline latency statistics"
          }
        }
      }
    },
    "/status-pages": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "List your status pages",
        "responses": {
          "200": {
            "description": "Status pages",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/StatusPage"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Create a status page",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusPageCreate"
              },
              "example": {
                "name": "Acme Status",
                "slug": "acme",
                "description": "Service status for Acme",
                "is_public": true,
                "show_branding": true,
                "timezone": "Europe/Berlin"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created status page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusPage"
                }
              }
            }
          }
        }
      }
    },
    "/status-pages/check-slug": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Check slug availability",
        "parameters": [
          {
            "name": "slug",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Availability",
            "content": {
              "application/json": {
                "example": {
                  "available": true
                }
              }
            }
          }
        }
      }
    },
    "/status-pages/member-of": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Pages you are a member of",
        "responses": {
          "200": {
            "description": "Member status pages"
          }
        }
      }
    },
    "/status-pages/{id}": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Status page detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusPage"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Update a status page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusPageCreate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Delete a status page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/status-pages/{id}/ssl": {
      "put": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Custom-domain SSL configuration",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      }
    },
    "/status-pages/{id}/legal": {
      "put": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Imprint / privacy links",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      }
    },
    "/status-pages/{id}/alerting": {
      "patch": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Update alerting style and per-event routing",
        "description": "alert_routing maps built-in event names (incident.created, incident.updated, incident.resolved, monitor.down, monitor.degraded, monitor.up, maintenance.started, maintenance.completed) to a classification override: public, team_only, or critical. Omit an event to use the default behavior.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "incident_system_enabled": true,
                "auto_create_incident": true,
                "auto_publish_incident": true,
                "advanced_alerts": false,
                "alert_routing": {
                  "monitor.degraded": "team_only",
                  "monitor.up": "team_only"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated alerting settings"
          },
          "403": {
            "description": "Needs status page manage access"
          }
        }
      }
    },
    "/status-pages/{id}/members": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "List members",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Members"
          }
        }
      },
      "post": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Invite a member",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "email": "ops@acme.com",
                "role": "editor",
                "name": "Ops User",
                "password": "temp-password",
                "confirmed": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Member invited"
          }
        }
      }
    },
    "/status-pages/{id}/members/{member_id}": {
      "put": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Change member role",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "member_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Remove member",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "member_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          }
        }
      }
    },
    "/status-pages/{id}/monitors": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Monitors on the page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor list"
          }
        }
      }
    },
    "/status-pages/{id}/monitors/migrate": {
      "post": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Move monitors to another status page. Composite parents bring children along; moving a child alone detaches it. Clears page-scoped refs (group, escalation policy) and drops monitor-scoped event rules/maintenance targets that don't apply on the target page.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "target_status_page_id": "<uuid>",
                "monitor_ids": [
                  "<uuid>",
                  "<uuid>"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Moved — returns moved count, detached children, removed rule/maintenance refs"
          },
          "403": {
            "description": "Needs admin access on both pages"
          }
        }
      }
    },
    "/status-pages/{id}/groups": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Groups on the page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Groups"
          }
        }
      }
    },
    "/status-pages/{id}/incidents": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Incidents on the page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Incidents"
          }
        }
      }
    },
    "/status-pages/{id}/incidents/stats": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Incident statistics",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Statistics"
          }
        }
      }
    },
    "/status-pages/{id}/maintenance": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Maintenance windows on the page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance windows"
          }
        }
      }
    },
    "/status-pages/{id}/seats": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Seat usage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Seat usage"
          }
        }
      }
    },
    "/status-pages/{id}/sla": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "SLA summary",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SLA summary"
          }
        }
      }
    },
    "/status-pages/{id}/sla-targets": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "SLA targets",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Targets"
          }
        }
      },
      "put": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Update SLA targets",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      }
    },
    "/status-pages/{id}/sla/export": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Export SLA report",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Report file"
          }
        }
      }
    },
    "/status-pages/{id}/on-call": {
      "get": {
        "tags": [
          "On-Call"
        ],
        "summary": "Active on-call policy",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Policy"
          }
        }
      },
      "put": {
        "tags": [
          "On-Call"
        ],
        "summary": "Set on-call policy",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "On-Call"
        ],
        "summary": "Remove on-call policy",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          }
        }
      }
    },
    "/status-pages/{id}/on-call/policies": {
      "get": {
        "tags": [
          "On-Call"
        ],
        "summary": "List policies",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Policies"
          }
        }
      },
      "post": {
        "tags": [
          "On-Call"
        ],
        "summary": "Create escalation policy",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "name": "Primary",
                "is_default": true,
                "steps": [
                  {
                    "level": 1,
                    "wait_minutes": 0,
                    "contacts": [
                      {
                        "type": "email",
                        "value": "oncall@acme.com",
                        "label": "On-call"
                      }
                    ]
                  },
                  {
                    "level": 2,
                    "wait_minutes": 10,
                    "contacts": [
                      {
                        "type": "phone",
                        "value": "+491701234567",
                        "label": "Escalation"
                      }
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/status-pages/{id}/on-call/schedules": {
      "get": {
        "tags": [
          "On-Call"
        ],
        "summary": "List rotation schedules",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedules"
          }
        }
      },
      "post": {
        "tags": [
          "On-Call"
        ],
        "summary": "Create rotation schedule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Weekly rotation",
                "timezone": "Europe/Berlin",
                "is_active": true,
                "shifts": [
                  {
                    "user_id": "<uuid>",
                    "start_at": "2025-01-06T08:00:00Z",
                    "end_at": "2025-01-13T08:00:00Z"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules": {
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "List event rules",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rules"
          }
        }
      },
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Create event rule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "event_name": "monitor.down",
                "display_name": "API down",
                "classification": "public",
                "cooldown_seconds": 300,
                "max_fires_per_hour": 10,
                "notify_in_maintenance": false,
                "conditions": "[{\"metric\":\"monitor.failure_count\",\"operator\":\">\",\"value\":3,\"window_minutes\":15}]",
                "actions": "[{\"type\":\"suppress_alerts_for\",\"duration_seconds\":600}]",
                "is_enabled": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules/{rule_id}": {
      "put": {
        "tags": [
          "Events"
        ],
        "summary": "Update an event rule (snapshots previous state to versions)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "classification": "critical",
                "cooldown_seconds": 600,
                "actions": "[{\"type\":\"trigger_runbook\",\"webhook_id\":\"<uuid>\"}]"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Events"
        ],
        "summary": "Delete an event rule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules/export": {
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "Export event rules (JSON or ?format=yaml)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "json",
                "yaml"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rule export file"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules/import": {
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Import event rules from an export file (JSON body or YAML)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "version": 1,
                "kind": "event_rules",
                "rules": [
                  {
                    "event_name": "monitor.down",
                    "classification": "critical",
                    "conditions": "[]",
                    "actions": "[]",
                    "cooldown_seconds": 300,
                    "is_enabled": true
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Imported — returns created rules + warnings"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules/{rule_id}/test": {
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Dry-run a rule — evaluates conditions + cooldown against supplied metrics without dispatching",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "monitor_id": "<uuid>",
                "metrics": {
                  "latency": 4200,
                  "monitor_name": "api-prod"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Evaluation result: would_fire, per-condition results, cooldown state, parsed actions"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules/{rule_id}/backtest": {
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Historical backtest — replays monitor_checks transitions for monitor.down/up/degraded rules over ?days= (max 30) and counts how often the rule would have fired (cooldown-aware)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 7,
              "maximum": 30
            }
          },
          {
            "name": "monitor_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "would_have_fired count + fire timestamps"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules/{rule_id}/versions": {
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "List rule versions (snapshot taken on every update, max 50)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Versions"
          }
        }
      }
    },
    "/status-pages/{id}/events/rules/{rule_id}/restore/{version}": {
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Restore a rule to a previous version (current state is snapshotted first)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "rule_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "version",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Restored rule"
          }
        }
      }
    },
    "/status-pages/{id}/events/log": {
      "get": {
        "tags": [
          "Events"
        ],
        "summary": "Custom event log",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Events"
          }
        }
      }
    },
    "/status-pages/{id}/events/emit": {
      "post": {
        "tags": [
          "Events"
        ],
        "summary": "Emit a custom event",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "event_name": "deploy.started",
                "classification": "public",
                "title": "Deploy v2.4.1",
                "description": "Rolling deploy started",
                "monitor_id": "<uuid>",
                "payload": "{\"version\":\"2.4.1\"}",
                "evaluate_rules": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Emitted"
          }
        }
      }
    },
    "/status-pages/{id}/incident-templates": {
      "get": {
        "tags": [
          "Incidents"
        ],
        "summary": "List incident templates",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Templates"
          }
        }
      },
      "post": {
        "tags": [
          "Incidents"
        ],
        "summary": "Create incident template",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "database-outage",
                "title": "Database connectivity issues",
                "severity": "major",
                "status": "investigating",
                "initial_update": "We are investigating elevated error rates.",
                "is_public": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/status-pages/{id}/alert-setup": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Status-page alert webhooks",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhooks"
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Add alert webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Ops channel",
                "url": "https://discord.com/api/webhooks/...",
                "provider": "discord",
                "events": "[\"monitor.down\",\"monitor.up\"]",
                "is_active": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/incidents": {
      "get": {
        "tags": [
          "Incidents"
        ],
        "summary": "List incidents",
        "responses": {
          "200": {
            "description": "Incidents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Incident"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Incidents"
        ],
        "summary": "Create an incident",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IncidentCreate"
              },
              "example": {
                "status_page_id": "<uuid>",
                "title": "Elevated API latency",
                "severity": "major",
                "status": "investigating",
                "is_public": true,
                "monitor_ids": [
                  "<uuid>"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/incidents/{id}": {
      "get": {
        "tags": [
          "Incidents"
        ],
        "summary": "Incident detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Incident",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Incident"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Incidents"
        ],
        "summary": "Update an incident",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Incidents"
        ],
        "summary": "Delete an incident",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/incidents/{id}/updates": {
      "post": {
        "tags": [
          "Incidents"
        ],
        "summary": "Add a timeline update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "status": "identified",
                "message": "Root cause identified: connection pool exhaustion."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Update added"
          }
        }
      }
    },
    "/incidents/{id}/publish": {
      "post": {
        "tags": [
          "Incidents"
        ],
        "summary": "Publish incident to the status page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Published"
          }
        }
      }
    },
    "/incidents/{id}/unpublish": {
      "post": {
        "tags": [
          "Incidents"
        ],
        "summary": "Hide incident from the status page",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Unpublished"
          }
        }
      }
    },
    "/maintenance": {
      "get": {
        "tags": [
          "Maintenance"
        ],
        "summary": "List maintenance windows",
        "responses": {
          "200": {
            "description": "Windows",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MaintenanceWindow"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Schedule maintenance",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MaintenanceWindow"
              },
              "example": {
                "status_page_id": "<uuid>",
                "title": "Database migration",
                "description": "Primary DB failover for schema migration",
                "start_time": "2025-02-01T02:00:00Z",
                "end_time": "2025-02-01T04:00:00Z",
                "is_public": true,
                "recurrence_type": "none",
                "targets": [
                  {
                    "target_type": "monitor",
                    "target_id": "<uuid>"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/maintenance/{id}": {
      "get": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Maintenance detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Window"
          }
        }
      },
      "put": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Update maintenance",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Delete maintenance",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/maintenance/{id}/updates": {
      "get": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Maintenance timeline",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updates"
          }
        }
      },
      "post": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Add maintenance update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "status": "in_progress",
                "message": "Migration running, ETA 30 minutes."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Added"
          }
        }
      }
    },
    "/groups": {
      "get": {
        "tags": [
          "Groups"
        ],
        "summary": "List monitor groups",
        "parameters": [
          {
            "name": "status_page_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Groups"
          }
        }
      },
      "post": {
        "tags": [
          "Groups"
        ],
        "summary": "Create a group",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "name": "Production APIs",
                "status_page_id": "<uuid>"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/groups/order": {
      "put": {
        "tags": [
          "Groups"
        ],
        "summary": "Reorder groups",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "status_page_id": "<uuid>",
                "groups": [
                  {
                    "id": "<uuid>",
                    "order": 0
                  },
                  {
                    "id": "<uuid>",
                    "order": 1
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reordered"
          }
        }
      }
    },
    "/groups/{id}": {
      "put": {
        "tags": [
          "Groups"
        ],
        "summary": "Rename a group",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Groups"
        ],
        "summary": "Delete a group",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/agents": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List agents",
        "responses": {
          "200": {
            "description": "Agents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Agent"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Create an agent",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "name": "db-primary",
                "hostname": "db-01.internal",
                "status_page_id": "<uuid>"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created (returns agent token once)"
          }
        }
      }
    },
    "/agents/token": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Generate an install token",
        "responses": {
          "200": {
            "description": "Install token"
          }
        }
      }
    },
    "/agents/enroll-tokens": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List enrollment tokens for a status page",
        "parameters": [
          {
            "name": "status_page_id",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Enrollment tokens (secrets never returned — token_prefix only)"
          }
        }
      },
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Create a reusable agent enrollment token for unattended installs (cloud-init, autoscaling). The plain `enroll_token` (senroll_...) is returned once — store it in your provisioning secrets. Each enrolling node self-registers an agent + agent monitor named from `monitor_name_pattern` ({hostname} placeholder) and optionally joins `composite_monitor_id`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "name": "K3s FSN workers",
                "status_page_id": "<uuid>",
                "composite_monitor_id": "<uuid>",
                "escalation_policy_id": "<uuid>",
                "monitor_name_pattern": "{hostname}",
                "incident_severity": "major",
                "auto_create_incident": true,
                "auto_publish_incident": false,
                "is_internal": true,
                "show_latency": false,
                "interval": 60,
                "failure_threshold": 1,
                "recovery_threshold": 2,
                "region": "fsn1",
                "max_agents": 0
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Created — returns token record + enroll_token + install_command",
            "content": {
              "application/json": {
                "example": {
                  "enroll_token": "senroll_sak_...",
                  "install_command": "curl -sL https://api.shxrk.systems/api/v1/uptime/agents/install | bash -s -- --enroll-token=senroll_sak_..."
                }
              }
            }
          }
        }
      }
    },
    "/agents/enroll-tokens/{id}": {
      "patch": {
        "tags": [
          "Agents"
        ],
        "summary": "Update an enrollment token (name, pattern, limits, enabled)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "K3s FSN workers",
                "monitor_name_pattern": "{hostname}",
                "max_agents": 20,
                "is_enabled": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Agents"
        ],
        "summary": "Revoke an enrollment token — already-enrolled agents keep working, new installs are rejected",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Revoked"
          }
        }
      }
    },
    "/agents/commands": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Poll pending remote commands (agent-side, X-Agent-Token auth). Queued by event-rule actions: restart_service, exec_script, collect_diagnostics.",
        "security": [],
        "responses": {
          "200": {
            "description": "Pending commands (marked delivered)",
            "content": {
              "application/json": {
                "example": {
                  "commands": [
                    {
                      "id": "<uuid>",
                      "command": "restart_service",
                      "params": "{\"service\":\"nginx\"}"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid agent token"
          }
        }
      }
    },
    "/agents/commands/{command_id}/ack": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Acknowledge a command result (agent-side, X-Agent-Token auth). Emits agent.command_completed / agent.command_failed events into the rule engine.",
        "security": [],
        "parameters": [
          {
            "name": "command_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "status": "completed",
                "result": "service nginx restarted"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acked"
          },
          "401": {
            "description": "Invalid agent token"
          }
        }
      }
    },
    "/agents/events": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Push discrete agent events (agent-side, X-Agent-Token auth, max 50 per batch). Stored in agent_events and routed into the rule engine as agent.<type> events. Server-side dedupes identical events for 5 minutes.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "events": [
                  {
                    "type": "process_exit",
                    "severity": "critical",
                    "message": "Watched process 'nginx' exited",
                    "metadata": {
                      "process": "nginx"
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted count",
            "content": {
              "application/json": {
                "example": {
                  "accepted": 1
                }
              }
            }
          },
          "401": {
            "description": "Invalid agent token"
          }
        }
      }
    },
    "/agents/{agent_id}/events": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "List discrete agent events (dashboard). Filters: type, severity (info/warning/critical), resolved (true/false), hours, limit, offset.",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "resolved",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "hours",
            "in": "query",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Event list"
          }
        }
      }
    },
    "/agent-events/{event_id}/acknowledge": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Acknowledge an agent event",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Acknowledged"
          }
        }
      }
    },
    "/agent-events/{event_id}/resolve": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Mark an agent event resolved",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved"
          }
        }
      }
    },
    "/agent-events/{event_id}/reopen": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Reopen a resolved agent event",
        "parameters": [
          {
            "name": "event_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reopened"
          }
        }
      }
    },
    "/agents/enroll": {
      "post": {
        "tags": [
          "Agents"
        ],
        "summary": "Enroll a node with an enrollment token — used by the install script. Idempotent per (token, hostname): re-running returns the existing agent's token.",
        "description": "Public endpoint — the enrollment token is the credential, no user token required.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "token": "senroll_sak_...",
                "hostname": "worker-app-fsn1-3"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent credentials + created monitor",
            "content": {
              "application/json": {
                "example": {
                  "agent_id": "<uuid>",
                  "agent_token": "sak_...",
                  "monitor_id": "<uuid>",
                  "reused": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or disabled enrollment token"
          },
          "429": {
            "description": "max_agents limit reached"
          }
        }
      }
    },
    "/agents/{agent_id}": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Agent detail",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Agent"
          }
        }
      },
      "put": {
        "tags": [
          "Agents"
        ],
        "summary": "Update agent",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Agents"
        ],
        "summary": "Delete agent",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/agents/{agent_id}/metrics": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Recent host metrics",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metrics"
          }
        }
      }
    },
    "/agents/{agent_id}/detail": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Extended agent detail (version, capabilities, last seen)",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Agent detail"
          }
        }
      }
    },
    "/agents/{agent_id}/monitors": {
      "get": {
        "tags": [
          "Agents"
        ],
        "summary": "Monitors executed by this agent (private pingers). Returns each assigned monitor with 30-day uptime_percent and avg_latency.",
        "parameters": [
          {
            "name": "agent_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Assigned monitors",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Monitor"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "uptime_percent": {
                            "type": "number"
                          },
                          "avg_latency": {
                            "type": "number"
                          }
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "responses": {
          "200": {
            "description": "Webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Webhook"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Webhook"
              },
              "example": {
                "name": "PagerDuty bridge",
                "url": "https://hooks.example.com/uptime",
                "provider": "generic",
                "events": "[\"monitor.down\",\"monitor.up\"]",
                "status_page_id": "<uuid>",
                "is_active": true
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/webhooks/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Webhook detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook"
          }
        }
      },
      "put": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Update webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete webhook",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/webhooks/{id}/test": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Send a test delivery",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Dispatched"
          }
        }
      }
    },
    "/webhooks/{id}/toggle": {
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Toggle active state",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Toggled"
          }
        }
      }
    },
    "/webhooks/{id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delivery history for a webhook (status, attempts, last response)",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Deliveries"
          }
        }
      }
    },
    "/webhooks/{id}/team-only": {
      "patch": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Restrict webhook to team-only (non-public) events",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "is_team_only": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      }
    },
    "/telegram/bot": {
      "get": {
        "tags": [
          "Telegram"
        ],
        "summary": "Managed Telegram bot availability + username",
        "responses": {
          "200": {
            "description": "Bot info",
            "content": {
              "application/json": {
                "example": {
                  "available": true,
                  "username": "ShxrkSystemsBot"
                }
              }
            }
          }
        }
      }
    },
    "/telegram/link": {
      "post": {
        "tags": [
          "Telegram"
        ],
        "summary": "Create a link code to connect a Telegram chat/group as an alert channel (provider telegram_bot)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "status_page_id": "<uuid>",
                "name": "Ops Telegram",
                "events": "[\"monitor.down\",\"monitor.degraded\",\"monitor.up\"]"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Link code + deep link",
            "content": {
              "application/json": {
                "example": {
                  "code": "a1b2c3d4e5f6a7b8",
                  "deep_link": "https://t.me/ShxrkSystemsBot?start=a1b2c3d4e5f6a7b8",
                  "expires_in": 900
                }
              }
            }
          },
          "503": {
            "description": "Telegram bot not configured"
          }
        }
      }
    },
    "/telegram/link/{code}": {
      "get": {
        "tags": [
          "Telegram"
        ],
        "summary": "Poll link-code status (pending | connected | expired). The user connects by sending /start <code> to the bot.",
        "parameters": [
          {
            "name": "code",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Link status",
            "content": {
              "application/json": {
                "example": {
                  "status": "connected",
                  "name": "Ops Telegram",
                  "chat_label": "Ops Team"
                }
              }
            }
          }
        }
      }
    },
    "/notify-contacts": {
      "get": {
        "tags": [
          "Notify Contacts"
        ],
        "summary": "List notify contacts",
        "responses": {
          "200": {
            "description": "Contacts"
          }
        }
      },
      "post": {
        "tags": [
          "Notify Contacts"
        ],
        "summary": "Create notify contact",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "example": {
                "name": "Night shift",
                "type": "email",
                "email": "night@acme.com"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created"
          }
        }
      }
    },
    "/notify-contacts/{id}": {
      "delete": {
        "tags": [
          "Notify Contacts"
        ],
        "summary": "Delete notify contact",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        }
      }
    },
    "/subscribers": {
      "get": {
        "tags": [
          "Notify Contacts"
        ],
        "summary": "Status-page subscribers",
        "responses": {
          "200": {
            "description": "Subscribers"
          }
        }
      }
    },
    "/audit-logs": {
      "get": {
        "tags": [
          "Audit"
        ],
        "summary": "Audit log",
        "parameters": [
          {
            "name": "monitor_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "status_page_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "event_type",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Log entries + total"
          }
        }
      }
    },
    "/tier-info": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Your plan tier and limits",
        "responses": {
          "200": {
            "description": "Tier info"
          }
        }
      }
    },
    "/overview": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Dashboard overview",
        "responses": {
          "200": {
            "description": "Overview"
          }
        }
      }
    },
    "/heartbeat/{monitor_id}": {
      "post": {
        "tags": [
          "Push"
        ],
        "summary": "Heartbeat push",
        "description": "Pings a heartbeat monitor. Auth via `Bearer <hb_ token>` or `?token=` — no user token.",
        "security": [],
        "parameters": [
          {
            "name": "monitor_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "token",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Heartbeat recorded"
          },
          "401": {
            "description": "Invalid heartbeat token"
          }
        }
      }
    },
    "/api-monitoring/push": {
      "post": {
        "tags": [
          "Push"
        ],
        "summary": "Push an API metric",
        "description": "Push-key auth (`Bearer <push_key>`) — the key is scoped to one API monitor.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/APIMetricPush"
              },
              "example": {
                "endpoint": "/api/checkout",
                "method": "POST",
                "status_code": 200,
                "latency_ms": 42,
                "is_error": false,
                "metrics": {
                  "queue_depth": 17
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Metric stored"
          },
          "401": {
            "description": "Invalid push key"
          }
        }
      }
    },
    "/api-monitoring/monitors/{id}": {
      "get": {
        "tags": [
          "API Monitoring"
        ],
        "summary": "API monitor detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Config + state"
          }
        }
      }
    },
    "/api-monitoring/monitors/{id}/config": {
      "put": {
        "tags": [
          "API Monitoring"
        ],
        "summary": "Update API monitor config",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Updated"
          }
        }
      }
    },
    "/api-monitoring/monitors/{id}/metrics": {
      "get": {
        "tags": [
          "API Monitoring"
        ],
        "summary": "Recent pushed metrics",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metrics"
          }
        }
      }
    },
    "/api-monitoring/monitors/{id}/regenerate-key": {
      "post": {
        "tags": [
          "API Monitoring"
        ],
        "summary": "Rotate the push key",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "New push key",
            "content": {
              "application/json": {
                "example": {
                  "push_key": "pk_..."
                }
              }
            }
          }
        }
      }
    },
    "/game-server/push": {
      "post": {
        "tags": [
          "Push"
        ],
        "summary": "Push a game server metric",
        "description": "Push-key auth (`Bearer <push_key>`) — the key is scoped to one game server monitor. All fields optional; a push resets the staleness timer.",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GameServerMetricPush"
              },
              "example": {
                "player_count": 42,
                "max_players": 64,
                "fps": 59.7,
                "map_name": "de_dust2",
                "server_name": "Uptriva #1",
                "resources": [
                  {
                    "name": "es_extended",
                    "state": "started"
                  }
                ],
                "custom_metrics": {
                  "queue": 12
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Metric stored"
          },
          "401": {
            "description": "Invalid push key"
          }
        }
      }
    },
    "/game-server/monitors": {
      "get": {
        "tags": [
          "Game Servers"
        ],
        "summary": "List game server monitors",
        "parameters": [
          {
            "name": "status_page_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Game server monitors"
          }
        }
      }
    },
    "/game-server/monitors/{id}": {
      "get": {
        "tags": [
          "Game Servers"
        ],
        "summary": "Game server monitor detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor detail with config"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/game-server/monitors/{id}/config": {
      "put": {
        "tags": [
          "Game Servers"
        ],
        "summary": "Update game server config",
        "description": "Update `game_type`, `query_method`, `query_port`, `expected_interval` and `widgets`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Config updated"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/game-server/monitors/{id}/metrics": {
      "get": {
        "tags": [
          "Game Servers"
        ],
        "summary": "Recent game server metrics",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "hours",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 24
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Metrics"
          }
        }
      }
    },
    "/game-server/monitors/{id}/regenerate-key": {
      "post": {
        "tags": [
          "Game Servers"
        ],
        "summary": "Rotate the push key",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "New push key",
            "content": {
              "application/json": {
                "example": {
                  "push_key": "pk_..."
                }
              }
            }
          }
        }
      }
    },
    "/game-server/monitors/{id}/plugin": {
      "get": {
        "tags": [
          "Game Servers"
        ],
        "summary": "Download the server plugin",
        "description": "Returns a ready-made push integration for the monitor's game type (e.g. a FiveM resource or Minecraft plugin) as a zip.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Plugin zip"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/user/api-tokens": {
      "servers": [
        {
          "url": "https://api.shxrk.systems/api/v1"
        }
      ],
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "List API tokens",
        "responses": {
          "200": {
            "description": "Tokens (hashed, no secrets)"
          }
        }
      },
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Create an API token",
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "ci-pipeline",
                "expires_in_days": 90
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created — plaintext token returned once"
          }
        }
      }
    },
    "/user/api-tokens/{id}": {
      "servers": [
        {
          "url": "https://api.shxrk.systems/api/v1"
        }
      ],
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Revoke an API token",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Monitors"
    },
    {
      "name": "Status Pages"
    },
    {
      "name": "Incidents"
    },
    {
      "name": "Maintenance"
    },
    {
      "name": "Groups"
    },
    {
      "name": "Agents"
    },
    {
      "name": "Webhooks"
    },
    {
      "name": "Telegram"
    },
    {
      "name": "Events"
    },
    {
      "name": "On-Call"
    },
    {
      "name": "Notify Contacts"
    },
    {
      "name": "Audit"
    },
    {
      "name": "API Monitoring"
    },
    {
      "name": "Push"
    },
    {
      "name": "Account"
    },
    {
      "name": "Game Servers",
      "description": "Player counts, maps and push metrics for game servers."
    }
  ]
}