{
  "openapi": "3.1.0",
  "info": {
    "title": "rumors.app public API",
    "version": "1.0.0",
    "description": "Small public API behind the rumors.app phrase library: anonymous copy-event beacon, aggregated copy counts, and an MCP server over the published phrase corpus.",
    "contact": { "email": "support@rumors.app" }
  },
  "servers": [{ "url": "https://rumors.app" }],
  "paths": {
    "/api/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP server (Streamable HTTP, JSON-RPC 2.0)",
        "description": "Read-only Model Context Protocol server over the published pick-up line collections. No authentication. Tools: list_collections, get_lines, random_line, search_lines. Server card: https://rumors.app/.well-known/mcp/server-card.json",
        "requestBody": {
          "required": true,
          "content": { "application/json": { "schema": { "type": "object", "description": "JSON-RPC 2.0 message" } } }
        },
        "responses": {
          "200": { "description": "JSON-RPC 2.0 response", "content": { "application/json": {} } },
          "202": { "description": "Notification accepted" }
        }
      }
    },
    "/api/counts": {
      "get": {
        "operationId": "getCounts",
        "summary": "Aggregated copy counts for one page",
        "parameters": [
          { "name": "p", "in": "query", "required": true, "schema": { "type": "string" }, "description": "Page path, e.g. /tl/lines/tagalog/" }
        ],
        "responses": {
          "200": {
            "description": "Map of phrase id to copy count, aggregated every 10 minutes",
            "content": { "application/json": { "schema": { "type": "object", "additionalProperties": { "type": "integer" } } } }
          }
        }
      }
    },
    "/api/oauth/register": {
      "post": {
        "operationId": "registerClient",
        "summary": "Dynamic client registration (RFC 7591)",
        "description": "Registers a machine client for a higher API quota. No human involvement. See https://rumors.app/auth.md",
        "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "client_name": { "type": "string" } } } } } },
        "responses": { "201": { "description": "client_id and client_secret", "content": { "application/json": {} } } }
      }
    },
    "/api/oauth/token": {
      "post": {
        "operationId": "getToken",
        "summary": "Token endpoint (client_credentials only)",
        "requestBody": { "content": { "application/x-www-form-urlencoded": {}, "application/json": {} } },
        "responses": { "200": { "description": "Bearer token, expires_in 3600", "content": { "application/json": {} } } }
      }
    },
    "/api/e": {
      "post": {
        "operationId": "postEvent",
        "summary": "Anonymous analytics beacon (copy events)",
        "description": "Fire-and-forget beacon used by the site's own pages. Always returns 204. No personal data is stored; deduplication uses a salted daily hash.",
        "requestBody": { "content": { "application/json": {} } },
        "responses": { "204": { "description": "Accepted (always)" } }
      }
    }
  }
}
