{
  "openapi": "3.1.0",
  "info": {
    "title": "Radiq public API",
    "version": "1.0.0",
    "description": "The public, unauthenticated endpoints on myradiq.com: NLWeb question answering over the docs, the website MCP server, and early-access sign-up. The RADIQ desktop app's own APIs are not part of this contract.",
    "contact": { "name": "Radiq", "email": "info@myradiq.com", "url": "https://myradiq.com/support" }
  },
  "servers": [{ "url": "https://myradiq.com" }],
  "paths": {
    "/ask": {
      "get": {
        "operationId": "askSite",
        "summary": "Ask a question about Radiq (NLWeb)",
        "parameters": [
          { "name": "query", "in": "query", "required": true, "schema": { "type": "string", "maxLength": 500 }, "description": "Natural-language question" }
        ],
        "responses": {
          "200": { "description": "Answer with sources", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AskResponse" } } } },
          "400": { "description": "Missing query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      },
      "post": {
        "operationId": "askSitePost",
        "summary": "Ask a question about Radiq (NLWeb, JSON body)",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["query"], "properties": { "query": { "type": "string", "maxLength": 500 } } } } } },
        "responses": {
          "200": { "description": "Answer with sources", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AskResponse" } } } },
          "400": { "description": "Missing query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    },
    "/mcp": {
      "post": {
        "operationId": "mcpJsonRpc",
        "summary": "Website MCP server (Streamable HTTP, stateless, JSON-RPC 2.0)",
        "description": "Tools: search_docs, get_doc_page, ask, show_radiq_overview. See /.well-known/mcp/server-card.json.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["jsonrpc", "method"], "properties": { "jsonrpc": { "const": "2.0" }, "id": { "type": ["string", "integer"] }, "method": { "type": "string" }, "params": { "type": "object" } } } } } },
        "responses": {
          "200": { "description": "JSON-RPC response", "content": { "application/json": { "schema": { "type": "object" } } } },
          "202": { "description": "Notification accepted, no body" },
          "400": { "description": "Parse error", "content": { "application/json": { "schema": { "type": "object" } } } }
        }
      }
    },
    "/api/waitlist": {
      "post": {
        "operationId": "joinEarlyAccess",
        "summary": "Request early access to Radiq",
        "description": "Adds an email to the early-access list. Rate limit: 5 requests per IP per 10 minutes (429 beyond that). Depending on settings, Radiq emails a confirmation link (status pending).",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "required": ["email", "role"], "properties": { "email": { "type": "string", "format": "email", "maxLength": 254 }, "role": { "type": "string", "maxLength": 50, "examples": ["engineering", "product", "design", "operations", "finance", "data", "sales", "marketing", "leadership", "other"] } } } } } },
        "responses": {
          "200": { "description": "Accepted", "content": { "application/json": { "schema": { "type": "object", "required": ["ok", "status"], "properties": { "ok": { "const": true }, "status": { "enum": ["added", "pending", "already_confirmed"] } } } } } },
          "400": { "description": "Invalid email or role", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "403": { "description": "Cross-origin request rejected", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } },
          "429": { "description": "Too many requests", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Error" } } } }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Error": { "type": "object", "properties": { "ok": { "const": false }, "error": { "type": "string" } } },
      "AskResponse": {
        "type": "object",
        "required": ["query", "answer", "sources", "results"],
        "properties": {
          "query": { "type": "string" },
          "answer": { "type": "string" },
          "sources": { "type": "array", "items": { "type": "string", "format": "uri" } },
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "url": { "type": "string", "format": "uri" },
                "name": { "type": "string" },
                "site": { "type": "string" },
                "score": { "type": "number" },
                "description": { "type": "string" },
                "schema_object": { "type": "object", "description": "schema.org TechArticle" }
              }
            }
          }
        }
      }
    }
  }
}
