{
  "openapi": "3.1.0",
  "info": {
    "title": "Purchased Software Inventory API",
    "version": "1.1.0",
    "description": "Read the bilingual software inventory and securely transfer its redacted SQLite database. All /api/v1 read routes use AGENT_API_KEY; SQLite import/export uses ADMIN_API_KEY."
  },
  "servers": [{ "url": "https://otherappusage.zeabur.app" }],
  "components": {
    "securitySchemes": {
      "bearerAuth": { "type": "http", "scheme": "bearer" }
    }
  },
  "paths": {
    "/api/health": {
      "get": {
        "summary": "Service and database health",
        "responses": { "200": { "description": "Health status" } }
      }
    },
    "/api/v1/summary": {
      "get": {
        "summary": "Inventory counts and integration coverage",
        "security": [{ "bearerAuth": [] }],
        "responses": { "200": { "description": "Inventory summary" } }
      }
    },
    "/api/v1/projects": {
      "get": {
        "summary": "Projects used for compatibility assessment",
        "security": [{ "bearerAuth": [] }],
        "responses": { "200": { "description": "Project list" } }
      }
    },
    "/api/v1/software": {
      "get": {
        "summary": "Search and filter software",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          { "name": "q", "in": "query", "schema": { "type": "string" } },
          { "name": "category", "in": "query", "schema": { "type": "string" } },
          { "name": "status", "in": "query", "schema": { "type": "string" } },
          { "name": "project", "in": "query", "schema": { "type": "string", "enum": ["Marketing-hub", "repairdesk"] } },
          { "name": "min_project_score", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 5 } },
          { "name": "min_business_stars", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 5 } },
          { "name": "api", "in": "query", "schema": { "type": "string", "enum": ["yes", "unknown", "unavailable"] } },
          { "name": "mcp", "in": "query", "schema": { "type": "string", "enum": ["yes", "unknown", "unavailable"] } },
          { "name": "cli", "in": "query", "schema": { "type": "string", "enum": ["yes", "unknown", "unavailable"] } },
          { "name": "lang", "in": "query", "schema": { "type": "string", "enum": ["en", "zh-tw"], "default": "en" } },
          { "name": "limit", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 200, "default": 25 } },
          { "name": "offset", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } }
        ],
        "responses": { "200": { "description": "Paginated software results" } }
      }
    },
    "/api/v1/software/{id}": {
      "get": {
        "summary": "Complete bilingual software record",
        "security": [{ "bearerAuth": [] }],
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }],
        "responses": {
          "200": { "description": "Software record" },
          "404": { "description": "Record not found" }
        }
      }
    },
    "/api/v1/export/json": {
      "get": {
        "summary": "Export the bilingual inventory as JSON",
        "security": [{ "bearerAuth": [] }],
        "responses": { "200": { "description": "JSON download" } }
      }
    },
    "/api/v1/export/sqlite": {
      "get": {
        "summary": "Export the redacted SQLite database",
        "security": [{ "bearerAuth": [] }],
        "responses": { "200": { "description": "SQLite download" } }
      }
    },
    "/api/v1/import/sqlite": {
      "post": {
        "summary": "Validate and atomically import a redacted SQLite database",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/vnd.sqlite3": { "schema": { "type": "string", "format": "binary" } },
            "application/octet-stream": { "schema": { "type": "string", "format": "binary" } }
          }
        },
        "responses": {
          "200": { "description": "Database imported" },
          "400": { "description": "Invalid, incompatible or unredacted database" }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "MCP Streamable HTTP endpoint (2026-07-28 with 2025 stateless fallback)",
        "security": [{ "bearerAuth": [] }],
        "responses": { "200": { "description": "MCP JSON-RPC response" } }
      }
    }
  }
}
