{
  "openapi": "3.1.0",
  "info": {
    "title": "Visual Sentinel API",
    "description": "Comprehensive website monitoring API with 6-layer monitoring: Uptime, Performance, SSL, DNS, Visual regression detection, and Content change detection.\n\n## Authentication\n\nEvery endpoint below accepts two authentication methods interchangeably (unified auth, as of 2.25.0):\n\n### 1. Session Cookie (Web Clients)\nCall `POST /api/auth/login` with email + password to get a session cookie. The cookie is automatically sent with subsequent requests. Session writes are CSRF-protected (send `X-CSRF-Token` on POST/PUT/PATCH/DELETE).\n\n### 2. Bearer API Key (Agents, Integrations, Mobile Apps, Scripts)\nGenerate an API key in **Settings > API Keys**. Send it via any of:\n- `Authorization: Bearer vs_xxxxx` header (recommended)\n- `X-API-Key: vs_xxxxx` header\n- `?api_key=vs_xxxxx` query parameter\n\nAPI keys enforce scopes automatically:\n- GET requests require `{resource}:read` scope\n- POST/PUT/PATCH/DELETE require `{resource}:write` scope\n- Wildcard (`*`) grants full access\n- Platform-admin endpoints under `/api/admin/*` are blocked for API keys regardless of scope\n- CSRF is skipped for Bearer-auth'd requests (mobile-friendly)\n\nResources: `monitors`, `servers`, `channels`, `alerts`, `incidents`, `status-pages`, `teams`, `organization`, `maintenance`, `analytics`, `billing`, `user`\n\n### Session-only endpoints (cookie required)\nThe following endpoints stay session-only by design and cannot be called with an API key:\n- `/api/auth/*` (login, logout, refresh, 2FA, password reset, OAuth)\n- `/api/billing/checkout` (dual-path: authed upgrade OR anonymous signup)\n- `/api/integrations/slack/auth` (OAuth init redirect)\n- `/api/organization/invitations/accept` (email-link flow)\n- `/api/user/delete-account` (destructive, blast-radius guardrail)\n- `/api/user/organizations/switch` (mutates session cookie)\n- `/api/chat/*`, `/api/ai/*`, `/api/incidents/:id/summarize`, `/api/reports/digest` (AI-powered features, not exposed via API keys due to token costs and abuse potential)\n\n**Note:** API access requires the Business plan or higher.\n\n## Mobile apps (iOS, Android, Mac)\n\nNative apps can use the same login flow: `POST /api/auth/login` returns a JWT. Send it as `Authorization: Bearer <jwt>` on every subsequent request. CSRF is automatically skipped for Bearer tokens. Token refresh is via `POST /api/auth/refresh` with the refresh token in the request body (or `X-Client-Type: mobile` header).\n\n## Rate Limits\n\n- Login: 5 attempts per 15 minutes\n- Registration: 3 per hour\n- Monitor creation: 20 per hour\n- Alert rules: 10 per hour\n- Bulk operations: 10 per minute\n- Tools (public): 10 per minute per IP\n- API key requests: per-key rate limit (default 1000/hour, configurable at key creation)\n\n## Base URL\n\nProduction: `https://visualsentinel.com`",
    "version": "2.46.0",
    "contact": {
      "name": "Visual Sentinel Support",
      "url": "https://visualsentinel.com/contact",
      "email": "support@visualsentinel.com"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://visualsentinel.com/terms"
    }
  },
  "servers": [
    {
      "url": "https://visualsentinel.com",
      "description": "Production server"
    }
  ],
  "tags": [
    {
      "name": "System",
      "description": "Health checks, metrics, and system status"
    },
    {
      "name": "Authentication",
      "description": "User authentication, sessions, OAuth, and 2FA"
    },
    {
      "name": "Monitors",
      "description": "Website and endpoint monitoring CRUD and operations"
    },
    {
      "name": "Visual Monitoring",
      "description": "Screenshot-based visual regression detection"
    },
    {
      "name": "Servers",
      "description": "Server infrastructure monitoring via agent"
    },
    {
      "name": "Server Alerts",
      "description": "Server alert history and configuration"
    },
    {
      "name": "Notification Channels",
      "description": "Manage notification destinations (email, Slack, Discord, etc.)"
    },
    {
      "name": "Alerts",
      "description": "Alert management, acknowledgment, and resolution"
    },
    {
      "name": "Alert Rules",
      "description": "Configure alerting conditions and thresholds"
    },
    {
      "name": "Alert Groups",
      "description": "Grouped alert management"
    },
    {
      "name": "Incidents",
      "description": "Incident tracking and management"
    },
    {
      "name": "Status Pages",
      "description": "Public status page management"
    },
    {
      "name": "Teams",
      "description": "Team management and member assignment"
    },
    {
      "name": "Organization",
      "description": "Organization settings, members, invitations, and branding"
    },
    {
      "name": "Maintenance",
      "description": "Scheduled maintenance windows"
    },
    {
      "name": "Billing",
      "description": "Subscription management and checkout"
    },
    {
      "name": "Integrations",
      "description": "Third-party integrations (Slack, Discord, PagerDuty, webhooks, Google)"
    },
    {
      "name": "Tools",
      "description": "Free public website checking tools"
    },
    {
      "name": "Reports",
      "description": "Report generation and digest emails"
    },
    {
      "name": "Analytics",
      "description": "Analytics, journeys, and subscription events"
    },
    {
      "name": "Notifications",
      "description": "In-app notification management"
    },
    {
      "name": "User",
      "description": "User profile and preferences"
    },
    {
      "name": "Chat",
      "description": "AI chat support system"
    },
    {
      "name": "Onboarding",
      "description": "User onboarding flow"
    },
    {
      "name": "Settings",
      "description": "Application settings (deduplication, reports)"
    },
    {
      "name": "Public",
      "description": "Unauthenticated public endpoints (blog, status pages, stats)"
    },
    {
      "name": "Webhooks",
      "description": "Incoming webhook handlers (Paddle, WhatsApp)"
    },
    {
      "name": "API Keys",
      "description": "API key management"
    }
  ],
  "paths": {
    "/api/health": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Health check",
        "description": "Returns system health status including database, Redis, and worker connectivity.",
        "operationId": "getHealth",
        "security": [],
        "responses": {
          "200": {
            "description": "System healthy",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/metrics": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Prometheus metrics",
        "description": "Get metrics in Prometheus format for external monitoring systems.",
        "operationId": "getMetrics",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Prometheus metrics",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          }
        }
      }
    },
    "/api/plan": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Get current plan details",
        "description": "Returns the current organization's plan, limits, and usage.",
        "operationId": "getPlan",
        "responses": {
          "200": {
            "description": "Plan details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "plan": {
                      "type": "string"
                    },
                    "limits": {
                      "type": "object"
                    },
                    "usage": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/dns": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "DNS lookup",
        "description": "Perform a DNS lookup for a given domain.",
        "operationId": "dnsLookup",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "DNS records"
          }
        }
      }
    },
    "/api/auth/login": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Login",
        "description": "Authenticate with email and password. Returns user data and sets session cookie.",
        "operationId": "login",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Login successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            }
          },
          "401": {
            "description": "Invalid credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too many login attempts"
          }
        }
      }
    },
    "/api/auth/register": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Register new account",
        "description": "Create a new user account and organization.",
        "operationId": "register",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Account created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error"
          },
          "409": {
            "description": "Email already exists"
          }
        }
      }
    },
    "/api/auth/logout": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Logout",
        "description": "End current session and clear cookies.",
        "operationId": "logout",
        "responses": {
          "200": {
            "description": "Logged out successfully"
          }
        }
      }
    },
    "/api/auth/me": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Get current user",
        "description": "Returns the currently authenticated user's profile, organization, and permissions.",
        "operationId": "getCurrentUser",
        "responses": {
          "200": {
            "description": "User profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated"
          }
        }
      }
    },
    "/api/auth/csrf": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Get CSRF token",
        "description": "Get a CSRF token for subsequent write operations. Required for session-based auth.",
        "operationId": "getCsrfToken",
        "responses": {
          "200": {
            "description": "CSRF token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "csrfToken": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/refresh": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Refresh session",
        "description": "Refresh the current session token to extend its lifetime.",
        "operationId": "refreshSession",
        "responses": {
          "200": {
            "description": "Session refreshed"
          },
          "401": {
            "description": "Session expired"
          }
        }
      }
    },
    "/api/auth/sessions": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "List active sessions",
        "description": "Get all active sessions for the current user.",
        "operationId": "listSessions",
        "responses": {
          "200": {
            "description": "Active sessions",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "sessions": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Authentication"
        ],
        "summary": "Revoke session",
        "description": "Revoke a specific session by ID.",
        "operationId": "revokeSession",
        "responses": {
          "200": {
            "description": "Session revoked"
          }
        }
      }
    },
    "/api/auth/2fa": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Enable 2FA",
        "description": "Generate a TOTP secret and QR code to enable two-factor authentication.",
        "operationId": "enable2FA",
        "responses": {
          "200": {
            "description": "2FA setup data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "secret": {
                      "type": "string"
                    },
                    "qrCode": {
                      "type": "string"
                    },
                    "backupCodes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Authentication"
        ],
        "summary": "Confirm 2FA setup",
        "description": "Confirm 2FA setup by providing a valid TOTP code.",
        "operationId": "confirm2FA",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 6,
                    "maxLength": 6
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "2FA enabled"
          }
        }
      },
      "delete": {
        "tags": [
          "Authentication"
        ],
        "summary": "Disable 2FA",
        "description": "Disable two-factor authentication for the current user.",
        "operationId": "disable2FA",
        "responses": {
          "200": {
            "description": "2FA disabled"
          }
        }
      }
    },
    "/api/auth/2fa/verify": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Verify 2FA code",
        "description": "Verify a TOTP code during login when 2FA is enabled.",
        "operationId": "verify2FA",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "code"
                ],
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "tempToken": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "2FA verified, session created"
          },
          "401": {
            "description": "Invalid code"
          }
        }
      }
    },
    "/api/auth/forgot-password": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Request password reset",
        "description": "Send a password reset email to the specified address.",
        "operationId": "forgotPassword",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Reset email sent (always returns 200 to prevent enumeration)"
          }
        }
      },
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Validate reset token",
        "description": "Check if a password reset token is still valid.",
        "operationId": "validateResetToken",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Token is valid"
          },
          "400": {
            "description": "Token expired or invalid"
          }
        }
      }
    },
    "/api/auth/reset-password": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Reset password",
        "description": "Set a new password using a valid reset token.",
        "operationId": "resetPassword",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token",
                  "password"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string",
                    "minLength": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Password reset successful"
          },
          "400": {
            "description": "Invalid or expired token"
          }
        }
      }
    },
    "/api/auth/update-password": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Update password",
        "description": "Change the current user's password (requires current password).",
        "operationId": "updatePassword",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "currentPassword",
                  "newPassword"
                ],
                "properties": {
                  "currentPassword": {
                    "type": "string"
                  },
                  "newPassword": {
                    "type": "string",
                    "minLength": 8
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Password updated"
          },
          "401": {
            "description": "Current password incorrect"
          }
        }
      }
    },
    "/api/auth/verify-email": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Verify email (via link)",
        "description": "Verify email address using the token from the verification email link.",
        "operationId": "verifyEmailGet",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Email verified"
          },
          "400": {
            "description": "Invalid or expired token"
          }
        }
      },
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Verify email (via code)",
        "description": "Verify email address using a verification code.",
        "operationId": "verifyEmailPost",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email verified"
          }
        }
      }
    },
    "/api/auth/resend-verification": {
      "post": {
        "tags": [
          "Authentication"
        ],
        "summary": "Resend verification email",
        "description": "Resend the email verification link.",
        "operationId": "resendVerification",
        "responses": {
          "200": {
            "description": "Verification email sent"
          }
        }
      }
    },
    "/api/auth/oauth/providers": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "List OAuth providers",
        "description": "Get available OAuth providers (Google, GitHub).",
        "operationId": "listOAuthProviders",
        "security": [],
        "responses": {
          "200": {
            "description": "Available providers",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "providers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/auth/oauth/google": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Initiate Google OAuth",
        "description": "Redirect to Google OAuth consent screen.",
        "operationId": "googleOAuth",
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect to Google"
          }
        }
      }
    },
    "/api/auth/oauth/google/callback": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Google OAuth callback",
        "description": "Handle the Google OAuth callback after user consent.",
        "operationId": "googleOAuthCallback",
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect to dashboard"
          }
        }
      }
    },
    "/api/auth/oauth/github": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "Initiate GitHub OAuth",
        "description": "Redirect to GitHub OAuth consent screen.",
        "operationId": "githubOAuth",
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect to GitHub"
          }
        }
      }
    },
    "/api/auth/oauth/github/callback": {
      "get": {
        "tags": [
          "Authentication"
        ],
        "summary": "GitHub OAuth callback",
        "description": "Handle the GitHub OAuth callback after user consent.",
        "operationId": "githubOAuthCallback",
        "security": [],
        "responses": {
          "302": {
            "description": "Redirect to dashboard"
          }
        }
      }
    },
    "/api/monitors": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "List monitors",
        "description": "Get all monitors for the current organization with pagination and filtering.",
        "operationId": "listMonitors",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "all",
                "operational",
                "degraded",
                "down",
                "pending",
                "changed",
                "paused"
              ]
            }
          },
          {
            "name": "scope",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "site",
                "api"
              ]
            },
            "description": "Product-level one-tap scope. api includes API and GraphQL; site includes every other monitor type."
          },
          {
            "name": "type",
            "in": "query",
            "schema": {
              "$ref": "#/components/schemas/MonitorType"
            }
          },
          {
            "name": "enabled",
            "in": "query",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "search",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Search by name or URL"
          },
          {
            "name": "tags",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated list of tags"
          },
          {
            "name": "sortBy",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "createdAt",
                "name",
                "status",
                "uptime"
              ],
              "default": "createdAt"
            }
          },
          {
            "name": "sortOrder",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "desc"
            }
          },
          {
            "name": "includeSummary",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "On page 1, include exact fleet-wide status/type counts and average uptime without loading every monitor row."
          }
        ],
        "responses": {
          "200": {
            "description": "List of monitors. By default (no `page` query parameter) the response is a bare array of Monitor objects for backward compatibility. When the request sends `Accept: application/json` AND includes a `page` query parameter, the response is the `data`-wrapped paginated envelope shown below.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Monitor"
                      }
                    },
                    {
                      "$ref": "#/components/schemas/MonitorListResponse"
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Create monitor",
        "description": "Create a new website or endpoint monitor.",
        "operationId": "createMonitor",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMonitorRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Monitor created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Monitor"
                }
              }
            }
          },
          "400": {
            "description": "Validation error"
          },
          "402": {
            "description": "Plan limit reached"
          }
        }
      },
      "delete": {
        "tags": [
          "Monitors"
        ],
        "summary": "Bulk delete monitors",
        "description": "Delete multiple monitors at once.",
        "operationId": "bulkDeleteMonitors",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "ids"
                ],
                "properties": {
                  "ids": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Monitors deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "deletedCount": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/monitors/{id}": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get monitor",
        "description": "Get detailed information about a specific monitor.",
        "operationId": "getMonitor",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Monitor"
                }
              }
            }
          },
          "404": {
            "description": "Monitor not found"
          }
        }
      },
      "put": {
        "tags": [
          "Monitors"
        ],
        "summary": "Update monitor",
        "description": "Update an existing monitor's configuration.",
        "operationId": "updateMonitor",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateMonitorRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Monitor updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Monitor"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Monitors"
        ],
        "summary": "Delete monitor",
        "description": "Delete a monitor. The monitor and its history can be restored for 24 hours via the restore endpoint; after that it is permanently removed.",
        "operationId": "deleteMonitor",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor deleted"
          }
        }
      }
    },
    "/api/monitors/{id}/check": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Trigger manual check",
        "description": "Manually trigger a monitor check and get immediate results.",
        "operationId": "triggerCheck",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Check result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckResult"
                }
              }
            }
          }
        }
      }
    },
    "/api/monitors/{id}/checks": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get check history",
        "description": "Get recent check results for a monitor with timing breakdown (DNS, connect, TLS, TTFB). Supports time range filtering and optional response body inclusion for API monitors.",
        "operationId": "getMonitorChecks",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 500
            },
            "description": "Number of checks to return"
          },
          {
            "name": "timeRange",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "6h",
                "24h",
                "7d",
                "30d"
              ],
              "default": "24h"
            },
            "description": "Time range to fetch checks for"
          },
          {
            "name": "includeBody",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Include response body (API monitors only, increases payload size)"
          }
        ],
        "responses": {
          "200": {
            "description": "Check history",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "checks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "SUCCESS",
                              "FAILURE",
                              "TIMEOUT",
                              "ERROR"
                            ]
                          },
                          "statusCode": {
                            "type": "integer",
                            "nullable": true
                          },
                          "responseTime": {
                            "type": "number",
                            "nullable": true,
                            "description": "Total response time in ms"
                          },
                          "location": {
                            "type": "string",
                            "nullable": true,
                            "description": "Checker source location for this result."
                          },
                          "error": {
                            "type": "string",
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "assertionResults": {
                            "nullable": true,
                            "description": "API assertion results if configured"
                          },
                          "responseBody": {
                            "type": "string",
                            "nullable": true,
                            "description": "Only included when includeBody=true"
                          },
                          "firstByteTime": {
                            "type": "number",
                            "nullable": true,
                            "description": "Time to first byte in ms"
                          },
                          "dnsTime": {
                            "type": "number",
                            "nullable": true,
                            "description": "DNS resolution time in ms"
                          },
                          "connectTime": {
                            "type": "number",
                            "nullable": true,
                            "description": "TCP connection time in ms"
                          },
                          "tlsTime": {
                            "type": "number",
                            "nullable": true,
                            "description": "TLS handshake time in ms"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Monitor not found"
          },
          "503": {
            "description": "Database unavailable"
          }
        }
      }
    },
    "/api/monitors/{id}/uptime": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get uptime statistics",
        "description": "Get uptime percentage and history for a monitor.",
        "operationId": "getUptime",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "24h",
                "7d",
                "30d",
                "90d"
              ],
              "default": "24h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Uptime statistics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UptimeResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/monitors/{id}/response-time": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get response time metrics",
        "description": "Get response time history and statistics.",
        "operationId": "getResponseTime",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "24h",
                "7d",
                "30d"
              ],
              "default": "24h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Response time metrics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseTimeResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/monitors/{id}/dns": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get DNS records",
        "description": "Get DNS record details for a monitor's domain.",
        "operationId": "getMonitorDns",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "DNS records for the monitor's domain"
          }
        }
      }
    },
    "/api/monitors/{id}/pagespeed": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get PageSpeed data",
        "description": "Get cached PageSpeed Insights data for a monitor.",
        "operationId": "getMonitorPagespeed",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PageSpeed results"
          }
        }
      },
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Trigger PageSpeed check",
        "description": "Trigger a fresh PageSpeed Insights analysis.",
        "operationId": "triggerMonitorPagespeed",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PageSpeed analysis triggered"
          }
        }
      }
    },
    "/api/monitors/{id}/snapshots": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get content snapshots",
        "description": "Get content change detection snapshots for a monitor.",
        "operationId": "getMonitorSnapshots",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Content snapshots"
          }
        }
      }
    },
    "/api/monitors/{id}/channels": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get monitor notification channels",
        "description": "Get notification channels assigned to a specific monitor.",
        "operationId": "getMonitorChannels",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Assigned notification channels"
          }
        }
      },
      "put": {
        "tags": [
          "Monitors"
        ],
        "summary": "Update monitor notification channels",
        "description": "Set which notification channels are assigned to a monitor.",
        "operationId": "updateMonitorChannels",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "channelIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Channels updated"
          }
        }
      }
    },
    "/api/monitors/{id}/anomalies": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get anomalies",
        "description": "Get detected anomalies for a monitor.",
        "operationId": "getMonitorAnomalies",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Anomaly data"
          }
        }
      },
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Create anomaly",
        "description": "Manually create an anomaly record for a monitor.",
        "operationId": "createMonitorAnomaly",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Anomaly created"
          }
        }
      },
      "patch": {
        "tags": [
          "Monitors"
        ],
        "summary": "Update anomaly",
        "description": "Update or acknowledge an anomaly.",
        "operationId": "updateMonitorAnomaly",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Anomaly updated"
          }
        }
      }
    },
    "/api/monitors/{id}/report": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get monitor report",
        "description": "Get a comprehensive report for a monitor.",
        "operationId": "getMonitorReport",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor report data"
          }
        }
      },
      "put": {
        "tags": [
          "Monitors"
        ],
        "summary": "Update monitor report settings",
        "description": "Update report generation settings for a monitor.",
        "operationId": "updateMonitorReport",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Report settings updated"
          }
        }
      },
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Generate monitor report",
        "description": "Trigger generation of a new report for a monitor.",
        "operationId": "generateMonitorReport",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Report generated"
          }
        }
      }
    },
    "/api/monitors/{id}/sub-pages": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "List sub-pages",
        "description": "Get all sub-pages configured for visual monitoring on this monitor.",
        "operationId": "listSubPages",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of sub-pages"
          }
        }
      },
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Add sub-page",
        "description": "Add a new sub-page for visual monitoring.",
        "operationId": "addSubPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "path"
                ],
                "properties": {
                  "path": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Sub-page added"
          }
        }
      },
      "put": {
        "tags": [
          "Monitors"
        ],
        "summary": "Update sub-page",
        "description": "Update a sub-page configuration.",
        "operationId": "updateSubPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sub-page updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Monitors"
        ],
        "summary": "Delete sub-page",
        "description": "Remove a sub-page from visual monitoring.",
        "operationId": "deleteSubPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sub-page deleted"
          }
        }
      }
    },
    "/api/monitors/{id}/sub-pages/{subPageId}/capture": {
      "post": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Capture sub-page screenshot",
        "description": "Capture a baseline screenshot for a sub-page.",
        "operationId": "captureSubPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subPageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Screenshot captured"
          }
        }
      }
    },
    "/api/monitors/{id}/sub-pages/{subPageId}/visual": {
      "get": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Get sub-page visual data",
        "description": "Get visual monitoring data for a specific sub-page.",
        "operationId": "getSubPageVisual",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "subPageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sub-page visual data"
          }
        }
      }
    },
    "/api/monitors/{id}/visual": {
      "get": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Get visual monitoring data",
        "description": "Get visual monitoring history and screenshots.",
        "operationId": "getVisualData",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Visual monitoring data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VisualDataResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/monitors/{id}/visual/capture": {
      "post": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Capture screenshot",
        "description": "Capture a new screenshot for visual comparison.",
        "operationId": "captureScreenshot",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Screenshot captured",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "screenshotUrl": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/monitors/{id}/visual/baseline": {
      "post": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Set visual baseline",
        "description": "Set the current screenshot as the baseline for visual comparisons.",
        "operationId": "setVisualBaseline",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Baseline set"
          }
        }
      }
    },
    "/api/monitors/{id}/visual/compare": {
      "post": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Compare visual snapshots",
        "description": "Compare two visual snapshots and return diff percentage.",
        "operationId": "compareVisual",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Comparison result with diff percentage"
          }
        }
      }
    },
    "/api/monitors/{id}/visual/delete": {
      "post": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Delete visual snapshots (POST)",
        "description": "Delete specific visual snapshots by IDs.",
        "operationId": "deleteVisualSnapshotsPost",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Snapshots deleted"
          }
        }
      },
      "delete": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Delete visual snapshots",
        "description": "Delete visual monitoring data.",
        "operationId": "deleteVisualSnapshots",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Snapshots deleted"
          }
        }
      },
      "get": {
        "tags": [
          "Visual Monitoring"
        ],
        "summary": "Get deletable snapshots",
        "description": "List visual snapshots that can be deleted.",
        "operationId": "getDeletableSnapshots",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of deletable snapshots"
          }
        }
      }
    },
    "/api/monitors/alert-settings": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get monitor alert settings",
        "description": "Get alert settings for all monitors in the organization.",
        "operationId": "getMonitorAlertSettings",
        "responses": {
          "200": {
            "description": "Monitor alert settings"
          }
        }
      }
    },
    "/api/monitors/bulk-alerts": {
      "put": {
        "tags": [
          "Monitors"
        ],
        "summary": "Bulk update monitor alerts",
        "description": "Update alert settings for multiple monitors at once.",
        "operationId": "bulkUpdateAlerts",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "monitorIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  },
                  "channelIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Alert settings updated"
          }
        }
      }
    },
    "/api/monitors/check": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Bulk check monitors",
        "description": "Trigger checks for multiple monitors.",
        "operationId": "bulkCheckMonitors",
        "responses": {
          "200": {
            "description": "Checks triggered"
          }
        }
      }
    },
    "/api/monitors/content": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Content change detection",
        "description": "Check content changes for a URL.",
        "operationId": "checkContent",
        "responses": {
          "200": {
            "description": "Content check result"
          }
        }
      }
    },
    "/api/monitors/export": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Export monitors",
        "description": "Export all monitors data as CSV or JSON.",
        "operationId": "exportMonitors",
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "json"
              ],
              "default": "csv"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Exported monitor data"
          }
        }
      }
    },
    "/api/monitors/test": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Test monitor URL",
        "description": "Test a URL before creating a monitor to verify it's reachable.",
        "operationId": "testMonitor",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string",
                    "format": "uri"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Test result"
          }
        }
      }
    },
    "/api/monitors/populate-favicons": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Populate favicons",
        "description": "Fetch and store favicons for all monitors that don't have one.",
        "operationId": "populateFavicons",
        "responses": {
          "200": {
            "description": "Favicons populated"
          }
        }
      }
    },
    "/api/monitor-check": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Worker monitor check",
        "description": "Internal endpoint used by the worker to report check results.",
        "operationId": "workerMonitorCheck",
        "responses": {
          "200": {
            "description": "Check recorded"
          }
        }
      },
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "Get monitor check queue status",
        "description": "Get the status of the monitor check queue.",
        "operationId": "getMonitorCheckQueue",
        "responses": {
          "200": {
            "description": "Queue status"
          }
        }
      }
    },
    "/api/servers": {
      "get": {
        "tags": [
          "Servers"
        ],
        "summary": "List servers",
        "description": "Get all servers for the organization.",
        "operationId": "listServers",
        "security": [
          {
            "SessionAuth": []
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List of servers",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated"
          },
          "403": {
            "description": "Server monitoring not available on current plan or missing servers:read scope"
          }
        }
      },
      "post": {
        "tags": [
          "Servers"
        ],
        "summary": "Create server",
        "description": "Register a new server for monitoring. Returns the server token for agent installation.",
        "operationId": "createServer",
        "security": [
          {
            "SessionAuth": []
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "hostname": {
                    "type": "string"
                  },
                  "ipAddress": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Server created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "server": {
                      "$ref": "#/components/schemas/Server"
                    },
                    "token": {
                      "type": "string",
                      "description": "Agent authentication token (shown only once)"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Server limit reached"
          }
        }
      }
    },
    "/api/servers/{id}": {
      "get": {
        "tags": [
          "Servers"
        ],
        "summary": "Get server details",
        "description": "Get detailed information about a specific server including recent metrics and top processes.",
        "operationId": "getServer",
        "security": [
          {
            "SessionAuth": []
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Server details",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "server": {
                      "$ref": "#/components/schemas/Server"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Server not found"
          }
        }
      },
      "patch": {
        "tags": [
          "Servers"
        ],
        "summary": "Update server",
        "description": "Update server name, tags, or alert configuration.",
        "operationId": "updateServer",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "tags": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "alertConfig": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Server updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Servers"
        ],
        "summary": "Delete server",
        "description": "Remove a server and all its monitoring data.",
        "operationId": "deleteServer",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Server deleted"
          }
        }
      }
    },
    "/api/servers/{id}/metrics": {
      "get": {
        "tags": [
          "Servers"
        ],
        "summary": "Get server metrics",
        "description": "Get historical server metrics (CPU, memory, disk, network) with configurable time periods.",
        "operationId": "getServerMetrics",
        "security": [
          {
            "SessionAuth": []
          },
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "period",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "1h",
                "6h",
                "24h",
                "7d",
                "30d"
              ],
              "default": "1h"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Server metrics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerMetricsResponse"
                }
              }
            }
          },
          "404": {
            "description": "Server not found"
          }
        }
      }
    },
    "/api/servers/{id}/alerts": {
      "get": {
        "tags": [
          "Server Alerts"
        ],
        "summary": "Get server alert history",
        "description": "Get historical alerts for a specific server (CPU, memory, disk threshold breaches, offline events).",
        "operationId": "getServerAlerts",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Server alert history",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerAlertListResponse"
                }
              }
            }
          },
          "404": {
            "description": "Server not found"
          }
        }
      }
    },
    "/api/servers/agent/install.sh": {
      "get": {
        "tags": [
          "Servers"
        ],
        "summary": "Get agent install script",
        "description": "Download the server monitoring agent installation shell script.",
        "operationId": "getAgentInstallScript",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Shell script",
            "content": {
              "text/x-shellscript": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/servers/agent/report": {
      "post": {
        "tags": [
          "Servers"
        ],
        "summary": "Agent metrics report",
        "description": "Endpoint for the server agent to submit metrics data. Authenticated via server token.",
        "operationId": "agentReport",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string"
                  },
                  "cpu": {
                    "type": "object"
                  },
                  "memory": {
                    "type": "object"
                  },
                  "disk": {
                    "type": "object"
                  },
                  "network": {
                    "type": "object"
                  },
                  "processes": {
                    "type": "array"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Metrics recorded"
          },
          "401": {
            "description": "Invalid server token"
          }
        }
      }
    },
    "/api/notification-channels": {
      "get": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "List notification channels",
        "description": "Get all notification channels for the organization.",
        "operationId": "listNotificationChannels",
        "responses": {
          "200": {
            "description": "List of notification channels",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "channels": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/NotificationChannel"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Create notification channel",
        "description": "Create a new notification channel (Email, Slack, Discord, Telegram, WhatsApp, PagerDuty, OpsGenie, Webhook, Teams, Prometheus, Push).",
        "operationId": "createNotificationChannel",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNotificationChannelRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Channel created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "channel": {
                      "$ref": "#/components/schemas/NotificationChannel"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/notification-channels/{id}": {
      "get": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Get notification channel",
        "description": "Get details of a specific notification channel.",
        "operationId": "getNotificationChannel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Channel details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationChannel"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Update notification channel",
        "description": "Update an existing notification channel.",
        "operationId": "updateNotificationChannel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateNotificationChannelRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Channel updated"
          }
        }
      },
      "patch": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Toggle notification channel",
        "description": "Enable or disable a notification channel.",
        "operationId": "toggleNotificationChannel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Channel toggled"
          }
        }
      },
      "delete": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Delete notification channel",
        "description": "Delete a notification channel.",
        "operationId": "deleteNotificationChannel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Channel deleted"
          }
        }
      }
    },
    "/api/notification-channels/{id}/test": {
      "post": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Test notification channel",
        "description": "Send a test notification to verify the channel is configured correctly.",
        "operationId": "testNotificationChannel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Test notification sent",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/push-subscriptions": {
      "get": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "List push subscriptions",
        "description": "List all browser push notification subscriptions for the current organization.",
        "operationId": "listPushSubscriptions",
        "responses": {
          "200": {
            "description": "Push subscriptions list",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "subscriptions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "channelId": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "channelName": {
                            "type": "string"
                          },
                          "endpoint": {
                            "type": "string",
                            "format": "uri"
                          },
                          "name": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "userId": {
                            "type": "string",
                            "format": "uuid"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Register push subscription",
        "description": "Register a browser push notification subscription. Creates a new PUSH notification channel and auto-assigns it to all existing monitors. Requires write access and a plan that supports push notifications.",
        "operationId": "createPushSubscription",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "subscription"
                ],
                "properties": {
                  "subscription": {
                    "type": "object",
                    "required": [
                      "endpoint",
                      "keys"
                    ],
                    "properties": {
                      "endpoint": {
                        "type": "string",
                        "format": "uri"
                      },
                      "keys": {
                        "type": "object",
                        "required": [
                          "p256dh",
                          "auth"
                        ],
                        "properties": {
                          "p256dh": {
                            "type": "string"
                          },
                          "auth": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  },
                  "name": {
                    "type": "string",
                    "maxLength": 100,
                    "description": "Optional friendly name for this browser"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Push subscription registered",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "channelId": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error"
          },
          "403": {
            "description": "Push notifications not available on current plan"
          }
        }
      },
      "delete": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Remove push subscription",
        "description": "Remove a browser push subscription by endpoint URL. If it is the last subscription in its channel, the entire channel is deleted.",
        "operationId": "deletePushSubscription",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "endpoint"
                ],
                "properties": {
                  "endpoint": {
                    "type": "string",
                    "format": "uri",
                    "description": "The push subscription endpoint URL to remove"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Push subscription removed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation error"
          },
          "404": {
            "description": "Subscription not found"
          }
        }
      }
    },
    "/api/notification-preferences": {
      "get": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Get notification preferences",
        "description": "Get the user's notification preferences (which event types trigger which channels).",
        "operationId": "getNotificationPreferences",
        "responses": {
          "200": {
            "description": "Notification preferences"
          }
        }
      },
      "put": {
        "tags": [
          "Notification Channels"
        ],
        "summary": "Update notification preferences",
        "description": "Update notification preferences for event types.",
        "operationId": "updateNotificationPreferences",
        "responses": {
          "200": {
            "description": "Preferences updated"
          }
        }
      }
    },
    "/api/alerts": {
      "get": {
        "tags": [
          "Alerts"
        ],
        "summary": "List alerts",
        "description": "Get all alerts with filtering and pagination.",
        "operationId": "listAlerts",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20,
              "maximum": 100
            }
          },
          {
            "name": "state",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "ACKNOWLEDGED",
                "RESOLVED"
              ]
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "INFO",
                "WARNING",
                "CRITICAL"
              ]
            }
          },
          {
            "name": "monitorId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of alerts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertListResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/alerts/{id}/acknowledge": {
      "post": {
        "tags": [
          "Alerts"
        ],
        "summary": "Acknowledge alert",
        "description": "Mark an alert as acknowledged.",
        "operationId": "acknowledgeAlert",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Alert acknowledged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            }
          }
        }
      }
    },
    "/api/alerts/{id}/resolve": {
      "post": {
        "tags": [
          "Alerts"
        ],
        "summary": "Resolve alert",
        "description": "Mark an alert as resolved.",
        "operationId": "resolveAlert",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "note": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Alert resolved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Alert"
                }
              }
            }
          }
        }
      }
    },
    "/api/alerts/pause-all": {
      "post": {
        "tags": [
          "Alerts"
        ],
        "summary": "Pause all alerts",
        "description": "Pause all alerting for the organization.",
        "operationId": "pauseAllAlerts",
        "responses": {
          "200": {
            "description": "All alerts paused"
          }
        }
      },
      "get": {
        "tags": [
          "Alerts"
        ],
        "summary": "Get alerts paused status",
        "description": "Check whether all alerts are currently paused.",
        "operationId": "getAlertsPausedStatus",
        "responses": {
          "200": {
            "description": "Paused status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "paused": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/alert-rules": {
      "get": {
        "tags": [
          "Alert Rules"
        ],
        "summary": "List alert rules",
        "description": "Get all alert rules for the organization.",
        "operationId": "listAlertRules",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of alert rules",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRuleListResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Alert Rules"
        ],
        "summary": "Create alert rule",
        "description": "Create a new alerting rule.",
        "operationId": "createAlertRule",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAlertRuleRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Alert rule created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRule"
                }
              }
            }
          }
        }
      }
    },
    "/api/alert-rules/{id}": {
      "get": {
        "tags": [
          "Alert Rules"
        ],
        "summary": "Get alert rule",
        "description": "Get details of a specific alert rule.",
        "operationId": "getAlertRule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert rule details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertRule"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Alert Rules"
        ],
        "summary": "Update alert rule",
        "description": "Update an existing alert rule.",
        "operationId": "updateAlertRule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAlertRuleRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Alert rule updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Alert Rules"
        ],
        "summary": "Delete alert rule",
        "description": "Delete an alert rule.",
        "operationId": "deleteAlertRule",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert rule deleted"
          }
        }
      }
    },
    "/api/alert-groups": {
      "get": {
        "tags": [
          "Alert Groups"
        ],
        "summary": "List alert groups",
        "description": "Get all alert groups for the organization.",
        "operationId": "listAlertGroups",
        "responses": {
          "200": {
            "description": "List of alert groups"
          }
        }
      }
    },
    "/api/alert-groups/{id}": {
      "get": {
        "tags": [
          "Alert Groups"
        ],
        "summary": "Get alert group",
        "description": "Get details of a specific alert group.",
        "operationId": "getAlertGroup",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert group details"
          }
        }
      }
    },
    "/api/alert-groups/{id}/alerts": {
      "get": {
        "tags": [
          "Alert Groups"
        ],
        "summary": "Get alerts in group",
        "description": "Get all alerts belonging to a specific alert group.",
        "operationId": "getAlertGroupAlerts",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alerts in the group"
          }
        }
      }
    },
    "/api/alert-groups/{id}/acknowledge": {
      "post": {
        "tags": [
          "Alert Groups"
        ],
        "summary": "Acknowledge alert group",
        "description": "Acknowledge all alerts in a group.",
        "operationId": "acknowledgeAlertGroup",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert group acknowledged"
          }
        }
      }
    },
    "/api/alert-groups/{id}/resolve": {
      "post": {
        "tags": [
          "Alert Groups"
        ],
        "summary": "Resolve alert group",
        "description": "Resolve all alerts in a group.",
        "operationId": "resolveAlertGroup",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Alert group resolved"
          }
        }
      }
    },
    "/api/alert-groups/{id}/summarize": {
      "post": {
        "tags": [
          "Alert Groups"
        ],
        "summary": "Summarize alert group",
        "description": "Generate an AI summary of the alert group.",
        "operationId": "summarizeAlertGroup",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AI-generated summary"
          }
        }
      }
    },
    "/api/incidents": {
      "get": {
        "tags": [
          "Incidents"
        ],
        "summary": "List incidents",
        "description": "Get all incidents for the organization with filtering.",
        "operationId": "listIncidents",
        "parameters": [
          {
            "name": "monitorId",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "severity",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "CRITICAL",
                "HIGH",
                "MEDIUM",
                "LOW"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "INVESTIGATING",
                "IDENTIFIED",
                "MONITORING",
                "RESOLVED",
                "POSTMORTEM",
                "active"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of incidents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "incidents": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Incident"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Incidents"
        ],
        "summary": "Create incident",
        "description": "Manually create a new incident.",
        "operationId": "createIncident",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "monitorId",
                  "title"
                ],
                "properties": {
                  "monitorId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "title": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "CRITICAL",
                      "HIGH",
                      "MEDIUM",
                      "LOW"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Incident created"
          }
        }
      }
    },
    "/api/incidents/{id}": {
      "get": {
        "tags": [
          "Incidents"
        ],
        "summary": "Get incident",
        "description": "Get details of a specific incident.",
        "operationId": "getIncident",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Incident details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Incident"
                }
              }
            }
          },
          "404": {
            "description": "Incident not found"
          }
        }
      },
      "put": {
        "tags": [
          "Incidents"
        ],
        "summary": "Update incident",
        "description": "Update an incident's status, severity, or add an update message.",
        "operationId": "updateIncident",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string",
                    "enum": [
                      "INVESTIGATING",
                      "IDENTIFIED",
                      "MONITORING",
                      "RESOLVED",
                      "POSTMORTEM"
                    ]
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "CRITICAL",
                      "HIGH",
                      "MEDIUM",
                      "LOW"
                    ]
                  },
                  "updateMessage": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Incident updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Incidents"
        ],
        "summary": "Delete incident",
        "description": "Delete an incident.",
        "operationId": "deleteIncident",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Incident deleted"
          }
        }
      }
    },
    "/api/incidents/{id}/summarize": {
      "post": {
        "tags": [
          "Incidents"
        ],
        "summary": "Generate incident summary",
        "description": "Generate an AI-powered summary and postmortem for an incident.",
        "operationId": "summarizeIncident",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AI-generated summary"
          }
        }
      },
      "get": {
        "tags": [
          "Incidents"
        ],
        "summary": "Get incident summary",
        "description": "Get the cached AI summary for an incident.",
        "operationId": "getIncidentSummary",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cached summary"
          }
        }
      }
    },
    "/api/status-pages": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "List status pages",
        "description": "Get all status pages for the organization.",
        "operationId": "listStatusPages",
        "responses": {
          "200": {
            "description": "List of status pages"
          }
        }
      },
      "post": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Create status page",
        "description": "Create a new public status page.",
        "operationId": "createStatusPage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "slug"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "customDomain": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Status page created"
          },
          "402": {
            "description": "Plan limit reached"
          }
        }
      }
    },
    "/api/status-pages/{id}": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Get status page",
        "description": "Get details of a specific status page.",
        "operationId": "getStatusPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status page details"
          }
        }
      },
      "patch": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Update status page",
        "description": "Update a status page's configuration.",
        "operationId": "updateStatusPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status page updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Delete status page",
        "description": "Delete a status page.",
        "operationId": "deleteStatusPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status page deleted"
          }
        }
      }
    },
    "/api/status-pages/{id}/monitors": {
      "get": {
        "tags": [
          "Status Pages"
        ],
        "summary": "List monitors on status page",
        "description": "Get all monitors assigned to a status page.",
        "operationId": "listStatusPageMonitors",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitors on the status page"
          }
        }
      },
      "post": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Add monitor to status page",
        "description": "Add a monitor to a status page.",
        "operationId": "addMonitorToStatusPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "monitorId"
                ],
                "properties": {
                  "monitorId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "displayName": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Monitor added to status page"
          }
        }
      }
    },
    "/api/status-pages/{id}/monitors/{monitorId}": {
      "delete": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Remove monitor from status page",
        "description": "Remove a monitor from a status page.",
        "operationId": "removeMonitorFromStatusPage",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "monitorId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor removed"
          }
        }
      }
    },
    "/api/status-pages/{id}/custom-domain": {
      "post": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Set custom domain",
        "description": "Configure a custom domain for a status page.",
        "operationId": "setCustomDomain",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "domain"
                ],
                "properties": {
                  "domain": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Custom domain configured"
          }
        }
      },
      "patch": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Verify custom domain",
        "description": "Verify DNS configuration for a custom domain.",
        "operationId": "verifyCustomDomain",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Domain verification result"
          }
        }
      },
      "delete": {
        "tags": [
          "Status Pages"
        ],
        "summary": "Remove custom domain",
        "description": "Remove the custom domain from a status page.",
        "operationId": "removeCustomDomain",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Custom domain removed"
          }
        }
      }
    },
    "/api/teams": {
      "get": {
        "tags": [
          "Teams"
        ],
        "summary": "List teams",
        "description": "Get all teams for the organization with pagination.",
        "operationId": "listTeams",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of teams"
          }
        }
      },
      "post": {
        "tags": [
          "Teams"
        ],
        "summary": "Create team",
        "description": "Create a new team.",
        "operationId": "createTeam",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Team created"
          }
        }
      }
    },
    "/api/teams/{id}": {
      "get": {
        "tags": [
          "Teams"
        ],
        "summary": "Get team",
        "description": "Get details of a specific team.",
        "operationId": "getTeam",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Team details"
          }
        }
      },
      "put": {
        "tags": [
          "Teams"
        ],
        "summary": "Update team",
        "description": "Update a team's name or description.",
        "operationId": "updateTeam",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Team updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Teams"
        ],
        "summary": "Delete team",
        "description": "Delete a team.",
        "operationId": "deleteTeam",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Team deleted"
          }
        }
      }
    },
    "/api/teams/{id}/members": {
      "get": {
        "tags": [
          "Teams"
        ],
        "summary": "List team members",
        "description": "Get all members of a specific team.",
        "operationId": "listTeamMembers",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Team members"
          }
        }
      },
      "post": {
        "tags": [
          "Teams"
        ],
        "summary": "Add team member",
        "description": "Add a user to a team.",
        "operationId": "addTeamMember",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "userId"
                ],
                "properties": {
                  "userId": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Member added"
          }
        }
      },
      "delete": {
        "tags": [
          "Teams"
        ],
        "summary": "Remove team member",
        "description": "Remove a user from a team.",
        "operationId": "removeTeamMember",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Member removed"
          }
        }
      }
    },
    "/api/organization": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get organization",
        "description": "Get the current organization's profile.",
        "operationId": "getOrganization",
        "responses": {
          "200": {
            "description": "Organization profile",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Organization"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Organization"
        ],
        "summary": "Update organization",
        "description": "Update the organization's profile (name, slug, logo, website, timezone).",
        "operationId": "updateOrganization",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "slug": {
                    "type": "string",
                    "maxLength": 50
                  },
                  "logo": {
                    "type": "string"
                  },
                  "website": {
                    "type": "string",
                    "format": "uri"
                  },
                  "description": {
                    "type": "string",
                    "maxLength": 500
                  },
                  "timezone": {
                    "type": "string"
                  },
                  "billingEmail": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Delete organization",
        "description": "Permanently delete the organization and all its data. Requires OWNER role.",
        "operationId": "deleteOrganization",
        "responses": {
          "200": {
            "description": "Organization deleted"
          }
        }
      }
    },
    "/api/organization/settings": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get organization settings",
        "description": "Get organization-level settings (alert defaults, preferences).",
        "operationId": "getOrganizationSettings",
        "responses": {
          "200": {
            "description": "Organization settings"
          }
        }
      },
      "patch": {
        "tags": [
          "Organization"
        ],
        "summary": "Update organization settings",
        "description": "Update organization-level settings.",
        "operationId": "updateOrganizationSettings",
        "responses": {
          "200": {
            "description": "Settings updated"
          }
        }
      }
    },
    "/api/organization/members/{id}": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get organization member",
        "description": "Get details of a specific organization member.",
        "operationId": "getOrganizationMember",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Member details"
          }
        }
      },
      "put": {
        "tags": [
          "Organization"
        ],
        "summary": "Update member role",
        "description": "Update an organization member's role.",
        "operationId": "updateMemberRole",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "role"
                ],
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "ADMIN",
                      "MEMBER",
                      "VIEWER"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Member role updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Remove organization member",
        "description": "Remove a member from the organization.",
        "operationId": "removeOrganizationMember",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Member removed"
          }
        }
      }
    },
    "/api/organization/invitations": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "List invitations",
        "description": "Get all pending invitations for the organization.",
        "operationId": "listInvitations",
        "responses": {
          "200": {
            "description": "Pending invitations"
          }
        }
      },
      "post": {
        "tags": [
          "Organization"
        ],
        "summary": "Send invitation",
        "description": "Send an invitation to join the organization.",
        "operationId": "sendInvitation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "role"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "ADMIN",
                      "MEMBER",
                      "VIEWER"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invitation sent"
          }
        }
      }
    },
    "/api/organization/invitations/{id}": {
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Cancel invitation",
        "description": "Cancel a pending invitation.",
        "operationId": "cancelInvitation",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invitation cancelled"
          }
        }
      }
    },
    "/api/organization/invitations/accept": {
      "post": {
        "tags": [
          "Organization"
        ],
        "summary": "Accept invitation",
        "description": "Accept an organization invitation using the invitation token.",
        "operationId": "acceptInvitation",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token"
                ],
                "properties": {
                  "token": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invitation accepted"
          }
        }
      }
    },
    "/api/organization/invitations/verify": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Verify invitation token",
        "description": "Verify an invitation token is valid and return invitation details.",
        "operationId": "verifyInvitation",
        "security": [],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invitation details"
          },
          "400": {
            "description": "Invalid or expired token"
          }
        }
      }
    },
    "/api/organization/branding": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get branding settings",
        "description": "Get white-label branding configuration.",
        "operationId": "getBranding",
        "responses": {
          "200": {
            "description": "Branding settings"
          }
        }
      },
      "put": {
        "tags": [
          "Organization"
        ],
        "summary": "Update branding",
        "description": "Update white-label branding configuration (colors, logo, custom domain).",
        "operationId": "updateBranding",
        "responses": {
          "200": {
            "description": "Branding updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Reset branding",
        "description": "Reset branding to default Visual Sentinel branding.",
        "operationId": "resetBranding",
        "responses": {
          "200": {
            "description": "Branding reset"
          }
        }
      }
    },
    "/api/organization/logo": {
      "post": {
        "tags": [
          "Organization"
        ],
        "summary": "Upload logo",
        "description": "Upload an organization logo image.",
        "operationId": "uploadLogo",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Logo uploaded"
          }
        }
      },
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Delete logo",
        "description": "Remove the organization logo.",
        "operationId": "deleteLogo",
        "responses": {
          "200": {
            "description": "Logo deleted"
          }
        }
      }
    },
    "/api/organization/email-templates": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get email templates",
        "description": "Get custom email templates for the organization.",
        "operationId": "getEmailTemplates",
        "responses": {
          "200": {
            "description": "Email templates"
          }
        }
      },
      "put": {
        "tags": [
          "Organization"
        ],
        "summary": "Update email templates",
        "description": "Update custom email templates.",
        "operationId": "updateEmailTemplates",
        "responses": {
          "200": {
            "description": "Templates updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Reset email templates",
        "description": "Reset email templates to defaults.",
        "operationId": "resetEmailTemplates",
        "responses": {
          "200": {
            "description": "Templates reset"
          }
        }
      }
    },
    "/api/organization/smtp": {
      "get": {
        "tags": [
          "Organization"
        ],
        "summary": "Get SMTP settings",
        "description": "Get custom SMTP configuration for sending emails.",
        "operationId": "getSmtpSettings",
        "responses": {
          "200": {
            "description": "SMTP settings"
          }
        }
      },
      "post": {
        "tags": [
          "Organization"
        ],
        "summary": "Test SMTP settings",
        "description": "Send a test email using the provided SMTP configuration.",
        "operationId": "testSmtpSettings",
        "responses": {
          "200": {
            "description": "Test email sent"
          }
        }
      },
      "put": {
        "tags": [
          "Organization"
        ],
        "summary": "Update SMTP settings",
        "description": "Update custom SMTP configuration.",
        "operationId": "updateSmtpSettings",
        "responses": {
          "200": {
            "description": "SMTP settings updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Organization"
        ],
        "summary": "Delete SMTP settings",
        "description": "Remove custom SMTP configuration and revert to default.",
        "operationId": "deleteSmtpSettings",
        "responses": {
          "200": {
            "description": "SMTP settings removed"
          }
        }
      }
    },
    "/api/organization/leave": {
      "post": {
        "tags": [
          "Organization"
        ],
        "summary": "Leave organization",
        "description": "Leave the current organization. Owners cannot leave \u2014 they must transfer ownership to another member first. After leaving, the user is switched to their next available organization.",
        "operationId": "leaveOrganization",
        "responses": {
          "200": {
            "description": "Successfully left the organization",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "switchTo": {
                      "type": "string",
                      "format": "uuid",
                      "nullable": true,
                      "description": "Organization ID to switch to, or null if no other memberships"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Owners cannot leave \u2014 must transfer ownership first"
          },
          "404": {
            "description": "Not a member of this organization"
          },
          "503": {
            "description": "Database unavailable"
          }
        }
      }
    },
    "/api/maintenance": {
      "get": {
        "tags": [
          "Maintenance"
        ],
        "summary": "List maintenance windows",
        "description": "Get all maintenance windows for the organization.",
        "operationId": "listMaintenanceWindows",
        "responses": {
          "200": {
            "description": "List of maintenance windows"
          }
        }
      },
      "post": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Create maintenance window",
        "description": "Schedule a new maintenance window.",
        "operationId": "createMaintenanceWindow",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "startTime",
                  "endTime"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "startTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "endTime": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "monitorIds": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "uuid"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Maintenance window created"
          }
        }
      }
    },
    "/api/maintenance/{id}": {
      "get": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Get maintenance window",
        "description": "Get details of a specific maintenance window.",
        "operationId": "getMaintenanceWindow",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance window details"
          }
        }
      },
      "patch": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Update maintenance window",
        "description": "Update a maintenance window's schedule or monitors.",
        "operationId": "updateMaintenanceWindow",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance window updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Maintenance"
        ],
        "summary": "Delete maintenance window",
        "description": "Delete a maintenance window.",
        "operationId": "deleteMaintenanceWindow",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Maintenance window deleted"
          }
        }
      }
    },
    "/api/billing/checkout": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Create checkout session",
        "description": "Create a Paddle checkout session for subscription purchase.",
        "operationId": "createCheckout",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "plan"
                ],
                "properties": {
                  "plan": {
                    "type": "string",
                    "enum": [
                      "free",
                      "starter",
                      "business",
                      "agency"
                    ]
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "billing": {
                    "type": "string",
                    "enum": [
                      "monthly",
                      "yearly"
                    ],
                    "default": "monthly"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Checkout session URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "checkoutUrl": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/portal": {
      "post": {
        "tags": [
          "Billing"
        ],
        "summary": "Get billing portal URL",
        "description": "Get a Paddle customer portal URL for managing subscriptions.",
        "operationId": "getBillingPortal",
        "responses": {
          "200": {
            "description": "Portal URL",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string",
                      "format": "uri"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/billing/ai-usage": {
      "get": {
        "tags": [
          "Billing"
        ],
        "summary": "Get AI usage",
        "description": "Get AI feature usage for the current billing period.",
        "operationId": "getAiUsage",
        "responses": {
          "200": {
            "description": "AI usage data"
          }
        }
      }
    },
    "/api/integrations/google/authorize": {
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Initiate Google integration OAuth",
        "description": "Redirect to Google OAuth for Search Console / Analytics integration.",
        "operationId": "googleIntegrationOAuth",
        "responses": {
          "302": {
            "description": "Redirect to Google"
          }
        }
      }
    },
    "/api/integrations/google/callback": {
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Google integration OAuth callback",
        "description": "Handle Google OAuth callback for integration setup.",
        "operationId": "googleIntegrationCallback",
        "responses": {
          "302": {
            "description": "Redirect to settings"
          }
        }
      }
    },
    "/api/integrations/google/properties": {
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "List Google properties",
        "description": "List available Google Search Console properties.",
        "operationId": "listGoogleProperties",
        "responses": {
          "200": {
            "description": "Google properties"
          }
        }
      },
      "post": {
        "tags": [
          "Integrations"
        ],
        "summary": "Select Google property",
        "description": "Select a Google Search Console property to connect.",
        "operationId": "selectGoogleProperty",
        "responses": {
          "200": {
            "description": "Property selected"
          }
        }
      }
    },
    "/api/integrations/google/status": {
      "get": {
        "tags": [
          "Integrations"
        ],
        "summary": "Get Google integration status",
        "description": "Check Google integration connection status.",
        "operationId": "getGoogleIntegrationStatus",
        "responses": {
          "200": {
            "description": "Integration status"
          }
        }
      },
      "delete": {
        "tags": [
          "Integrations"
        ],
        "summary": "Disconnect Google integration",
        "description": "Disconnect Google integration and revoke tokens.",
        "operationId": "disconnectGoogleIntegration",
        "responses": {
          "200": {
            "description": "Integration disconnected"
          }
        }
      }
    },
    "/api/tools/website-check": {
      "get": {
        "tags": [
          "Tools"
        ],
        "summary": "Website health check",
        "description": "Free tool to check website availability, response time, SSL, headers, and more. Rate limited to 10 requests/minute per IP.",
        "operationId": "websiteCheck",
        "security": [],
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "URL to check (https:// prefix added if missing)"
          }
        ],
        "responses": {
          "200": {
            "description": "Website check results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "responseTime": {
                      "type": "integer"
                    },
                    "statusCode": {
                      "type": "integer"
                    },
                    "ssl": {
                      "type": "object"
                    },
                    "headers": {
                      "type": "object"
                    },
                    "dns": {
                      "type": "object"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/tools/ssl-check": {
      "get": {
        "tags": [
          "Tools"
        ],
        "summary": "SSL certificate check",
        "description": "Free tool to check SSL certificate validity, expiration, and chain details.",
        "operationId": "sslCheck",
        "security": [],
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SSL certificate details"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/tools/dns-check": {
      "get": {
        "tags": [
          "Tools"
        ],
        "summary": "DNS lookup tool",
        "description": "Free tool to check DNS records (A, AAAA, MX, NS, TXT, CNAME, SOA).",
        "operationId": "dnsCheck",
        "security": [],
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "DNS records"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/tools/speed-test": {
      "get": {
        "tags": [
          "Tools"
        ],
        "summary": "Website speed test",
        "description": "Free tool to test website loading speed and performance metrics.",
        "operationId": "speedTest",
        "security": [],
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Speed test results"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/reports/digest": {
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Get digest report",
        "description": "Get the latest monitoring digest report for the organization.",
        "operationId": "getDigestReport",
        "responses": {
          "200": {
            "description": "Digest report"
          }
        }
      }
    },
    "/api/reports/generate": {
      "post": {
        "tags": [
          "Reports"
        ],
        "summary": "Generate report",
        "description": "Generate a new monitoring report on demand.",
        "operationId": "generateReport",
        "responses": {
          "200": {
            "description": "Report generated"
          }
        }
      },
      "get": {
        "tags": [
          "Reports"
        ],
        "summary": "Get report status",
        "description": "Get the status of a report generation request.",
        "operationId": "getReportStatus",
        "responses": {
          "200": {
            "description": "Report status"
          }
        }
      }
    },
    "/api/analytics": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get analytics overview",
        "description": "Get monitoring analytics and statistics for the organization.",
        "operationId": "getAnalytics",
        "responses": {
          "200": {
            "description": "Analytics data"
          }
        }
      }
    },
    "/api/analytics/journeys": {
      "post": {
        "tags": [
          "Analytics"
        ],
        "summary": "Track journey event",
        "description": "Track a user journey event.",
        "operationId": "trackJourney",
        "security": [],
        "responses": {
          "200": {
            "description": "Event tracked"
          }
        }
      }
    },
    "/api/analytics/subscription-events": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get subscription events",
        "description": "Get subscription lifecycle events for analytics.",
        "operationId": "getSubscriptionEvents",
        "responses": {
          "200": {
            "description": "Subscription events"
          }
        }
      },
      "post": {
        "tags": [
          "Analytics"
        ],
        "summary": "Track subscription event",
        "description": "Track a subscription-related event.",
        "operationId": "trackSubscriptionEvent",
        "responses": {
          "200": {
            "description": "Event tracked"
          }
        }
      }
    },
    "/api/notifications": {
      "get": {
        "tags": [
          "Notifications"
        ],
        "summary": "List in-app notifications",
        "description": "Get in-app notifications for the current user (bell icon).",
        "operationId": "listNotifications",
        "responses": {
          "200": {
            "description": "Notifications"
          }
        }
      },
      "patch": {
        "tags": [
          "Notifications"
        ],
        "summary": "Mark notifications as read",
        "description": "Mark one or more notifications as read.",
        "operationId": "markNotificationsRead",
        "responses": {
          "200": {
            "description": "Notifications marked as read"
          }
        }
      },
      "delete": {
        "tags": [
          "Notifications"
        ],
        "summary": "Delete notifications",
        "description": "Delete notifications.",
        "operationId": "deleteNotifications",
        "responses": {
          "200": {
            "description": "Notifications deleted"
          }
        }
      }
    },
    "/api/notifications/bulk-assign": {
      "post": {
        "tags": [
          "Notifications"
        ],
        "summary": "Bulk assign notifications",
        "description": "Bulk assign notification channels to monitors.",
        "operationId": "bulkAssignNotifications",
        "responses": {
          "200": {
            "description": "Assignments updated"
          }
        }
      }
    },
    "/api/user/profile": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get user profile",
        "description": "Get the current user's profile information.",
        "operationId": "getUserProfile",
        "responses": {
          "200": {
            "description": "User profile"
          }
        }
      },
      "put": {
        "tags": [
          "User"
        ],
        "summary": "Update user profile",
        "description": "Update the current user's profile (name, avatar, etc.).",
        "operationId": "updateUserProfile",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "avatar": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Profile updated"
          }
        }
      }
    },
    "/api/user/profile/avatar": {
      "post": {
        "tags": [
          "User"
        ],
        "summary": "Upload avatar",
        "description": "Upload a new avatar image for the current user. Accepts JPEG, PNG, WebP, or GIF up to 2MB. Replaces any existing avatar.",
        "operationId": "uploadAvatar",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "Avatar image file (JPEG, PNG, WebP, or GIF, max 2MB)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Avatar uploaded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "avatar": {
                      "type": "string",
                      "description": "URL path to the uploaded avatar"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid file type or file too large"
          },
          "401": {
            "description": "Not authenticated"
          },
          "503": {
            "description": "Database unavailable"
          }
        }
      },
      "delete": {
        "tags": [
          "User"
        ],
        "summary": "Delete avatar",
        "description": "Remove the current user's avatar image and reset to default.",
        "operationId": "deleteAvatar",
        "responses": {
          "200": {
            "description": "Avatar deleted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Not authenticated"
          },
          "503": {
            "description": "Database unavailable"
          }
        }
      }
    },
    "/api/user/delete-account": {
      "post": {
        "tags": [
          "User"
        ],
        "summary": "Delete account",
        "description": "Permanently delete the user's account.",
        "operationId": "deleteAccount",
        "responses": {
          "200": {
            "description": "Account deleted"
          }
        }
      }
    },
    "/api/user/digest-preferences": {
      "get": {
        "tags": [
          "User"
        ],
        "summary": "Get digest preferences",
        "description": "Get the user's email digest preferences.",
        "operationId": "getDigestPreferences",
        "responses": {
          "200": {
            "description": "Digest preferences"
          }
        }
      },
      "put": {
        "tags": [
          "User"
        ],
        "summary": "Update digest preferences",
        "description": "Update email digest frequency and settings.",
        "operationId": "updateDigestPreferences",
        "responses": {
          "200": {
            "description": "Preferences updated"
          }
        }
      }
    },
    "/api/user/organizations/switch": {
      "post": {
        "tags": [
          "User"
        ],
        "summary": "Switch organization",
        "description": "Switch the active organization for the current session.",
        "operationId": "switchOrganization",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "organizationId"
                ],
                "properties": {
                  "organizationId": {
                    "type": "string",
                    "format": "uuid"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Organization switched"
          }
        }
      }
    },
    "/api/api-keys": {
      "get": {
        "tags": [
          "API Keys"
        ],
        "summary": "List API keys",
        "description": "Get all API keys for the organization.",
        "operationId": "listApiKeys",
        "responses": {
          "200": {
            "description": "List of API keys",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ApiKey"
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "API Keys"
        ],
        "summary": "Create API key",
        "description": "Generate a new API key for programmatic access. Requires Business plan or higher.",
        "operationId": "createApiKey",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "scopes"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 100
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "minItems": 1,
                    "description": "Required. At least one scope, e.g. monitors:read, servers:write, * etc."
                  },
                  "expiresAt": {
                    "type": "string",
                    "format": "date-time",
                    "description": "ISO 8601 expiry timestamp (preferred). Takes precedence over expiresIn."
                  },
                  "expiresIn": {
                    "type": "integer",
                    "minimum": 1,
                    "description": "Legacy alternative to expiresAt: number of days until the key expires. Used only when expiresAt is omitted."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "API key created (key shown only once)",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/ApiKey"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string",
                          "description": "The actual API key value (shown only once)"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "API Keys"
        ],
        "summary": "Delete API key",
        "description": "Revoke an API key.",
        "operationId": "deleteApiKey",
        "responses": {
          "200": {
            "description": "API key deleted"
          }
        }
      }
    },
    "/api/chat": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Send chat message",
        "description": "Send a message to the AI chat support system.",
        "operationId": "sendChatMessage",
        "responses": {
          "200": {
            "description": "AI response"
          }
        }
      },
      "get": {
        "tags": [
          "Chat"
        ],
        "summary": "Get chat messages",
        "description": "Get chat message history.",
        "operationId": "getChatMessages",
        "responses": {
          "200": {
            "description": "Chat messages"
          }
        }
      }
    },
    "/api/chat/sessions": {
      "get": {
        "tags": [
          "Chat"
        ],
        "summary": "List chat sessions",
        "description": "Get all chat sessions for the current user.",
        "operationId": "listChatSessions",
        "responses": {
          "200": {
            "description": "Chat sessions"
          }
        }
      },
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Create chat session",
        "description": "Start a new chat session.",
        "operationId": "createChatSession",
        "responses": {
          "201": {
            "description": "Session created"
          }
        }
      }
    },
    "/api/chat/sessions/{id}": {
      "get": {
        "tags": [
          "Chat"
        ],
        "summary": "Get chat session",
        "description": "Get a specific chat session with messages.",
        "operationId": "getChatSession",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Chat session with messages"
          }
        }
      },
      "patch": {
        "tags": [
          "Chat"
        ],
        "summary": "Update chat session",
        "description": "Update a chat session (e.g., rename).",
        "operationId": "updateChatSession",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session updated"
          }
        }
      },
      "delete": {
        "tags": [
          "Chat"
        ],
        "summary": "Delete chat session",
        "description": "Delete a chat session and its messages.",
        "operationId": "deleteChatSession",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Session deleted"
          }
        }
      }
    },
    "/api/chat/sessions/{id}/convert-to-ticket": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Convert chat to support ticket",
        "description": "Convert a chat session into a support ticket for human follow-up.",
        "operationId": "convertChatToTicket",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ticket created"
          }
        }
      }
    },
    "/api/chat/feedback": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Submit chat feedback",
        "description": "Submit feedback (thumbs up/down) for a chat response.",
        "operationId": "submitChatFeedback",
        "responses": {
          "200": {
            "description": "Feedback submitted"
          }
        }
      }
    },
    "/api/chat/upload": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Upload chat attachment",
        "description": "Upload an image or file attachment for a chat message.",
        "operationId": "uploadChatAttachment",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "File uploaded"
          }
        }
      }
    },
    "/api/onboarding/status": {
      "get": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Get onboarding status",
        "description": "Get the user's onboarding progress.",
        "operationId": "getOnboardingStatus",
        "responses": {
          "200": {
            "description": "Onboarding status"
          }
        }
      }
    },
    "/api/onboarding/select-plan": {
      "post": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Select plan during onboarding",
        "description": "Select a plan as part of the onboarding flow.",
        "operationId": "selectOnboardingPlan",
        "responses": {
          "200": {
            "description": "Plan selected"
          }
        }
      }
    },
    "/api/onboarding/auto-setup": {
      "post": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Auto-setup during onboarding",
        "description": "Automatically create a monitor from a URL during onboarding.",
        "operationId": "autoSetup",
        "responses": {
          "200": {
            "description": "Auto-setup complete"
          }
        }
      }
    },
    "/api/onboarding/start-no-card-trial": {
      "post": {
        "tags": [
          "Onboarding"
        ],
        "summary": "Start no-card trial",
        "description": "Start a 7-day free trial on the selected plan without requiring a credit card. Requires write access. The organization must not already have an active subscription or Paddle subscription.",
        "operationId": "startNoCardTrial",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "plan"
                ],
                "properties": {
                  "plan": {
                    "type": "string",
                    "enum": [
                      "solo",
                      "starter",
                      "business",
                      "agency"
                    ],
                    "description": "Plan to trial (legacy names 'enterprise'/'professional' are accepted)"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Trial started",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "plan": {
                      "type": "string"
                    },
                    "trialEndsAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid plan name"
          },
          "401": {
            "description": "Authentication required"
          },
          "404": {
            "description": "Organization not found"
          },
          "409": {
            "description": "Organization already has an active subscription or trial"
          }
        }
      }
    },
    "/api/settings/deduplication": {
      "get": {
        "tags": [
          "Settings"
        ],
        "summary": "Get deduplication settings",
        "description": "Get alert deduplication settings.",
        "operationId": "getDeduplicationSettings",
        "responses": {
          "200": {
            "description": "Deduplication settings"
          }
        }
      },
      "put": {
        "tags": [
          "Settings"
        ],
        "summary": "Update deduplication settings",
        "description": "Update alert deduplication configuration.",
        "operationId": "updateDeduplicationSettings",
        "responses": {
          "200": {
            "description": "Settings updated"
          }
        }
      }
    },
    "/api/settings/deduplication/stats": {
      "get": {
        "tags": [
          "Settings"
        ],
        "summary": "Get deduplication stats",
        "description": "Get statistics on how many alerts have been deduplicated.",
        "operationId": "getDeduplicationStats",
        "responses": {
          "200": {
            "description": "Deduplication statistics"
          }
        }
      }
    },
    "/api/settings/reports": {
      "get": {
        "tags": [
          "Settings"
        ],
        "summary": "Get report settings",
        "description": "Get scheduled report configuration.",
        "operationId": "getReportSettings",
        "responses": {
          "200": {
            "description": "Report settings"
          }
        }
      },
      "put": {
        "tags": [
          "Settings"
        ],
        "summary": "Update report settings",
        "description": "Update scheduled report configuration (frequency, recipients).",
        "operationId": "updateReportSettings",
        "responses": {
          "200": {
            "description": "Settings updated"
          }
        }
      }
    },
    "/api/settings/reports/test": {
      "post": {
        "tags": [
          "Settings"
        ],
        "summary": "Send test report",
        "description": "Send a test report email to verify configuration.",
        "operationId": "sendTestReport",
        "responses": {
          "200": {
            "description": "Test report sent"
          }
        }
      }
    },
    "/api/ai/insights": {
      "get": {
        "tags": [
          "Analytics"
        ],
        "summary": "Get AI insights",
        "description": "Get AI-generated insights about monitoring data and trends.",
        "operationId": "getAiInsights",
        "responses": {
          "200": {
            "description": "AI insights"
          }
        }
      }
    },
    "/api/support/tickets": {
      "post": {
        "tags": [
          "Chat"
        ],
        "summary": "Create support ticket",
        "description": "Create a support ticket directly.",
        "operationId": "createSupportTicket",
        "responses": {
          "201": {
            "description": "Ticket created"
          }
        }
      },
      "get": {
        "tags": [
          "Chat"
        ],
        "summary": "List support tickets",
        "description": "Get all support tickets for the current user.",
        "operationId": "listSupportTickets",
        "responses": {
          "200": {
            "description": "Support tickets"
          }
        }
      }
    },
    "/api/contact": {
      "post": {
        "tags": [
          "Public"
        ],
        "summary": "Submit contact form",
        "description": "Submit a contact form message. No authentication required.",
        "operationId": "submitContactForm",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "email",
                  "message"
                ],
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  },
                  "subject": {
                    "type": "string"
                  },
                  "message": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message sent"
          }
        }
      }
    },
    "/api/public/announcement": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Get active announcement",
        "description": "Returns the currently active site announcement (promotional banners, maintenance notices, etc.). Cached for 60 seconds. No authentication required. Falls back to environment-based discount config if no database announcement is active.",
        "operationId": "getPublicAnnouncement",
        "security": [],
        "parameters": [
          {
            "name": "context",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "public",
                "dashboard",
                "checkout"
              ],
              "default": "public"
            },
            "description": "Filter announcements by display context"
          }
        ],
        "responses": {
          "200": {
            "description": "Active announcement or null",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true,
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "PROMO",
                        "MAINTENANCE",
                        "INFO",
                        "WARNING"
                      ]
                    },
                    "message": {
                      "type": "string"
                    },
                    "active": {
                      "type": "boolean"
                    },
                    "discountId": {
                      "type": "string",
                      "nullable": true
                    },
                    "discountPercent": {
                      "type": "number",
                      "nullable": true
                    },
                    "bgColor": {
                      "type": "string",
                      "nullable": true
                    },
                    "textColor": {
                      "type": "string",
                      "nullable": true
                    },
                    "icon": {
                      "type": "string",
                      "nullable": true
                    },
                    "showOnPublic": {
                      "type": "boolean"
                    },
                    "showOnDashboard": {
                      "type": "boolean"
                    },
                    "showOnCheckout": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/stats": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Get public statistics",
        "description": "Get public platform statistics (total monitors, checks performed, etc.).",
        "operationId": "getPublicStats",
        "security": [],
        "responses": {
          "200": {
            "description": "Public stats",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "totalMonitors": {
                      "type": "integer"
                    },
                    "totalChecks": {
                      "type": "integer"
                    },
                    "totalUsers": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/blog": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "List blog posts",
        "description": "Get published blog posts with pagination.",
        "operationId": "listBlogPosts",
        "security": [],
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 10
            }
          },
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Blog posts"
          }
        }
      }
    },
    "/api/public/blog/{slug}": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Get blog post",
        "description": "Get a single blog post by slug.",
        "operationId": "getBlogPost",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Blog post"
          },
          "404": {
            "description": "Post not found"
          }
        }
      }
    },
    "/api/public/blog/{slug}/view": {
      "post": {
        "tags": [
          "Public"
        ],
        "summary": "Track blog post view",
        "description": "Increment the view count for a blog post.",
        "operationId": "trackBlogView",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "View tracked"
          }
        }
      }
    },
    "/api/public/status/{slug}": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Get public status page",
        "description": "Get a public status page by slug (no auth required).",
        "operationId": "getPublicStatusPage",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public status page data"
          },
          "404": {
            "description": "Status page not found"
          }
        }
      }
    },
    "/api/public/status/{slug}/badge": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Get status badge",
        "description": "Get an SVG status badge for embedding in README files or websites.",
        "operationId": "getStatusBadge",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "SVG badge",
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/public/status/{slug}/subscribe": {
      "post": {
        "tags": [
          "Public"
        ],
        "summary": "Subscribe to status updates",
        "description": "Subscribe an email address to status page updates.",
        "operationId": "subscribeToStatusPage",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Subscribed (verification email sent)"
          }
        }
      },
      "delete": {
        "tags": [
          "Public"
        ],
        "summary": "Unsubscribe from status updates",
        "description": "Unsubscribe from status page updates.",
        "operationId": "unsubscribeFromStatusPage",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Unsubscribed"
          }
        }
      }
    },
    "/api/public/status/{slug}/verify": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Verify status page subscription",
        "description": "Verify email subscription to a status page using the verification token.",
        "operationId": "verifyStatusSubscription",
        "security": [],
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Subscription verified"
          }
        }
      }
    },
    "/api/public/resolve-domain": {
      "get": {
        "tags": [
          "Public"
        ],
        "summary": "Resolve custom domain",
        "description": "Resolve a custom domain to find the associated status page.",
        "operationId": "resolveCustomDomain",
        "security": [],
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved status page"
          },
          "404": {
            "description": "Domain not found"
          }
        }
      }
    },
    "/api/webhooks/paddle": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Paddle webhook",
        "description": "Incoming webhook handler for Paddle billing events (subscription created, updated, cancelled, payment).",
        "operationId": "paddleWebhook",
        "security": [],
        "responses": {
          "200": {
            "description": "Webhook processed"
          }
        }
      }
    },
    "/api/webhooks/whatsapp": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "WhatsApp webhook verification",
        "description": "Webhook verification endpoint for WhatsApp Business API.",
        "operationId": "whatsappWebhookVerify",
        "security": [],
        "responses": {
          "200": {
            "description": "Verification challenge response"
          }
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "WhatsApp webhook",
        "description": "Incoming webhook handler for WhatsApp message events.",
        "operationId": "whatsappWebhook",
        "security": [],
        "responses": {
          "200": {
            "description": "Webhook processed"
          }
        }
      }
    },
    "/api/content-proxy": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Content proxy",
        "description": "Proxy content through the server to avoid CORS issues.",
        "operationId": "contentProxy",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Proxied content"
          }
        }
      }
    },
    "/api/verify-domain": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Verify domain ownership",
        "description": "Verify domain ownership via DNS TXT record lookup.",
        "operationId": "verifyDomain",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Domain verification result"
          }
        }
      }
    },
    "/api/client-error": {
      "post": {
        "tags": [
          "System"
        ],
        "summary": "Report client error",
        "description": "Report a client-side JavaScript error for logging.",
        "operationId": "reportClientError",
        "security": [],
        "responses": {
          "200": {
            "description": "Error logged"
          }
        }
      }
    },
    "/api/indexnow": {
      "post": {
        "tags": [
          "System"
        ],
        "summary": "IndexNow submission",
        "description": "Submit URLs to IndexNow for search engine indexing.",
        "operationId": "submitIndexNow",
        "responses": {
          "200": {
            "description": "URLs submitted"
          }
        }
      }
    },
    "/api/revalidate": {
      "post": {
        "tags": [
          "System"
        ],
        "summary": "Revalidate cache",
        "description": "Revalidate Next.js ISR cache for specific paths.",
        "operationId": "revalidateCache",
        "responses": {
          "200": {
            "description": "Cache revalidated"
          }
        }
      }
    },
    "/api/email-tracking/open/{messageId}": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Track email open",
        "description": "Tracking pixel endpoint for email open tracking.",
        "operationId": "trackEmailOpen",
        "security": [],
        "parameters": [
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "1x1 transparent pixel"
          }
        }
      }
    },
    "/api/email-tracking/click/{messageId}": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Track email click",
        "description": "Redirect endpoint for email click tracking.",
        "operationId": "trackEmailClick",
        "security": [],
        "parameters": [
          {
            "name": "messageId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Redirect to target URL"
          }
        }
      }
    },
    "/api/email-tracking/stats": {
      "get": {
        "tags": [
          "System"
        ],
        "summary": "Get email tracking stats",
        "description": "Get email open and click tracking statistics.",
        "operationId": "getEmailTrackingStats",
        "responses": {
          "200": {
            "description": "Email tracking stats"
          }
        }
      }
    },
    "/api/tools/domain-expiry": {
      "post": {
        "tags": [
          "Free Tools"
        ],
        "summary": "Domain expiry lookup (free, no auth)",
        "description": "Looks up a domain registration's expiry date, registrar, registration date, and status locks via registry RDAP. Public endpoint, rate limited to 10 requests per 10 minutes per IP. Input must be a bare registrable domain (no scheme, path, or subdomain).",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "domain"
                ],
                "properties": {
                  "domain": {
                    "type": "string",
                    "example": "example.com"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lookup result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "domain": {
                      "type": "string"
                    },
                    "outcome": {
                      "type": "string",
                      "enum": [
                        "ok",
                        "unsupported_tld",
                        "lookup_failed",
                        "not_found"
                      ]
                    },
                    "expiresAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "daysRemaining": {
                      "type": "integer",
                      "nullable": true
                    },
                    "registeredAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "registrar": {
                      "type": "string",
                      "nullable": true
                    },
                    "domainStatuses": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "checkedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Input is not a bare registrable domain"
          },
          "429": {
            "description": "Rate limit exceeded (10 per 10 minutes per IP)"
          }
        }
      }
    },
    "/api/monitors/{id}/restore": {
      "post": {
        "tags": [
          "Monitors"
        ],
        "summary": "Restore a deleted monitor",
        "description": "Restore a monitor deleted within the last 24 hours, including its full check and incident history. Returns 410 when the restore window has passed.",
        "operationId": "restoreMonitor",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Monitor restored"
          },
          "404": {
            "description": "Monitor not found or not deleted"
          },
          "410": {
            "description": "Restore window has passed"
          }
        }
      }
    },
    "/api/monitors/deleted": {
      "get": {
        "tags": [
          "Monitors"
        ],
        "summary": "List recently deleted monitors",
        "description": "Monitors deleted within the last 24 hours that can still be restored.",
        "operationId": "listDeletedMonitors",
        "responses": {
          "200": {
            "description": "List of restorable monitors"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "SessionAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "session",
        "description": "Session cookie obtained from POST /api/auth/login"
      },
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key (vs_xxxxx). Can also be sent via X-API-Key header or api_key query parameter."
      }
    },
    "schemas": {
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "details": {
            "type": "object"
          }
        }
      },
      "HealthResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "healthy",
              "unhealthy"
            ]
          },
          "timestamp": {
            "type": "string",
            "format": "date-time"
          },
          "uptime": {
            "type": "number"
          },
          "version": {
            "type": "string"
          },
          "services": {
            "type": "object",
            "properties": {
              "database": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "latency": {
                    "type": "number"
                  }
                }
              },
              "redis": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "latency": {
                    "type": "number"
                  }
                }
              },
              "worker": {
                "type": "object",
                "properties": {
                  "status": {
                    "type": "string"
                  },
                  "activeJobs": {
                    "type": "number"
                  }
                }
              }
            }
          }
        }
      },
      "LoginRequest": {
        "type": "object",
        "required": [
          "email",
          "password"
        ],
        "properties": {
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string"
          }
        }
      },
      "RegisterRequest": {
        "type": "object",
        "required": [
          "name",
          "email",
          "password",
          "acceptTerms"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "password": {
            "type": "string",
            "minLength": 8,
            "description": "Must contain uppercase, lowercase, and number"
          },
          "organizationName": {
            "type": "string",
            "minLength": 2,
            "maxLength": 100
          },
          "acceptTerms": {
            "type": "boolean"
          }
        }
      },
      "AuthResponse": {
        "type": "object",
        "properties": {
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "organization": {
            "$ref": "#/components/schemas/Organization"
          }
        }
      },
      "User": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "role": {
            "type": "string",
            "enum": [
              "OWNER",
              "ADMIN",
              "MEMBER",
              "VIEWER"
            ]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Organization": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "plan": {
            "type": "string",
            "enum": [
              "FREE",
              "STARTER",
              "BUSINESS",
              "AGENCY",
              "CUSTOM"
            ]
          },
          "monitorLimit": {
            "type": "integer",
            "description": "Effective organization-specific monitor allowance. CUSTOM organizations may exceed the standard Agency limit."
          }
        }
      },
      "MonitorType": {
        "type": "string",
        "enum": [
          "HTTP",
          "HTTPS",
          "TCP",
          "UDP",
          "PING",
          "PORT",
          "DNS",
          "SSL",
          "KEYWORD",
          "API",
          "WEBSOCKET",
          "GRAPHQL",
          "GRPC",
          "SMTP",
          "IMAP",
          "FTP",
          "SSH",
          "DATABASE",
          "REDIS",
          "DOCKER",
          "KUBERNETES",
          "SYNTHETIC",
          "BROWSER",
          "VISUAL",
          "CONTENT"
        ]
      },
      "MonitorStatus": {
        "type": "string",
        "enum": [
          "OPERATIONAL",
          "DEGRADED",
          "PARTIAL_OUTAGE",
          "MAJOR_OUTAGE",
          "UI_CHANGED",
          "CONTENT_STALE",
          "CONTENT_CHANGED",
          "UNDER_MAINTENANCE",
          "UNKNOWN"
        ]
      },
      "HTTPMethod": {
        "type": "string",
        "enum": [
          "GET",
          "POST",
          "PUT",
          "PATCH",
          "DELETE",
          "HEAD",
          "OPTIONS"
        ]
      },
      "Monitor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "type": {
            "$ref": "#/components/schemas/MonitorType"
          },
          "status": {
            "$ref": "#/components/schemas/MonitorStatus"
          },
          "enabled": {
            "type": "boolean"
          },
          "method": {
            "$ref": "#/components/schemas/HTTPMethod"
          },
          "checkInterval": {
            "type": "integer",
            "description": "Check interval in seconds"
          },
          "timeout": {
            "type": "integer",
            "description": "Timeout in milliseconds"
          },
          "uptime": {
            "type": "number",
            "description": "Uptime percentage"
          },
          "lastCheckedAt": {
            "type": "string",
            "format": "date-time"
          },
          "lastResponseTime": {
            "type": "integer",
            "nullable": true,
            "description": "Most recent check latency in milliseconds. Null when the latest check has no latency."
          },
          "responseTime": {
            "type": "integer",
            "nullable": true,
            "description": "Rolling 24-hour successful-check average in milliseconds, falling back to the latest latency for new monitors."
          },
          "avgResponseTime24h": {
            "type": "integer",
            "nullable": true
          },
          "lastChecked": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "locations": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "regionChecks": {
            "type": "array",
            "description": "Latest authoritative check per configured canonical region. An empty array means no regional evidence is available; clients must fall back to aggregate latency rather than inventing waiting states.",
            "items": {
              "type": "object",
              "required": [
                "region",
                "status",
                "responseTime",
                "checkedAt"
              ],
              "properties": {
                "region": {
                  "type": "string",
                  "enum": ["EU", "US", "ASIA"]
                },
                "status": {
                  "type": "string"
                },
                "responseTime": {
                  "type": "integer",
                  "nullable": true
                },
                "checkedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "visualEnabled": {
            "type": "boolean"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "domainExpiryEnabled": {
            "type": "boolean",
            "default": true,
            "description": "Domain registration expiry monitoring for this monitor's registrable domain. Available on every plan."
          },
          "domainAlertDays": {
            "type": "array",
            "items": {
              "type": "integer",
              "enum": [
                50,
                30,
                20,
                13,
                6,
                3,
                1
              ]
            },
            "default": [
              50,
              13,
              3,
              1
            ],
            "description": "Days-before-expiry alert tiers. The 50 day tier fires while a registrar transfer is still possible without forfeiting the renewal year."
          },
          "domainExpiry": {
            "type": "object",
            "nullable": true,
            "description": "Registration expiry summary for the monitor's registrable domain (null when the URL has no registrable domain, e.g. an IP address).",
            "properties": {
              "domain": {
                "type": "string"
              },
              "expiresAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "daysRemaining": {
                "type": "integer",
                "nullable": true
              },
              "registrar": {
                "type": "string",
                "nullable": true
              },
              "state": {
                "type": "string",
                "enum": [
                  "pending",
                  "ok",
                  "unsupported_tld",
                  "lookup_failed",
                  "not_found"
                ]
              },
              "lastCheckedAt": {
                "type": "string",
                "format": "date-time",
                "nullable": true
              },
              "enabled": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "CreateMonitorRequest": {
        "type": "object",
        "required": [
          "name",
          "url"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "description": {
            "type": "string",
            "maxLength": 500
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "type": {
            "$ref": "#/components/schemas/MonitorType"
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "method": {
            "$ref": "#/components/schemas/HTTPMethod"
          },
          "headers": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "body": {
            "type": "string"
          },
          "timeout": {
            "type": "integer",
            "minimum": 1000,
            "maximum": 60000,
            "default": 30000
          },
          "checkInterval": {
            "type": "integer",
            "minimum": 60,
            "maximum": 86400,
            "default": 1800,
            "description": "Check interval in seconds"
          },
          "expectedStatus": {
            "type": "array",
            "items": {
              "type": "integer"
            },
            "default": [
              200,
              201,
              204
            ]
          },
          "visualEnabled": {
            "type": "boolean",
            "default": true
          },
          "visualConfig": {
            "type": "object",
            "properties": {
              "threshold": {
                "type": "number",
                "minimum": 0,
                "maximum": 100,
                "default": 10
              },
              "viewport": {
                "type": "object",
                "properties": {
                  "width": {
                    "type": "integer",
                    "default": 1920
                  },
                  "height": {
                    "type": "integer",
                    "default": 1080
                  }
                }
              },
              "fullPage": {
                "type": "boolean",
                "default": false
              }
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "domainExpiryEnabled": {
            "type": "boolean",
            "default": true,
            "description": "Domain registration expiry monitoring for this monitor's registrable domain. Available on every plan."
          },
          "domainAlertDays": {
            "type": "array",
            "items": {
              "type": "integer",
              "enum": [
                50,
                30,
                20,
                13,
                6,
                3,
                1
              ]
            },
            "default": [
              50,
              13,
              3,
              1
            ],
            "description": "Days-before-expiry alert tiers. The 50 day tier fires while a registrar transfer is still possible without forfeiting the renewal year."
          }
        }
      },
      "UpdateMonitorRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "checkInterval": {
            "type": "integer"
          },
          "timeout": {
            "type": "integer"
          },
          "method": {
            "$ref": "#/components/schemas/HTTPMethod"
          },
          "headers": {
            "type": "object"
          },
          "expectedStatus": {
            "type": "array",
            "items": {
              "type": "integer"
            }
          },
          "visualEnabled": {
            "type": "boolean"
          },
          "visualConfig": {
            "type": "object"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "domainExpiryEnabled": {
            "type": "boolean",
            "default": true,
            "description": "Domain registration expiry monitoring for this monitor's registrable domain. Available on every plan."
          },
          "domainAlertDays": {
            "type": "array",
            "items": {
              "type": "integer",
              "enum": [
                50,
                30,
                20,
                13,
                6,
                3,
                1
              ]
            },
            "default": [
              50,
              13,
              3,
              1
            ],
            "description": "Days-before-expiry alert tiers. The 50 day tier fires while a registrar transfer is still possible without forfeiting the renewal year."
          }
        }
      },
      "MonitorListResponse": {
        "type": "object",
        "description": "Paginated monitor list envelope, returned only when the request sends `Accept: application/json` and a `page` query parameter. The default (unpaginated) response is a bare array of Monitor objects.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Monitor"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "summary": {
            "$ref": "#/components/schemas/MonitorListSummary"
          }
        }
      },
      "MonitorListSummary": {
        "type": "object",
        "description": "Exact counts for the current scope/search/type/tags, independent of the selected status chip.",
        "required": ["total", "operational", "down", "degraded", "changed", "pending", "paused", "sites", "apis", "measured", "avgUptime"],
        "properties": {
          "total": { "type": "integer" },
          "operational": { "type": "integer" },
          "down": { "type": "integer" },
          "degraded": { "type": "integer" },
          "changed": { "type": "integer" },
          "pending": { "type": "integer" },
          "paused": { "type": "integer" },
          "sites": { "type": "integer" },
          "apis": { "type": "integer" },
          "measured": { "type": "integer" },
          "avgUptime": { "type": "number", "nullable": true }
        }
      },
      "CheckResult": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean"
          },
          "status": {
            "$ref": "#/components/schemas/MonitorStatus"
          },
          "responseTime": {
            "type": "integer"
          },
          "statusCode": {
            "type": "integer"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "UptimeResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "description": "Time-bucketed uptime data points.",
            "items": {
              "type": "object",
              "required": [
                "time",
                "uptime"
              ],
              "properties": {
                "time": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Start of the bucket (ISO 8601 UTC)."
                },
                "uptime": {
                  "type": "number",
                  "description": "Uptime percentage for this bucket (0-100)."
                }
              },
              "additionalProperties": true
            }
          },
          "regions": {
            "type": "array",
            "description": "Region codes included in the result set.",
            "items": {
              "type": "string"
            }
          },
          "meta": {
            "type": "object",
            "description": "Query metadata describing how the response was assembled.",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "preset",
                  "custom"
                ],
                "description": "Whether a preset window or a custom from/to range was used."
              },
              "granularity": {
                "type": "string",
                "enum": [
                  "minute",
                  "hour",
                  "day",
                  "week"
                ],
                "description": "Bucket size used for the returned data points."
              },
              "bucketSeconds": {
                "type": "integer",
                "description": "Duration of each bucket in seconds."
              },
              "from": {
                "type": "string",
                "format": "date-time",
                "description": "Effective start of the window (ISO 8601 UTC)."
              },
              "to": {
                "type": "string",
                "format": "date-time",
                "description": "Effective end of the window (ISO 8601 UTC)."
              },
              "clampedFrom": {
                "type": "boolean",
                "description": "True when the requested `from` was earlier than the oldest available data and was clamped forward."
              },
              "source": {
                "type": "string",
                "enum": [
                  "raw",
                  "daily",
                  "mixed"
                ],
                "description": "Storage tier the data was read from."
              }
            }
          }
        }
      },
      "ResponseTimeResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "description": "Time-bucketed response-time data points.",
            "items": {
              "type": "object",
              "required": [
                "time",
                "responseTime"
              ],
              "properties": {
                "time": {
                  "type": "string",
                  "format": "date-time",
                  "description": "Start of the bucket (ISO 8601 UTC)."
                },
                "responseTime": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Average response time for this bucket in milliseconds. Null when the bucket had no checks (e.g. monitor paused or no data in that window)."
                }
              },
              "additionalProperties": true
            }
          },
          "regions": {
            "type": "array",
            "description": "Region codes included in the result set.",
            "items": {
              "type": "string"
            }
          },
          "meta": {
            "type": "object",
            "description": "Query metadata describing how the response was assembled.",
            "properties": {
              "mode": {
                "type": "string",
                "enum": [
                  "preset",
                  "custom"
                ],
                "description": "Whether a preset window or a custom from/to range was used."
              },
              "granularity": {
                "type": "string",
                "enum": [
                  "minute",
                  "hour",
                  "day",
                  "week"
                ],
                "description": "Bucket size used for the returned data points."
              },
              "bucketSeconds": {
                "type": "integer",
                "description": "Duration of each bucket in seconds."
              },
              "from": {
                "type": "string",
                "format": "date-time",
                "description": "Effective start of the window (ISO 8601 UTC)."
              },
              "to": {
                "type": "string",
                "format": "date-time",
                "description": "Effective end of the window (ISO 8601 UTC)."
              },
              "clampedFrom": {
                "type": "boolean",
                "description": "True when the requested `from` was earlier than the oldest available data and was clamped forward."
              },
              "source": {
                "type": "string",
                "enum": [
                  "raw",
                  "daily",
                  "mixed"
                ],
                "description": "Storage tier the data was read from."
              }
            }
          }
        }
      },
      "VisualDataResponse": {
        "type": "object",
        "properties": {
          "baseline": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "capturedAt": {
                "type": "string",
                "format": "date-time"
              }
            }
          },
          "latest": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "capturedAt": {
                "type": "string",
                "format": "date-time"
              },
              "diffPercentage": {
                "type": "number"
              }
            }
          },
          "history": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "Server": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "hostname": {
            "type": "string"
          },
          "ipAddress": {
            "type": "string"
          },
          "os": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ONLINE",
              "OFFLINE",
              "UNKNOWN"
            ]
          },
          "lastSeenAt": {
            "type": "string",
            "format": "date-time"
          },
          "cpuUsage": {
            "type": "number"
          },
          "memoryUsage": {
            "type": "number"
          },
          "diskUsage": {
            "type": "number"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ServerListResponse": {
        "type": "object",
        "properties": {
          "servers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Server"
            }
          }
        }
      },
      "ServerMetricsResponse": {
        "type": "object",
        "properties": {
          "metrics": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "timestamp": {
                  "type": "string",
                  "format": "date-time"
                },
                "cpu": {
                  "type": "number"
                },
                "memory": {
                  "type": "number"
                },
                "disk": {
                  "type": "number"
                },
                "networkIn": {
                  "type": "number"
                },
                "networkOut": {
                  "type": "number"
                }
              }
            }
          },
          "summary": {
            "type": "object",
            "properties": {
              "avgCpu": {
                "type": "number"
              },
              "avgMemory": {
                "type": "number"
              },
              "avgDisk": {
                "type": "number"
              },
              "maxCpu": {
                "type": "number"
              },
              "maxMemory": {
                "type": "number"
              }
            }
          }
        }
      },
      "ServerAlertListResponse": {
        "type": "object",
        "properties": {
          "alerts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "SERVER_ALERT",
                    "SERVER_OFFLINE",
                    "SERVER_RECOVERY"
                  ]
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "INFO",
                    "WARNING",
                    "CRITICAL"
                  ]
                },
                "message": {
                  "type": "string"
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                }
              }
            }
          },
          "total": {
            "type": "integer"
          }
        }
      },
      "Alert": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "OPEN",
              "ACKNOWLEDGED",
              "RESOLVED"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "INFO",
              "WARNING",
              "CRITICAL"
            ]
          },
          "message": {
            "type": "string"
          },
          "monitorId": {
            "type": "string",
            "format": "uuid"
          },
          "acknowledgedAt": {
            "type": "string",
            "format": "date-time"
          },
          "resolvedAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "AlertListResponse": {
        "type": "object",
        "properties": {
          "alerts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Alert"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          }
        }
      },
      "AlertRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "condition": {
            "type": "string",
            "enum": [
              "response_time",
              "uptime",
              "status_change",
              "consecutive_failures",
              "ssl_expiry"
            ]
          },
          "threshold": {
            "type": "number"
          },
          "operator": {
            "type": "string",
            "enum": [
              "gt",
              "lt",
              "eq",
              "gte",
              "lte"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "INFO",
              "WARNING",
              "CRITICAL"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "monitorIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "channelIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateAlertRuleRequest": {
        "type": "object",
        "required": [
          "name",
          "condition",
          "threshold",
          "severity"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "condition": {
            "type": "string",
            "enum": [
              "response_time",
              "uptime",
              "status_change",
              "consecutive_failures",
              "ssl_expiry"
            ]
          },
          "threshold": {
            "type": "number"
          },
          "operator": {
            "type": "string",
            "enum": [
              "gt",
              "lt",
              "eq",
              "gte",
              "lte"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "INFO",
              "WARNING",
              "CRITICAL"
            ]
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "monitorIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          },
          "channelIds": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "AlertRuleListResponse": {
        "type": "object",
        "properties": {
          "alertRules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AlertRule"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          }
        }
      },
      "NotificationChannel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "EMAIL",
              "SLACK",
              "PAGERDUTY",
              "WEBHOOK",
              "SMS",
              "DISCORD",
              "TEAMS",
              "WHATSAPP",
              "TELEGRAM",
              "OPSGENIE",
              "PROMETHEUS",
              "PUSH"
            ]
          },
          "enabled": {
            "type": "boolean"
          },
          "config": {
            "type": "object",
            "description": "Channel-specific configuration"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "CreateNotificationChannelRequest": {
        "type": "object",
        "required": [
          "name",
          "type",
          "config"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100
          },
          "type": {
            "type": "string",
            "enum": [
              "EMAIL",
              "SLACK",
              "PAGERDUTY",
              "WEBHOOK",
              "SMS",
              "DISCORD",
              "TEAMS",
              "WHATSAPP",
              "TELEGRAM",
              "OPSGENIE",
              "PROMETHEUS",
              "PUSH"
            ]
          },
          "enabled": {
            "type": "boolean",
            "default": true
          },
          "config": {
            "type": "object",
            "description": "Channel-specific config. For EMAIL: {email}. For SLACK: {webhookUrl}. For DISCORD: {webhookUrl}. For TELEGRAM: {botToken, chatId}. For WEBHOOK: {url, secret}."
          }
        }
      },
      "Incident": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "investigating",
              "identified",
              "monitoring",
              "resolved",
              "postmortem"
            ]
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low"
            ]
          },
          "monitorId": {
            "type": "string",
            "format": "uuid"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time"
          },
          "resolvedAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "ApiKey": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "prefix": {
            "type": "string",
            "description": "First 8 characters of the key for identification"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "lastUsedAt": {
            "type": "string",
            "format": "date-time"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "Pagination": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "total": {
            "type": "integer"
          },
          "totalPages": {
            "type": "integer"
          },
          "hasMore": {
            "type": "boolean"
          },
          "hasPrevious": {
            "type": "boolean"
          }
        }
      }
    }
  },
  "security": [
    {
      "SessionAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ]
}
