{
  "components": {
    "schemas": {
      "ErrorResponse": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "retry_after": {
                "type": "integer"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          }
        },
        "required": [
          "error"
        ],
        "type": "object"
      },
      "IndexSnapshot": {
        "properties": {
          "changes_7d": {
            "type": "integer"
          },
          "history": {
            "enum": [
              "on",
              "off"
            ],
            "type": "string"
          },
          "providers": {
            "items": {
              "type": "object"
            },
            "type": "array"
          },
          "schema": {
            "const": "quantum-radar.index/v1",
            "type": "string"
          },
          "status": {
            "enum": [
              "live",
              "sweeping",
              "degraded",
              "stale"
            ],
            "type": "string"
          },
          "tally_failed": {
            "type": "integer"
          },
          "tally_kex_pqc": {
            "type": "integer"
          },
          "tally_sig_pqc": {
            "type": "integer"
          },
          "tally_total": {
            "type": "integer"
          },
          "tracked_since": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Read-only post-quantum cryptography (PQC) wire probe engine and live major-provider index. Ad-hoc public probes cache results in memory for 5 minutes and record bounded non-PII audit telemetry (timestamp, normalized public target, PQC verdict; zero client IPs). Client-side Inspect material never leaves the browser. The public tracked provider index persists history in SQLite WAL by default (pass --no-db to run diskless).",
    "title": "Quantum Radar API",
    "version": "1.1.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/badge.svg": {
      "get": {
        "parameters": [
          {
            "description": "Tracked provider slug (never triggers a probe).",
            "in": "query",
            "name": "provider",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Arbitrary host (cache-first, probes at most once within 3 s, otherwise returns Not probed).",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "image/svg+xml badge with ETag and Cache-Control"
          }
        },
        "summary": "Compact 20 px SVG readiness badge for READMEs"
      }
    },
    "/api/changes": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Cursor ID returned as next_before by the previous page.",
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Filter by tracked provider slug.",
            "in": "query",
            "name": "provider",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "enum": [
                "state",
                "alg",
                "surface"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Chronological confirmed transitions with cursor pagination."
          }
        },
        "summary": "Confirmed posture transitions for tracked providers"
      }
    },
    "/api/domain": {
      "get": {
        "description": "Discovers active public subdomains via redundant Certificate Transparency logs (CertSpotter + crt.sh), probes all resolved A and AAAA edges concurrently, detects mixed-edge PQC drift, Chrome 2027-03-15 ECDSA P-256 CA chains, and >100-day certificate lifetimes.",
        "parameters": [
          {
            "description": "Public root DNS domain (e.g. fireworks.ai).",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "max_hosts",
            "required": false,
            "schema": {
              "default": 48,
              "maximum": 128,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "ssh",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "fresh",
            "required": false,
            "schema": {
              "default": false,
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Domain-wide CT discovery and multi-IP redundancy audit JSON."
          },
          "400": {
            "description": "Missing or non-public domain name."
          },
          "429": {
            "description": "Rate limit exceeded."
          }
        },
        "summary": "Certificate Transparency subdomain discovery and multi-IP redundancy audit"
      }
    },
    "/api/events": {
      "get": {
        "description": "Emits snapshot, sweep-start, provider, transition, and sweep-end SSE events.",
        "responses": {
          "200": {
            "description": "text/event-stream"
          }
        },
        "summary": "Server-Sent Events stream for live index updates"
      }
    },
    "/api/history": {
      "get": {
        "parameters": [
          {
            "description": "Lookback window in days. Resolution is chosen automatically (5m <= 2d, 1h <= 30d, 1d > 30d).",
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 365,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Time-series adoption snapshots (or history=off when --db is not set)."
          }
        },
        "summary": "Aggregate PQC adoption history over time"
      }
    },
    "/api/index": {
      "get": {
        "description": "Returns the latest snapshot of all tracked providers, sweep status, PQC tallies, history availability, and 7-day confirmed change count.",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndexSnapshot"
                }
              }
            },
            "description": "Current index snapshot"
          }
        },
        "summary": "Live major-provider PQC index"
      }
    },
    "/api/openapi.json": {
      "get": {
        "responses": {
          "200": {
            "description": "application/json"
          }
        },
        "summary": "This OpenAPI 3.1.0 specification"
      }
    },
    "/api/probe": {
      "get": {
        "description": "Performs read-only TLS 1.3 ML-KEM group probes, X.509 chain inspection, SSH KEXINIT + host-key fingerprint check, and OIDC/JWKS/JOSE discovery. Cached in memory for 5 minutes; completed public checks write a non-PII audit entry (timestamp, normalized target, PQC verdict; 90-day retention).",
        "parameters": [
          {
            "description": "Domain, URL, host:port, or ssh://host:22.",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Set to 1 to bypass the 5-minute in-memory cache (rate-limited to once per 30 s per target).",
            "in": "query",
            "name": "fresh",
            "required": false,
            "schema": {
              "enum": [
                0,
                1
              ],
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "ProbeReport JSON"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Invalid target"
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Private or loopback address blocked"
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "DNS resolution failed"
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Rate limit exceeded (includes Retry-After header)"
          }
        },
        "summary": "Live read-only PQC wire probe (JSON)"
      }
    },
    "/api/probe/stream": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "fresh",
            "required": false,
            "schema": {
              "enum": [
                0,
                1
              ],
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/event-stream emitting stage, report, or probe-error events."
          }
        },
        "summary": "Streaming wire probe with live per-stage SSE progress"
      }
    },
    "/api/providers/{id}": {
      "get": {
        "parameters": [
          {
            "description": "Provider slug (e.g. github, aws, cloudflare) or tracked hostname.",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Provider detail, latest full ProbeReport, sweep stats, and confirmed transitions."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            },
            "description": "Unknown provider slug"
          }
        },
        "summary": "Tracked provider detail, cached report and change history"
      }
    },
    "/api/report.md": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "fresh",
            "required": false,
            "schema": {
              "enum": [
                0,
                1
              ],
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "text/markdown report"
          }
        },
        "summary": "GitHub-flavored Markdown PQC report"
      }
    }
  }
}