{
  "openapi": "3.1.0",
  "info": {
    "title": "Jack Went vulnerability feed API",
    "version": "1.0.0",
    "description": "The latest security advisories and news from Zero Day Initiative, NCSC, F5 Labs, r/netsec, r/sysadmin and Hacker News, merged into one JSON feed and refreshed every 15 minutes. Read-only, no authentication.",
    "contact": { "name": "Jack Went", "email": "info@jackwent.co.uk", "url": "https://jackwent.co.uk/get-in-touch/" }
  },
  "servers": [{ "url": "https://jackwent.co.uk" }],
  "externalDocs": { "description": "Vulnerability feeds page", "url": "https://jackwent.co.uk/vulnerability-feeds-zero-days/#use-the-feed-in-your-own-tools" },
  "paths": {
    "/api/feeds": {
      "get": {
        "operationId": "getFeeds",
        "summary": "Latest items from all sources, newest first",
        "responses": {
          "200": {
            "description": "The current feed snapshot",
            "headers": { "Cache-Control": { "schema": { "type": "string" }, "description": "public, max-age=60" } },
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Feed" } } }
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "operationId": "health",
        "summary": "Service health check",
        "responses": { "200": { "description": "The service is up", "content": { "text/plain": { "schema": { "type": "string", "const": "ok" } } } } }
      }
    }
  },
  "components": {
    "schemas": {
      "Feed": {
        "type": "object",
        "required": ["updated", "sources", "items"],
        "properties": {
          "updated": { "type": ["string", "null"], "format": "date-time", "description": "When at least one source last refreshed successfully" },
          "sources": { "type": "array", "items": { "$ref": "#/components/schemas/Source" } },
          "items": { "type": "array", "items": { "$ref": "#/components/schemas/Item" } }
        }
      },
      "Source": {
        "type": "object",
        "required": ["id", "name", "ok", "count"],
        "properties": {
          "id": { "type": "string", "enum": ["zdi", "ncsc", "f5", "netsec", "sysadmin", "hn"] },
          "name": { "type": "string" },
          "ok": { "type": "boolean", "description": "Whether the last fetch of this source succeeded (on failure the previous items are kept)" },
          "count": { "type": "integer" },
          "fetchedAt": { "type": ["string", "null"], "format": "date-time" }
        }
      },
      "Item": {
        "type": "object",
        "required": ["source", "title", "link"],
        "properties": {
          "source": { "type": "string", "enum": ["zdi", "ncsc", "f5", "netsec", "sysadmin", "hn"] },
          "title": { "type": "string" },
          "link": { "type": "string", "format": "uri" },
          "date": { "type": ["string", "null"], "format": "date-time" }
        }
      }
    }
  }
}
