{
  "openapi": "3.0.3",
  "info": {
    "title": "ZoomEye API",
    "version": "2.0.0",
    "description": "ZoomEye.org API for cyberspace asset search and user quota inspection."
  },
  "servers": [
    {
      "url": "https://api.zoomeye.org"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v2/userinfo": {
      "post": {
        "operationId": "getUserInfo",
        "summary": "Get user information and quota",
        "responses": {
          "200": {
            "description": "User information response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/search": {
      "post": {
        "operationId": "searchAssets",
        "summary": "Search cyberspace assets",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SearchRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Asset search response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v2/mcp": {
      "post": {
        "operationId": "mcpStreamableHttp",
        "summary": "Model Context Protocol endpoint (JSON-RPC over Streamable HTTP)",
        "description": "Requires 'Accept: application/json, text/event-stream'. Handshake: (1) JSON-RPC initialize -> read the mcp-session-id response header; (2) send notifications/initialized with that header (202); (3) optionally notify 'initialized'; then call tools/list and tools/call. Authentication uses the REST API-KEY header or Authorization: Bearer.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "description": "JSON-RPC 2.0 request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response, streamed as text/event-stream"
          },
          "202": {
            "description": "Notification accepted"
          },
          "406": {
            "description": "Missing or wrong Accept header"
          },
          "401": {
            "description": "Missing or invalid credentials"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "API-KEY"
      }
    },
    "schemas": {
      "SearchRequest": {
        "type": "object",
        "required": [],
        "properties": {
          "qbase64": {
            "type": "string",
            "description": "Base64-encoded ZoomEye query. Send either \"qbase64\" or the plain \"query\"."
          },
          "page": {
            "type": "integer",
            "minimum": 1,
            "default": 1
          },
          "pagesize": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "facets": {
            "type": "string",
            "description": "Comma-separated aggregation fields"
          },
          "sub_type": {
            "type": "string",
            "enum": [
              "v4",
              "v6",
              "web",
              "all"
            ],
            "default": "all"
          },
          "query": {
            "type": "string",
            "description": "Plain text ZoomEye query, for example: title=\"New API\". Alternative to \"qbase64\"."
          }
        }
      },
      "ApiResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "integer",
            "example": 60000
          },
          "message": {
            "type": "string",
            "example": "success"
          },
          "data": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "additionalProperties": true
      }
    }
  }
}