{
  "openapi": "3.0.3",
  "info": {
    "title": "PredScope Prediction Market API",
    "description": "Free, open API for live prediction market data. Returns odds, volumes, outcomes, and resolved markets from 600+ Polymarket events. No authentication required. Updates every 10 minutes.",
    "version": "1.0.0",
    "contact": {
      "name": "PredScope",
      "url": "https://predscope.com",
      "email": "predscopelab@gmail.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://opensource.org/licenses/MIT"
    }
  },
  "servers": [
    {
      "url": "https://predscope.com",
      "description": "Production"
    }
  ],
  "paths": {
    "/api/markets.json": {
      "get": {
        "operationId": "getMarkets",
        "summary": "Get live prediction market data",
        "description": "Returns the top 100 active prediction markets with live odds, volumes, liquidity, categories, and outcome probabilities. Data sourced from Polymarket and updated every 10 minutes.",
        "tags": ["Markets"],
        "responses": {
          "200": {
            "description": "Successful response with live market data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarketsResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/resolved.json": {
      "get": {
        "operationId": "getResolved",
        "summary": "Get resolved prediction market outcomes",
        "description": "Returns resolved prediction market events with final outcomes, winners, volumes, and resolution dates. Includes historical data for major events like elections, sports, and financial predictions.",
        "tags": ["Resolved Markets"],
        "responses": {
          "200": {
            "description": "Successful response with resolved market data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResolvedResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "MarketsResponse": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object",
            "properties": {
              "source": { "type": "string", "example": "PredScope" },
              "description": { "type": "string" },
              "update_frequency": { "type": "string", "example": "10 minutes" },
              "total_markets": { "type": "integer", "example": 100 },
              "total_volume": { "type": "number", "example": 4860000000 },
              "generated_at": { "type": "string", "format": "date-time" }
            }
          },
          "markets": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Market" }
          }
        }
      },
      "Market": {
        "type": "object",
        "properties": {
          "title": { "type": "string", "example": "2026 FIFA World Cup Winner" },
          "slug": { "type": "string", "example": "2026-fifa-world-cup-winner-595" },
          "url": { "type": "string", "example": "/event/2026-fifa-world-cup-winner-595" },
          "volume": { "type": "number", "description": "Total trading volume in USD" },
          "volume_24h": { "type": "number", "description": "24-hour trading volume in USD" },
          "liquidity": { "type": "number", "description": "Current liquidity in USD" },
          "categories": { "type": "array", "items": { "type": "string" } },
          "outcomes": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Outcome" }
          }
        }
      },
      "Outcome": {
        "type": "object",
        "properties": {
          "title": { "type": "string", "example": "Spain" },
          "probability": { "type": "number", "minimum": 0, "maximum": 1, "example": 0.161 },
          "day_change": { "type": "number", "example": 0.001 }
        }
      },
      "ResolvedResponse": {
        "type": "object",
        "properties": {
          "meta": {
            "type": "object",
            "properties": {
              "source": { "type": "string", "example": "PredScope" },
              "total_resolved": { "type": "integer", "example": 96 },
              "total_volume": { "type": "number" },
              "categories": { "type": "object", "additionalProperties": { "type": "integer" } }
            }
          },
          "events": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ResolvedEvent" }
          }
        }
      },
      "ResolvedEvent": {
        "type": "object",
        "properties": {
          "title": { "type": "string", "example": "Presidential Election Winner 2024" },
          "winner": { "type": "string", "example": "Donald Trump" },
          "volume": { "type": "number" },
          "end_date": { "type": "string", "format": "date" },
          "category": { "type": "string" }
        }
      }
    }
  },
  "tags": [
    { "name": "Markets", "description": "Live prediction market data" },
    { "name": "Resolved Markets", "description": "Historical resolved outcomes" }
  ],
  "externalDocs": {
    "description": "PredScope API Documentation",
    "url": "https://predscope.com/api"
  }
}
