{
  "openapi": "3.1.0",
  "info": {
    "title": "StatEdge API",
    "description": "Global sports analytics and intelligence API. AI-synthesized injury reports, ATS/spread analysis, matchup predictions, odds analysis, parlay optimization, referee tendency analysis, rest/travel advantage modeling, waiver wire recommendations, and global sports coverage. Covers NFL, NBA, MLB, NHL, EPL, La Liga, Bundesliga, Serie A, Ligue 1, IPL, cricket, F1, UFC, and more. Fantasy sports, streaming, and ticket affiliate links included in relevant endpoints. All endpoints support any language via ?lang=. Pricing: $0.05\u2013$0.15 USDC/call via x402 micropayment.",
    "version": "1.2.0",
    "contact": {
      "url": "https://stateedge.vercel.app"
    }
  },
  "servers": [
    {
      "url": "https://stateedge.vercel.app"
    }
  ],
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "apiKey",
        "in": "header",
        "name": "PAYMENT-SIGNATURE",
        "description": "x402 payment signature. Call without header to receive 402 with payment requirements (amount, asset, network, payTo). Sign payment and retry with PAYMENT-SIGNATURE header."
      }
    }
  },
  "security": [
    {
      "x402": []
    }
  ],
  "paths": {
    "/api/odds": {
      "get": {
        "summary": "Live betting odds consensus",
        "description": "Live betting line consensus across 20+ sportsbooks globally. Returns spread, total, and moneyline for all games on the slate, with line movement signals and sharp money indicators. Covers 30+ sports and leagues worldwide. x-agent-use-case: on-demand before placing a bet or building a betting model.",
        "operationId": "odds",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NFL",
                "NBA",
                "MLB",
                "NHL",
                "NCAAF",
                "NCAAB",
                "MLS",
                "CFL",
                "WNBA",
                "EPL",
                "LALIGA",
                "BUNDESLIGA",
                "SERIEA",
                "LIGUE1",
                "UCL",
                "UEL",
                "BRASILEIRAO",
                "LIGAMX",
                "EREDIVISIE",
                "ALEAGUE",
                "SUPERLIG",
                "SCOTTISHPL",
                "SAUDIPL",
                "ARGENTINAPL",
                "F1",
                "AFL",
                "CRICKET_IPL",
                "CRICKET_BBL",
                "NRL",
                "SUPERLEAGUE",
                "SIXNATIONS",
                "EUROLEAGUE",
                "NBL"
              ],
              "default": "NFL"
            },
            "description": "Sport or league code. Global coverage: EPL/LALIGA/BUNDESLIGA/SERIEA/LIGUE1/UCL for European soccer; AFL/NRL/NBL for Australia; SIXNATIONS/NRL for rugby; F1 for Formula 1; CRICKET_IPL/CRICKET_BBL for cricket."
          }
        ],
        "responses": {
          "200": {
            "description": "Odds brief with consensus lines, movement signals, and sharp money indicators"
          },
          "402": {
            "description": "Payment required \u2014 x402 micropayment"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Pairs with /api/matchups for model vs. market comparison; chain to /api/parlay for multi-leg optimization; DraftKings + FanDuel links included"
      }
    },
    "/api/injuries": {
      "get": {
        "summary": "Injury report with fantasy and betting impact",
        "description": "Full injury report for any major league worldwide. Returns Out/Doubtful/Questionable/Probable status per player with specific fantasy lineup and betting line impact. Powered by ESPN data for all supported leagues including global soccer. x-agent-use-case: call before finalizing a fantasy lineup or before /api/odds to understand line movement context.",
        "operationId": "injuries",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NFL",
                "NBA",
                "MLB",
                "NHL",
                "NCAAF",
                "NCAAB",
                "WNBA",
                "MLS",
                "EPL",
                "LALIGA",
                "BUNDESLIGA",
                "SERIEA",
                "LIGUE1",
                "UCL",
                "UEL",
                "BRASILEIRAO",
                "LIGAMX",
                "EREDIVISIE",
                "ALEAGUE"
              ],
              "default": "NFL"
            }
          },
          {
            "name": "week",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Week number (NFL/NCAAF only)"
          }
        ],
        "responses": {
          "200": {
            "description": "Injury report"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Run first in any game analysis workflow; chain to /api/matchups for impact-adjusted projections; fantasy + streaming affiliates auto-appended"
      }
    },
    "/api/matchups": {
      "get": {
        "summary": "Matchup analysis for fantasy and betting",
        "description": "Favorable and unfavorable matchups by position for fantasy and betting. Covers all major leagues globally. Includes defensive rankings, injury context, game totals to watch, and start/sit recommendations. x-agent-use-case: weekly fantasy lineup optimization or pre-game betting analysis.",
        "operationId": "matchups",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "NFL"
            },
            "description": "Any sport/league code \u2014 global soccer leagues (EPL, LALIGA, etc.) fully supported"
          },
          {
            "name": "week",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matchup analysis"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.12,
        "x-agent-use-case": "weekly",
        "x-agent-chaining": "Core analysis endpoint \u2014 chain after /api/injuries for injury-adjusted matchup analysis; pairs with /api/odds for betting context"
      }
    },
    "/api/waiver": {
      "get": {
        "summary": "Fantasy waiver wire recommendations",
        "description": "Ranked waiver wire adds with FAAB bid guidance, streaming options by position, and specific drops to consider. Combines ESPN injury data with real-time news analysis. Best for NFL, NBA, MLB fantasy. x-agent-use-case: weekly during waiver processing window.",
        "operationId": "waiver",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "NFL"
            }
          },
          {
            "name": "week",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Waiver wire recommendations"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "weekly",
        "x-agent-chaining": "Fantasy waiver intelligence \u2014 chain after /api/injuries to find replacement pickups; fantasy affiliate links auto-appended"
      }
    },
    "/api/recap": {
      "get": {
        "summary": "Post-game recap with fantasy and betting implications",
        "description": "Most recent game recap for any team \u2014 key performances with fantasy grades, injury updates from the game, trend shifts, and next game preview with fantasy and betting implications. Works for all leagues globally including EPL, cricket, rugby. x-agent-use-case: on-demand after a game completes.",
        "operationId": "recap",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "NBA"
            }
          },
          {
            "name": "team",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Team name (e.g. Lakers, Chiefs, Arsenal, Mumbai Indians)"
          }
        ],
        "responses": {
          "200": {
            "description": "Game recap"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Post-game analysis \u2014 pairs with /api/injury-impact to identify game-changing injuries for next matchup"
      }
    },
    "/api/global": {
      "get": {
        "summary": "Global sports intelligence \u2014 F1, cricket, rugby, tennis, AFL, golf, boxing, MMA, cycling",
        "description": "Dedicated intelligence endpoint for sports that don't fit the fantasy/waiver model. F1: race previews with live standings from Jolpica API (driver/constructor championships, next race, last results). Cricket: IPL, Test, ODI, T20I, BBL, PSL, CPL, The Hundred, SA20 \u2014 match previews, series context, team form. Rugby: Six Nations, Rugby Championship, Super Rugby, NRL, Super League, Rugby World Cup. Tennis: ATP/WTA tours, all four Grand Slams, Davis Cup, Billie Jean King Cup. AFL, golf (PGA/DP World/LIV/Majors), boxing, MMA/UFC, cycling (TdF/Giro/Vuelta), athletics/Olympics. x-agent-use-case: on-demand for any non-US-fantasy sport query.",
        "operationId": "global",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "F1",
                "CRICKET",
                "IPL",
                "BBL",
                "PSL",
                "CPL",
                "THE100",
                "SA20",
                "RUGBY",
                "RUGBYUNION",
                "RUGBYLEAGUE",
                "SIXNATIONS",
                "NRL",
                "SUPERLEAGUE",
                "TENNIS",
                "ATP",
                "WTA",
                "WIMBLEDON",
                "USOPEN",
                "AUSOPEN",
                "RG",
                "AFL",
                "GOLF",
                "PGA",
                "DPWORLD",
                "LIV",
                "MASTERS",
                "BOXING",
                "MMA",
                "UFC",
                "CYCLING",
                "TDF",
                "GIRO",
                "VUELTA",
                "ATHLETICS",
                "OLYMPICS"
              ]
            },
            "description": "Sport code. F1 pulls live data from Jolpica API. All others use real-time Tavily synthesis from authoritative sources (formula1.com, ESPNcricinfo, Cricbuzz, worldrugby.org, BBC Sport, etc.)"
          },
          {
            "name": "action",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "preview"
            },
            "description": "F1: race|standings|qualifying|calendar. Cricket: match|series|ipl|standings. Rugby: match|tournament|standings. Tennis: tournament|rankings|draw|match. Others: preview|results|standings|analysis."
          },
          {
            "name": "detail",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional context: tournament name, team name, matchup, series. E.g. 'Six+Nations', 'Wimbledon', 'England+vs+Australia', 'Masters'"
          }
        ],
        "responses": {
          "200": {
            "description": "Global sports intelligence brief"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Global sports endpoint \u2014 EPL, La Liga, F1, cricket, IPL; DAZN streaming affiliate included; expands StatEdge to 2B+ global sports fans"
      }
    },
    "/api/ats": {
      "get": {
        "summary": "Against-the-spread trends",
        "description": "ATS trends and systems for a specific situation \u2014 home underdog, divisional games, off a loss, primetime, back-to-back, and more. Returns cover rate, sample size, and betting value assessment. x-agent-use-case: on-demand when building or backtesting a betting system.",
        "operationId": "ats",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "NFL"
            }
          },
          {
            "name": "situation",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The situation to analyze (e.g. home-underdog, divisional, off-a-loss, primetime)"
          }
        ],
        "responses": {
          "200": {
            "description": "ATS trend analysis"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "ATS trend analysis \u2014 chain after /api/matchups for against-the-spread model; pairs with /api/rest for rest advantage context"
      }
    },
    "/api/parlay": {
      "get": {
        "summary": "Parlay analysis and probability",
        "description": "True probability and expected value analysis for a parlay. Calculates vig-adjusted implied probability for each leg, correlated leg risks, and overall parlay value vs. sportsbook payout. x-agent-use-case: on-demand before placing a multi-leg bet.",
        "operationId": "parlay",
        "parameters": [
          {
            "name": "legs",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated parlay legs (e.g. Chiefs -3,Over 47.5,Lakers ML)"
          }
        ],
        "responses": {
          "200": {
            "description": "Parlay analysis"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.12,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Chain after /api/odds to build optimized multi-leg bets; uses correlation-aware parlay construction to minimize leg correlation"
      }
    },
    "/api/ref-analysis": {
      "get": {
        "summary": "Referee and official tendencies",
        "description": "Analysis of referee/official tendencies including foul rate, home/away bias, totals impact, and historical ATS record when this official works. Most useful for NBA (referee assignments released day-of) and NFL. x-agent-use-case: on-demand same day as game when referee assignment is known.",
        "operationId": "ref-analysis",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "NBA"
            }
          },
          {
            "name": "ref",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Referee name (optional \u2014 analyzes general tendencies if omitted)"
          }
        ],
        "responses": {
          "200": {
            "description": "Referee analysis"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Referee tendency analysis \u2014 chain before any game with known officiating controversy; pairs with /api/matchups for total/spread implications"
      }
    },
    "/api/rest": {
      "get": {
        "summary": "Rest and schedule advantage analysis",
        "description": "Rest advantage analysis \u2014 days of rest for both teams, back-to-back situations, schedule difficulty, travel distance impact, and historical ATS performance in rest-advantage/disadvantage spots. x-agent-use-case: on-demand as part of pre-game analysis.",
        "operationId": "rest",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "NBA"
            }
          },
          {
            "name": "team",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Team to analyze"
          },
          {
            "name": "opponent",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Rest advantage analysis"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.08,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Rest/travel advantage modeling \u2014 chain before /api/matchups for schedule-adjusted predictions; most predictive of unmodeled edges"
      }
    },
    "/api/injury-impact": {
      "get": {
        "summary": "Single player injury impact analysis",
        "description": "Deep-dive impact analysis for a specific player injury \u2014 win probability shift, line movement expected, fantasy replacement value, historical team performance without this player. x-agent-use-case: on-demand when a key player injury is announced.",
        "operationId": "injury-impact",
        "parameters": [
          {
            "name": "sport",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "NFL"
            }
          },
          {
            "name": "player",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "team",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Player injury impact"
          },
          "402": {
            "description": "Payment required"
          }
        },
        "x-price-usd": 0.1,
        "x-agent-use-case": "on-demand",
        "x-agent-chaining": "Chain immediately after /api/injuries to quantify win-probability impact of key injuries"
      }
    }
  }
}