{
  "openapi": "3.0.0",
  "info": {
    "title": "Insider402 SEC Parsing Engine",
    "version": "1.0.0",
    "description": "Stateless M2M API for parsing and querying SEC EDGAR insider trading transactions."
  },
  "paths": {
    "/api/v1/sec/filings": {
      "get": {
        "summary": "Retrieve parsed filings",
        "description": "Fetches and returns parsed Form 4 and Form 8-K filings for a CIK, verified via x402 payment headers.",
        "parameters": [
          {
            "name": "cik",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "10-digit CIK code of the company."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful retrieval of parsed SEC filings",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "cik": { "type": "string" },
                    "filings": { "type": "array", "items": { "type": "object" } },
                    "payment_verified": { "type": "object" }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required challenge"
          }
        }
      }
    },
    "/api/v1/sec/market-wide-latest": {
      "get": {
        "summary": "Market-wide latest SEC filings",
        "description": "Returns the 50 most recent Form 4 and 8-K filings across all tickers.",
        "responses": {
          "200": {
            "description": "Successful retrieval of the 50 most recent SEC filings globally.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "count": { "type": "integer" },
                    "filings": { "type": "array", "items": { "type": "object" } }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required challenge"
          }
        }
      }
    }
  }
}
