{
  "openapi": "3.1.0",
  "info": {
    "title": "WhatsDownNow API",
    "version": "1.4.0",
    "summary": "Live outage status for popular services, and outage alerts for the services in your stack.",
    "description": "Read endpoints are public and need no key. Alert stacks are anonymous: creating one returns a management token (shown once) used as a Bearer token. Verdicts combine official status pages with our own HTTP checks; they can lag or be wrong. Not affiliated with any listed service.\n\nAlso available as a remote MCP server at https://whatsdownnow.com/mcp (Streamable HTTP). AI agents setting up alerts for a user: see https://whatsdownnow.com/agents.",
    "contact": {
      "url": "https://whatsdownnow.com/developers"
    }
  },
  "servers": [
    {
      "url": "https://whatsdownnow.com"
    }
  ],
  "externalDocs": {
    "url": "https://whatsdownnow.com/developers"
  },
  "tags": [
    {
      "name": "Status"
    },
    {
      "name": "AI",
      "description": "AI API provider health, fallbacks, and probe history"
    },
    {
      "name": "Stacks",
      "description": "Outage alerts for a set of services"
    },
    {
      "name": "Requests",
      "description": "Ask us to start monitoring a service we do not track yet"
    },
    {
      "name": "Reports",
      "description": "Agent and client issue reports"
    }
  ],
  "paths": {
    "/api/v1/services": {
      "get": {
        "tags": [
          "Status"
        ],
        "operationId": "listServices",
        "summary": "List monitored services",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "AI",
                "Developer & Cloud",
                "Work & Productivity",
                "Google",
                "Microsoft",
                "Apple",
                "Social & Streaming",
                "Money & Shopping",
                "Gaming",
                "Home & Security",
                "Banks & Investing",
                "Internet & Phone",
                "Travel & Delivery"
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string",
              "maxLength": 80
            },
            "description": "Find a service by name, e.g. openai, google cloud, chase (returns best matches)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "services": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ServiceInfo"
                      }
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/status": {
      "get": {
        "tags": [
          "Status"
        ],
        "operationId": "getAllStatus",
        "summary": "Status of all services, or a readiness check for a set",
        "description": "With `slugs`, returns a readiness summary for just those services (overall = worst verdict).",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "AI",
                "Developer & Cloud",
                "Work & Productivity",
                "Google",
                "Microsoft",
                "Apple",
                "Social & Streaming",
                "Money & Shopping",
                "Gaming",
                "Home & Security",
                "Banks & Investing",
                "Internet & Phone",
                "Travel & Delivery"
              ]
            }
          },
          {
            "name": "slugs",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated slugs, e.g. chatgpt,claude,aws,stripe",
            "examples": {
              "ai": {
                "value": "chatgpt,claude,aws,stripe"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/StatusList"
                    },
                    {
                      "$ref": "#/components/schemas/Readiness"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/status/{slug}": {
      "get": {
        "tags": [
          "Status"
        ],
        "operationId": "getStatus",
        "summary": "Status of one service",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "examples": [
                "chatgpt"
              ]
            },
            "description": "Service slug or common name (see /api/v1/services?q=)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Status"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/incidents/{slug}": {
      "get": {
        "tags": [
          "Status"
        ],
        "operationId": "listIncidents",
        "summary": "Recent incidents and verdict changes",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "examples": [
                "chatgpt"
              ]
            },
            "description": "Service slug or common name (see /api/v1/services?q=)"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Incidents"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/services/{slug}/history": {
      "get": {
        "tags": [
          "Status",
          "AI"
        ],
        "operationId": "getServiceHistory",
        "summary": "Uptime and probe-latency history",
        "description": "Uptime percent (time our verdict was up), incident count, and p50/p95 of our HTTP probe of the public website, API or status page. This is not model inference latency. days must be 7 or 30. The observed window may be shorter if monitoring started recently.",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "examples": [
                "chatgpt"
              ]
            },
            "description": "Service slug or common name (see /api/v1/services?q=)"
          },
          {
            "name": "days",
            "in": "query",
            "schema": {
              "type": "integer",
              "enum": [
                7,
                30
              ],
              "default": 7
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceHistory"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/health": {
      "get": {
        "tags": [
          "AI"
        ],
        "operationId": "getAiHealth",
        "summary": "AI API provider board and healthy fallbacks",
        "description": "Current status of interchangeable AI API providers we already track, plus recommended_fallbacks (currently healthy alternatives). See also https://whatsdownnow.com/ai.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiHealth"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/ai/fallback": {
      "get": {
        "tags": [
          "AI"
        ],
        "operationId": "getAiFallback",
        "summary": "Healthy alternatives for one AI provider",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "examples": [
                "chatgpt"
              ]
            },
            "description": "Slug or common name, e.g. chatgpt, openai, claude"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiFallback"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/reports": {
      "post": {
        "tags": [
          "Reports"
        ],
        "operationId": "reportIssue",
        "summary": "Report an error your agent or app just hit",
        "description": "Rate-limited and deduplicated per network. Also counts toward user-report alert thresholds. Several distinct sources in a 30-minute window set agent_reported_spike on the service.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "error_type"
                ],
                "properties": {
                  "slug": {
                    "type": "string"
                  },
                  "service": {
                    "type": "string"
                  },
                  "error_type": {
                    "type": "string",
                    "enum": [
                      "5xx",
                      "timeout",
                      "rate_limit",
                      "auth",
                      "network",
                      "other"
                    ]
                  },
                  "model": {
                    "type": "string"
                  },
                  "region": {
                    "type": "string"
                  },
                  "detail": {
                    "type": "string",
                    "maxLength": 200
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Duplicate or limited",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentReport"
                }
              }
            }
          },
          "201": {
            "description": "Recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentReport"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/service-requests": {
      "post": {
        "tags": [
          "Requests"
        ],
        "operationId": "requestService",
        "summary": "Request a service be added",
        "description": "Votes for the same normalized name are counted together. If the name already matches a tracked service, the live slug is returned. Optional email is stored only if given and is confirmed with a double opt-in link; never used for marketing.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 80
                  },
                  "url": {
                    "type": "string",
                    "maxLength": 200
                  },
                  "email": {
                    "type": "string"
                  },
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Already tracked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceRequest"
                }
              }
            }
          },
          "201": {
            "description": "Recorded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServiceRequest"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/service-requests/top": {
      "get": {
        "tags": [
          "Requests"
        ],
        "operationId": "topServiceRequests",
        "summary": "Most-requested service names (names and vote counts only)",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "requests": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "votes": {
                            "type": "integer"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stacks": {
      "post": {
        "tags": [
          "Stacks"
        ],
        "operationId": "createStack",
        "summary": "Create an alert stack",
        "description": "Rate limited to 5/hour and 20/day per network. Email addresses get a double opt-in confirmation email and receive nothing until confirmed.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StackInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created. `token` is shown only once.",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Stack"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "token": {
                          "type": "string",
                          "description": "Management token, shown once"
                        },
                        "manage_link": {
                          "type": "string",
                          "description": "Private link that opens the stack in a browser (token in the URL fragment). Shown once; keep private."
                        }
                      },
                      "required": [
                        "token",
                        "manage_link"
                      ]
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stacks/{id}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^stk_[a-z0-9]+$"
          }
        }
      ],
      "get": {
        "tags": [
          "Stacks"
        ],
        "operationId": "getStack",
        "summary": "Read a stack",
        "security": [
          {
            "stackToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Stack"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "Stacks"
        ],
        "operationId": "updateStack",
        "summary": "Update a stack",
        "description": "Fields present are changed. `services`, `webhooks` and `emails` replace their lists (existing webhooks keep their signing secret). `push_subscriptions` are added/refreshed.",
        "security": [
          {
            "stackToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StackPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Stack"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Stacks"
        ],
        "operationId": "deleteStack",
        "summary": "Delete a stack",
        "security": [
          {
            "stackToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stacks/{id}/test": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^stk_[a-z0-9]+$"
          }
        }
      ],
      "post": {
        "tags": [
          "Stacks"
        ],
        "operationId": "testStack",
        "summary": "Send a test alert to every active channel now",
        "security": [
          {
            "stackToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Per-channel results",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "event_id": {
                      "type": "string"
                    },
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stacks/{id}/rotate-key": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^stk_[a-z0-9]+$"
          }
        }
      ],
      "post": {
        "tags": [
          "Stacks"
        ],
        "operationId": "rotateStackKey",
        "summary": "Reset a stack's manage link",
        "description": "Replace the stack's management token. The previous token and manage_link stop working immediately. The new token and manage_link are returned once. Counts toward the stack's daily change limit (40/day). The stack and its alerts are otherwise unchanged.",
        "security": [
          {
            "stackToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "New token and manage_link, shown only once.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "token": {
                      "type": "string",
                      "description": "New management token, shown once"
                    },
                    "manage_link": {
                      "type": "string",
                      "description": "New private manage link (token in the URL fragment). Shown once; keep private."
                    },
                    "token_note": {
                      "type": "string"
                    },
                    "manage_link_note": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "token",
                    "manage_link"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stacks/{id}/push": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^stk_[a-z0-9]+$"
          }
        }
      ],
      "post": {
        "tags": [
          "Stacks"
        ],
        "operationId": "addPushSubscription",
        "summary": "Add a browser PushSubscription (from PushManager.subscribe)",
        "security": [
          {
            "stackToken": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushSubscription"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Added"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/stacks/{id}/channels/{channelId}": {
      "parameters": [
        {
          "name": "id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string",
            "pattern": "^stk_[a-z0-9]+$"
          }
        },
        {
          "name": "channelId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "tags": [
          "Stacks"
        ],
        "operationId": "deleteChannel",
        "summary": "Remove one channel",
        "security": [
          {
            "stackToken": []
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted"
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/push/vapid-public-key": {
      "get": {
        "tags": [
          "Stacks"
        ],
        "operationId": "getVapidKey",
        "summary": "VAPID public key for PushManager.subscribe",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "public_key": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {
    "alert": {
      "post": {
        "summary": "Alert delivered to your webhook URL",
        "description": "Headers: `X-WDN-Event`, `X-WDN-Delivery`, `X-WDN-Timestamp`, `X-WDN-Signature: t=<unix>,v1=<hex>` where v1 = HMAC-SHA256(signing_secret, `<t>.<raw body>`). Reject if the timestamp is more than 5 minutes old. Respond 2xx within 8 s. Failed deliveries are retried after ~5, 15, 30, 60, 120 minutes (6 attempts); a channel is disabled after 15 consecutive failures or an HTTP 410. Slack and Discord incoming-webhook URLs receive their native message format instead.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Acknowledged"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "stackToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Current management token for the stack (wdn_...), returned when it was created or last rotated."
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ]
      },
      "ServiceRequest": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "already_tracked": {
            "type": "boolean"
          },
          "slug": {
            "type": "string"
          },
          "status_url": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          },
          "votes": {
            "type": "integer"
          },
          "created": {
            "type": "boolean"
          },
          "email_status": {
            "type": "string",
            "enum": [
              "none",
              "pending",
              "already",
              "capped",
              "unconfigured"
            ]
          }
        },
        "required": [
          "ok",
          "name",
          "votes",
          "created"
        ]
      },
      "Verdict": {
        "type": "string",
        "enum": [
          "up",
          "degraded",
          "down",
          "unknown"
        ]
      },
      "ServiceInfo": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "official_status_page": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "Status": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string"
          },
          "verdict": {
            "$ref": "#/components/schemas/Verdict"
          },
          "summary": {
            "type": [
              "string",
              "null"
            ]
          },
          "official": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "level": {
                "type": "string",
                "enum": [
                  "ok",
                  "maintenance",
                  "minor",
                  "major",
                  "unknown"
                ]
              },
              "text": {
                "type": "string"
              },
              "affected": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "probe": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "ok": {
                "type": "boolean"
              },
              "http_status": {
                "type": "integer"
              },
              "ms": {
                "type": "integer"
              }
            }
          },
          "user_reports_last_hour": {
            "type": "integer"
          },
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "status_url": {
            "type": "string"
          },
          "official_status_page": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "StatusList": {
        "type": "object",
        "properties": {
          "generated_at": {
            "type": "string",
            "format": "date-time"
          },
          "counts": {
            "type": "object"
          },
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Status"
            }
          }
        }
      },
      "Readiness": {
        "type": "object",
        "properties": {
          "overall": {
            "$ref": "#/components/schemas/Verdict"
          },
          "ready": {
            "type": "boolean"
          },
          "summary": {
            "type": "string"
          },
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Status"
            }
          },
          "generated_at": {
            "type": "string"
          }
        }
      },
      "Incidents": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "current": {
            "$ref": "#/components/schemas/Verdict"
          },
          "official_incidents": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "verdict_changes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "at": {
                  "type": "string"
                },
                "verdict": {
                  "$ref": "#/components/schemas/Verdict"
                },
                "why": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "Rule": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string"
          },
          "on_down": {
            "type": "boolean",
            "default": true
          },
          "degraded_minutes": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 0,
            "maximum": 1440,
            "default": 15,
            "description": "Alert when degraded or down for at least N minutes; null = off"
          },
          "reports_per_hour": {
            "type": [
              "integer",
              "null"
            ],
            "minimum": 1,
            "default": null,
            "description": "Alert at N user reports in the last hour; null = off"
          }
        },
        "required": [
          "slug"
        ]
      },
      "StackInput": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 80
          },
          "services": {
            "type": "array",
            "maxItems": 90,
            "items": {
              "oneOf": [
                {
                  "type": "string"
                },
                {
                  "$ref": "#/components/schemas/Rule"
                }
              ]
            },
            "description": "Slugs (use `defaults`) or per-service rules"
          },
          "defaults": {
            "type": "object",
            "properties": {
              "on_down": {
                "type": "boolean"
              },
              "degraded_minutes": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "reports_per_hour": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "notify_recovery": {
            "type": "boolean",
            "default": true
          },
          "webhooks": {
            "type": "array",
            "maxItems": 5,
            "items": {
              "oneOf": [
                {
                  "type": "string",
                  "format": "uri"
                },
                {
                  "type": "object",
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "json",
                        "slack",
                        "discord"
                      ]
                    }
                  },
                  "required": [
                    "url"
                  ]
                }
              ]
            }
          },
          "emails": {
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "string",
              "format": "email"
            }
          },
          "push_subscriptions": {
            "type": "array",
            "maxItems": 10,
            "items": {
              "$ref": "#/components/schemas/PushSubscription"
            }
          }
        },
        "required": [
          "services"
        ],
        "examples": [
          {
            "name": "AI startup stack",
            "services": [
              "chatgpt",
              "claude",
              "gemini",
              "aws",
              "vercel",
              "supabase",
              "stripe",
              "cloudflare",
              "github"
            ],
            "defaults": {
              "degraded_minutes": 15
            },
            "webhooks": [
              "https://example.com/hooks/outages"
            ]
          }
        ]
      },
      "StackPatch": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "services": {
            "type": "array"
          },
          "defaults": {
            "type": "object"
          },
          "notify_recovery": {
            "type": "boolean"
          },
          "webhooks": {
            "type": "array"
          },
          "emails": {
            "type": "array"
          },
          "push_subscriptions": {
            "type": "array"
          }
        }
      },
      "PushSubscription": {
        "type": "object",
        "properties": {
          "endpoint": {
            "type": "string"
          },
          "keys": {
            "type": "object",
            "properties": {
              "p256dh": {
                "type": "string"
              },
              "auth": {
                "type": "string"
              }
            },
            "required": [
              "p256dh",
              "auth"
            ]
          }
        },
        "required": [
          "endpoint",
          "keys"
        ]
      },
      "Stack": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "notify_recovery": {
            "type": "boolean"
          },
          "services": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "channels": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "webhook channels include `signing_secret`"
          },
          "recent_deliveries": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "AlertPayload": {
        "type": "object",
        "properties": {
          "event": {
            "type": "string",
            "enum": [
              "alert.triggered",
              "alert.recovered",
              "alert.test"
            ]
          },
          "event_id": {
            "type": "string"
          },
          "delivery_id": {
            "type": "string"
          },
          "attempt": {
            "type": "integer"
          },
          "stack": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          },
          "service": {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "category": {
                "type": "string"
              },
              "status_url": {
                "type": "string"
              },
              "official_status_page": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          },
          "verdict": {
            "type": "object",
            "properties": {
              "old": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "new": {
                "type": "string"
              }
            }
          },
          "reason": {
            "type": "string"
          },
          "why": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_reports_last_hour": {
            "type": "integer"
          },
          "occurred_at": {
            "type": "string",
            "format": "date-time"
          },
          "checked_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "incident_started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "payload_version": {
            "type": "integer",
            "enum": [
              1,
              2
            ]
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "Same instant as incident_started_at"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "major",
              "minor",
              "info"
            ]
          },
          "source": {
            "type": "string",
            "enum": [
              "official",
              "probe",
              "reports",
              "mixed"
            ]
          },
          "component": {
            "type": [
              "string",
              "null"
            ]
          },
          "model": {
            "type": [
              "string",
              "null"
            ]
          },
          "suggested_fallbacks": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "slug": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "verdict": {
                  "type": "string"
                },
                "status_url": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "ServiceHistory": {
        "type": "object",
        "additionalProperties": true,
        "description": "Uptime, incident count, probe p50/p95, with latency_note"
      },
      "AiHealth": {
        "type": "object",
        "additionalProperties": true
      },
      "AiFallback": {
        "type": "object",
        "additionalProperties": true
      },
      "AgentReport": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "error_type": {
            "type": "string"
          },
          "user_reports_last_hour": {
            "type": "integer"
          },
          "agent_reports_last_hour": {
            "type": "integer"
          },
          "agent_reported_spike": {
            "type": "boolean"
          }
        }
      }
    }
  }
}