{
  "openapi": "3.0.3",
  "info": {
    "title": "Leviathan Exposure Intelligence API",
    "description": "Internet exposure intelligence: 58.1M records across exposure telemetry, credential-exposure records, open-server file listings and CVE correlations, partitioned across 5 regions (US, CN, GB, VN, WIN). Query by IP, CIDR, ASN, port, CVE, product, title, org, country, credential exposure, passive DNS, reverse IP, VIN or free text. Derived data only: masked secrets, never raw payloads.",
    "version": "1.6.0",
    "contact": {
      "email": "admin@leviathan.ac"
    },
    "license": {
      "name": "Proprietary, see leviathan.ac/api for terms"
    }
  },
  "externalDocs": {
    "description": "Developer docs",
    "url": "https://leviathan.ac/api/docs/"
  },
  "servers": [
    {
      "url": "https://api.leviathan.ac",
      "description": "production"
    },
    {
      "url": "https://api.leviathan.ac/v1",
      "description": "production (versioned alias)"
    }
  ],
  "tags": [
    {
      "name": "public",
      "description": "Open endpoints, no key required"
    },
    {
      "name": "search",
      "description": "Keyed endpoints. Free tier 100/day, Day Pass 1,000 per 24h, Pro 10,000/day. Paid tiers add deep host lookups, the open file vault, and CSV/PDF export."
    },
    {
      "name": "enrichment",
      "description": "CVE details and deep host lookups"
    },
    {
      "name": "account",
      "description": "Key provisioning and purchase verification"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      }
    },
    "parameters": {
      "region": {
        "name": "region",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "us",
            "cn",
            "gb",
            "vn",
            "win"
          ]
        },
        "description": "Scope results to one region. Omit for all regions."
      },
      "limit": {
        "name": "limit",
        "in": "query",
        "required": false,
        "schema": {
          "type": "integer",
          "minimum": 1,
          "maximum": 1000,
          "default": 100
        }
      },
      "tier": {
        "name": "tier",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "critical",
            "high",
            "medium",
            "low"
          ]
        },
        "description": "Comma-separated risk-tier filter, e.g. tier=critical,high"
      }
    },
    "schemas": {
      "Record": {
        "type": "object",
        "properties": {
          "ip": {
            "type": "string"
          },
          "asn": {
            "type": "string"
          },
          "asn_org": {
            "type": "string"
          },
          "isp": {
            "type": "string"
          },
          "port": {
            "type": "string"
          },
          "service_class": {
            "type": "string",
            "example": "web_tls"
          },
          "product": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "risk_flags": {
            "type": "string",
            "example": "db_exposed"
          },
          "hostname": {
            "type": "string"
          },
          "registered_domain": {
            "type": "string"
          },
          "city": {
            "type": "string"
          },
          "region": {
            "type": "string",
            "description": "records region: us|cn|gb|vn|win"
          },
          "country": {
            "type": "string"
          },
          "ssl_present": {
            "type": "string"
          },
          "ssl_issuer": {
            "type": "string"
          },
          "ssl_expiry": {
            "type": "string"
          },
          "first_seen": {
            "type": "string"
          },
          "last_seen": {
            "type": "string"
          },
          "cpe23": {
            "type": "string",
            "description": "semicolon-separated CPE 2.3 entries, version-pinned"
          },
          "cves": {
            "type": "string",
            "description": "semicolon-separated CVE ids, top 5 by CVSS"
          },
          "max_cvss": {
            "type": "string",
            "example": "8.7"
          },
          "cve_count": {
            "type": "string"
          },
          "os": {
            "type": "string"
          },
          "tags": {
            "type": "string",
            "description": "semicolon-separated perimeter tags (may include honeypot)"
          },
          "components": {
            "type": "string",
            "description": "semicolon-separated tech stack"
          },
          "http_title": {
            "type": "string"
          },
          "http_server": {
            "type": "string"
          },
          "http_status": {
            "type": "string"
          },
          "banner_flags": {
            "type": "string",
            "description": "derived signals: phpinfo_exposed, dir_listing, default_page, login_page, db_error, php_error, honeypot_tag"
          },
          "asn_type": {
            "type": "string",
            "enum": [
              "enterprise",
              "cloud",
              "isp",
              "cdn",
              "hosting",
              "education",
              "government",
              "other"
            ]
          },
          "ip_type": {
            "type": "string"
          },
          "risk_score": {
            "type": "string",
            "description": "0-100"
          },
          "risk_tier": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low"
            ]
          }
        }
      },
      "SearchResponse": {
        "type": "object",
        "properties": {
          "query": {
            "type": "object",
            "example": {
              "port": "3389"
            }
          },
          "region": {
            "type": "string"
          },
          "total": {
            "type": "integer"
          },
          "returned": {
            "type": "integer"
          },
          "truncated": {
            "type": "boolean"
          },
          "quota": {
            "type": "object",
            "properties": {
              "used": {
                "type": "integer"
              },
              "limit": {
                "type": "integer"
              }
            }
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Record"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "requestId": {
            "type": "string",
            "description": "present on 404/500, quote it when contacting support"
          },
          "hint": {
            "type": "string"
          },
          "upgrade": {
            "type": "string"
          }
        }
      }
    }
  },
  "paths": {
    "/": {
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Service info: per-region record counts, tiers, endpoints",
        "security": [],
        "responses": {
          "200": {
            "description": "Service metadata"
          }
        }
      }
    },
    "/stats/risk-distribution": {
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Risk-tier distribution (optionally per region)",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/region"
          }
        ],
        "responses": {
          "200": {
            "description": "Tier counts"
          }
        }
      }
    },
    "/stats/top-asns": {
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Top 20 ASN organizations by record count",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/region"
          }
        ],
        "responses": {
          "200": {
            "description": "ASN list"
          }
        }
      }
    },
    "/stats/top-ports": {
      "get": {
        "tags": [
          "public"
        ],
        "summary": "Top 20 ports by record count",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/region"
          }
        ],
        "responses": {
          "200": {
            "description": "Port list"
          }
        }
      }
    },
    "/search/ip/{ip}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "All exposed services for one IP",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "1.2.3.4"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing key"
          },
          "403": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/asn/{asn}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "All records for one ASN (with or without AS prefix)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "asn",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "15169"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/port/{port}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "All records for one port, risk-score descending",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "port",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "3389"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/cve/{cve_id}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "All hosts in the records carrying this CVE",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cve_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CVE-2023-44487"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Affected hosts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          }
        }
      }
    },
    "/cve/{cve_id}": {
      "get": {
        "tags": [
          "enrichment"
        ],
        "summary": "CVE details from the Leviathan vulnerability index (nightly NVD sync, daily EPSS, CISA KEV), with live upstream fallback + backfill on first sight",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cve_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "CVE-2023-44487"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "CVE details"
          },
          "502": {
            "description": "Upstream lookup failed"
          }
        }
      }
    },
    "/deep/host/{ip}": {
      "get": {
        "tags": [
          "enrichment"
        ],
        "summary": "Deep host lookup: unified multi-port host dossier: all ports, honeyscore, services, CVEs (paid tiers only, 100 live fetches/day, 7-day cache)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Host intelligence"
          },
          "403": {
            "description": "Paid tiers only"
          },
          "429": {
            "description": "Deep quota exceeded"
          }
        }
      }
    },
    "/signup": {
      "post": {
        "tags": [
          "account"
        ],
        "summary": "Self-service free API key (100 queries/day)",
        "security": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string"
                  },
                  "website": {
                    "type": "string",
                    "description": "honeypot, leave empty"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Key created (or existing key returned)"
          },
          "429": {
            "description": "Signup limit reached (3/day per IP)"
          }
        }
      }
    },
    "/search/cidr/{cidr}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "All exposed services inside a CIDR block (IPv4/IPv6)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cidr",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "45.32.0.0/16"
            },
            "description": "CIDR notation, e.g. 45.32.0.0/16, note the slash is path-encoded as %2F"
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Matches",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing key"
          },
          "403": {
            "description": "Invalid key"
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/stats/summary": {
      "get": {
        "tags": [
          "stats"
        ],
        "summary": "Full totals: records, regions, risk tiers, unique hosts/ASNs/domains, ticker ingestion sources",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/stats/live-feed": {
      "get": {
        "tags": [
          "stats"
        ],
        "summary": "Live intercept feed: masked telemetry, credential, KEV and C2 events",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/host/{ip}": {
      "get": {
        "tags": [
          "host"
        ],
        "summary": "Unified Host Dossier: all open ports, hostnames, PTR, CVEs, services for one IP",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "43.166.167.133"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/rdns/{ip}": {
      "get": {
        "tags": [
          "dns"
        ],
        "summary": "Reverse DNS (PTR): socket + Cloudflare DoH",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "43.166.167.133"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/threats/c2": {
      "get": {
        "tags": [
          "threats"
        ],
        "summary": "Live C2 / APT tracker (Cobalt Strike, Metasploit, Sliver, Mythic, Havoc)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "framework",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "cobalt"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/c2/{framework}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "Search active C2 infrastructure",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "framework",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "cobalt"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/product/{product}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "Hosts running a product (substring)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "product",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "nginx"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/org/{org}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "Hosts by ASN organization or ISP",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "Aliyun"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/country/{cc}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "Hosts by 2-letter country code",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "cc",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "US"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/title/{text}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "Hosts by HTTP title",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "text",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "login"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/search/q/{text}": {
      "get": {
        "tags": [
          "search"
        ],
        "summary": "Free-text across product, title, server, tags, org, domain, hostname",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "text",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "hikvision"
            }
          },
          {
            "$ref": "#/components/parameters/region"
          },
          {
            "$ref": "#/components/parameters/limit"
          },
          {
            "$ref": "#/components/parameters/tier"
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/breach/{kind}/{value}": {
      "get": {
        "tags": [
          "exposure"
        ],
        "summary": "Credential exposure search (masked secrets only)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "kind",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "email",
                "domain",
                "username",
                "phone",
                "ip",
                "name"
              ],
              "example": "email"
            }
          },
          {
            "name": "value",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "andy@mightypenguin.co.uk"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/dns/domain/{domain}": {
      "get": {
        "tags": [
          "dns"
        ],
        "summary": "Passive DNS: subdomains + records for a domain",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "domain",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "example.com"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/dns/reverse": {
      "get": {
        "tags": [
          "dns"
        ],
        "summary": "Passive DNS reverse: hostnames for ?ip=",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ip",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "43.166.167.133"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/dns/resolve": {
      "get": {
        "tags": [
          "dns"
        ],
        "summary": "Live DNS resolve for ?host=",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "host",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "example": "example.com"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/reverse-ip/{ip}": {
      "get": {
        "tags": [
          "dns"
        ],
        "summary": "Co-hosted domains (records + PTR + HackerTarget)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "43.166.167.133"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/vin/{vin}": {
      "get": {
        "tags": [
          "tools"
        ],
        "summary": "VIN decoder (NHTSA vPIC)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "vin",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "1HGCM82633A004352"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/ghw": {
      "get": {
        "tags": [
          "exposure"
        ],
        "summary": "Open file vault: 8.58M+ (live count in /stats/summary) indexed open server/FTP files (operator tiers)",
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "backup.sql"
            }
          },
          {
            "name": "host",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "example": "192.0.2.1"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResponse"
                }
              }
            }
          },
          "429": {
            "description": "Daily quota exceeded"
          }
        }
      }
    },
    "/v1/export": {
      "get": {
        "summary": "CSV/PDF export from the index (paid tiers only, 5/day/key)",
        "description": "Runs a scoped query against the index and returns a 1h presigned S3 URL. Scope by risk tier (critical), CVSS floor (kev), misconfiguration flags (misconfig), port (rdp, redis, adb, mqtt, winrm) or region. Paid tiers only (Day Pass, Pro): 5 exports per day per key, consumed only on success.",
        "tags": [
          "export"
        ],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "csv",
                "pdf"
              ],
              "default": "csv"
            },
            "description": "Output format. CSV streams raw rows, PDF renders a top-500 risk summary."
          },
          {
            "name": "scope",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "critical",
                "kev",
                "misconfig",
                "rdp",
                "redis",
                "adb",
                "mqtt",
                "winrm"
              ],
              "default": "critical"
            },
            "description": "Which slice of the index to export."
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Two to four letter region code filter."
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500000
            },
            "description": "Maximum CSV rows."
          }
        ],
        "responses": {
          "200": {
            "description": "Export ready. Returns format, scope, rows and a presigned URL valid for 3600 seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "format": {
                      "type": "string"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "rows": {
                      "type": "integer"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key"
          },
          "403": {
            "description": "Exports require a paid tier"
          },
          "429": {
            "description": "Export quota exceeded (5/day)"
          }
        }
      }
    },
    "/stats/cve-exposure": {
      "get": {
        "tags": [
          "Intel"
        ],
        "summary": "CVEs ranked by hosts affected inside the index",
        "description": "Ranks every CVE that appears in exposure_records by how many hosts in the index actually carry it, joined to CVSS/EPSS/KEV. This is blast radius, not fame: a famous CVE with zero exposure in the index ranks last, and an unglamorous one on twenty thousand hosts ranks first.",
        "operationId": "getCveExposure",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 12,
              "maximum": 100
            }
          },
          {
            "name": "kev",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Restrict to CISA KEV entries"
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked CVE exposure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cves": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cve_id": {
                            "type": "string"
                          },
                          "hosts_affected": {
                            "type": "integer"
                          },
                          "cvss_v3": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "epss": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "kev": {
                            "type": "boolean"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "ransomware": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "total_indexed": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/cve/top": {
      "get": {
        "tags": [
          "Intel"
        ],
        "summary": "CVEs ranked by hosts affected inside the index",
        "description": "DEPRECATED alias. 301 -> /stats/cve-exposure. Use the canonical route; this remains only so old links and cached clients resolve. It will be removed.",
        "operationId": "getCveExposure",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 12,
              "maximum": 100
            }
          },
          {
            "name": "kev",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            },
            "description": "Restrict to CISA KEV entries"
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked CVE exposure",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cves": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "cve_id": {
                            "type": "string"
                          },
                          "hosts_affected": {
                            "type": "integer"
                          },
                          "cvss_v3": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "epss": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "kev": {
                            "type": "boolean"
                          },
                          "summary": {
                            "type": "string"
                          },
                          "ransomware": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "total_indexed": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": true,
        "x-canonical": "/stats/cve-exposure"
      }
    },
    "/threats/artex": {
      "get": {
        "tags": [
          "Threats"
        ],
        "summary": "Exposed autonomous pentest agents (ARTEX)",
        "description": "Internet-exposed ARTEX instances, fingerprinted by HTTP title AND favicon hash so renamed forks surface. ARTEX is an open-source autonomous penetration-testing framework (BaaRai/ARTEX), not a threat actor; it was named by CrowdStrike and Genians in the intrusions against seven South Korean financial institutions. Default confidence floor is medium, which excludes title-only brand collisions.",
        "operationId": "getArtexRadar",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 200
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "country",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "confidence",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "high",
                "medium",
                "low"
              ],
              "default": "medium"
            },
            "description": "Confidence floor. high = title and favicon agree; medium = favicon with title scrubbed (renamed fork); low = title only, probable brand collision."
          }
        ],
        "responses": {
          "200": {
            "description": "Ranked exposed agents",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "feed": {
                      "type": "string"
                    },
                    "family": {
                      "type": "string"
                    },
                    "total": {
                      "type": "integer"
                    },
                    "by_country": {
                      "type": "object"
                    },
                    "agents": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/reverseip/{ip}": {
      "get": {
        "tags": [
          "Deep"
        ],
        "summary": "Reverse-IP neighbour lookup (alias of /reverse-ip/{ip})",
        "description": "DEPRECATED alias. 301 -> /reverse-ip/{ip}. Use the canonical route; this remains only so old links and cached clients resolve. It will be removed.",
        "operationId": "reverseIpAlias",
        "parameters": [
          {
            "name": "ip",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Neighbour domains sharing the IP"
          }
        },
        "deprecated": true,
        "x-canonical": "/reverse-ip/{ip}"
      }
    },
    "/stats": {
      "get": {
        "deprecated": true,
        "summary": "301 redirect -> /stats/summary",
        "description": "DEPRECATED. 301 -> /stats/summary. Kept only so old links resolve.",
        "x-canonical": "/stats/summary",
        "responses": {
          "301": {
            "description": "Redirect to /stats/summary"
          }
        }
      }
    },
    "/vulns/newest": {
      "get": {
        "tags": [
          "CVE browser"
        ],
        "summary": "Most recently published CVEs, newest first",
        "description": "The CVE index itself, ordered by publish date. Not correlated with hosts held in the index.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25,
              "maximum": 100
            }
          },
          {
            "name": "after",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "ISO timestamp lower bound"
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "ISO timestamp upper bound"
          }
        ],
        "responses": {
          "200": {
            "description": "Newest CVEs"
          }
        }
      }
    },
    "/vulns/kev": {
      "get": {
        "tags": [
          "CVE browser"
        ],
        "summary": "CISA Known Exploited Vulnerabilities held in the index",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "KEV CVEs"
          }
        }
      }
    },
    "/vulns/search": {
      "get": {
        "tags": [
          "CVE browser"
        ],
        "summary": "Search CVEs by id, vendor, product or free text",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 25,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0
            }
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "published_desc",
                "published_asc",
                "cvss_desc",
                "epss_desc",
                "cve_desc",
                "cve_asc"
              ],
              "default": "published_desc"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching CVEs"
          }
        }
      }
    },
    "/vulns/vendors": {
      "get": {
        "tags": [
          "CVE browser"
        ],
        "summary": "Vendors with CPEs in the index, ranked by CVE count",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 200
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor rollup"
          }
        }
      }
    },
    "/vulns/products": {
      "get": {
        "tags": [
          "CVE browser"
        ],
        "summary": "Products with CPEs in the index, ranked by CVE count",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "maximum": 200
            }
          },
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Product rollup"
          }
        }
      }
    },
    "/vulns/{cve}": {
      "get": {
        "tags": [
          "CVE browser"
        ],
        "summary": "Full CVE record with scores, EPSS, references and affected products",
        "parameters": [
          {
            "name": "cve",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^CVE-\\d{4}-\\d{4,7}$"
            }
          },
          {
            "name": "products",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "top",
                "all"
              ],
              "default": "top"
            },
            "description": "top returns the first 100 CPEs (some CVEs carry 10,000+) and sets affected_products_truncated"
          }
        ],
        "responses": {
          "200": {
            "description": "CVE detail"
          },
          "404": {
            "description": "CVE not in the indexed dataset"
          }
        }
      }
    },
    "/webhook/shodan": {
      "post": {
        "tags": [
          "Ingest"
        ],
        "summary": "Shodan Monitor webhook receiver \u2014 refreshes threat_infra.last_seen",
        "description": "Shodan Monitor already watches the C2 / ARTEX IPs server-side. On a change it POSTs the JSON banner here. No polling, no per-IP lookups, no query credits, no rate limit. Updates last_seen for IPs we already hold; inserts unknown IPs only when they match a tracked family (ARTEX, Cobalt Strike, Metasploit, Mythic, Havoc, Sliver) so a stray alert cannot pollute the tracker. Sets source='shodan-monitor' so refreshed rows are auditable. Accepts either a bare banner or a {\"banner\":{...}} wrapper.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "x-shodan-secret",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional. Required only if SHODAN_WEBHOOK_SECRET is set."
          }
        ],
        "responses": {
          "200": {
            "description": "Banner ingested (action: refreshed | inserted | ignored)",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": ["refreshed", "inserted", "ignored"],
                      "description": "Action taken on the banner"
                    },
                    "reason": {
                      "type": "string",
                      "description": "Optional reason for ignored action"
                    },
                    "ip": {
                      "type": "string",
                      "description": "IP address that was processed (if applicable)"
                    },
                    "timestamp": {
                      "type": "string",
                      "description": "ISO timestamp when the banner was processed"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed body or banner has no ip",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Error message describing the validation failure"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Bad shared secret",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Authentication error message"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Database unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Database connectivity error message"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}