{"service":"EdgeBets Sports Simulation API","protocol":"x402","show_to_user":"EdgeBets - AI Sports Betting Analytics\n\nI can get today's FREE pick, show track record, or run 10,000 Monte Carlo simulations.\n\nWhat would you like?\n- Today's Pick (FREE)\n- Track Record (FREE)\n- NBA/NFL/MLB/MLS games","x402_integration_guide":{"title":"EdgeBets x402 Integration Guide (Polling)","how_x402_works":["1. Client makes request to paid endpoint → gets 402","2. Client sends USDC payment on Solana","3. Client RETRIES request with ?signature=<tx_signature>","4. EdgeBets verifies payment, returns {status: 'processing', poll_url: '...'}","5. Client polls poll_url every 3 seconds","6. When status is 'complete', results are returned"],"WHY_POLLING":{"reason":"Simulations take 20-30 seconds. Most x402 clients timeout after 10-15s.","solution":"We return immediately with a job_id. You poll until complete.","benefit":"Works with ANY timeout setting. No long waits needed."},"payment_headers_in_402_response":{"X-Payment-Address":"DuDLnnPzzRo8Yi9AKFEE7rsESVyTzQVPgC6h3FXYaDB4","X-Payment-Amount":"1000000 (raw units, 1000000 = 1.0 USDC)","X-Payment-Currency":"USDC","X-Payment-Mint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","X-Payment-Network":"solana-mainnet"},"client_implementation_js":"async function x402Fetch(url, wallet) {\n  // Step 1: Make request\n  let response = await fetch(url);\n\n  // Step 2: If 402, pay and retry\n  if (response.status === 402) {\n    const address = response.headers.get('X-Payment-Address');\n    const amount = parseInt(response.headers.get('X-Payment-Amount')) / 1e6;\n    const mint = response.headers.get('X-Payment-Mint');\n\n    // Step 3: Send USDC\n    const signature = await wallet.sendToken(mint, address, amount);\n\n    // Step 4: RETRY with signature - USE 30 SECOND TIMEOUT!\n    const separator = url.includes('?') ? '&' : '?';\n    const controller = new AbortController();\n    setTimeout(() => controller.abort(), 30000); // 30 second timeout!\n    response = await fetch(url + separator + 'signature=' + signature, {\n      signal: controller.signal\n    });\n  }\n\n  return response.json();\n}","for_ai_agents":{"description":"Agents with x402 support use x402_fetch which handles everything automatically","example":"x402_fetch(url: 'https://api.edgebets.fun/api/v1/x402/simulate/nba/lakers')","automatic_steps":["1. Detect 402 response","2. Parse X-Payment-* headers","3. Send USDC payment automatically","4. RETRY with ?signature=TX_SIG","5. Return simulation results"]},"CRITICAL":"After paying, you MUST retry the same URL with ?signature=YOUR_TX_SIGNATURE to get results. The payment alone does not return data."},"endpoints":{"games_free":{"nba":"https://api.edgebets.fun/api/v1/games/basketball/today","nfl":"https://api.edgebets.fun/api/v1/games/football/today","mlb":"https://api.edgebets.fun/api/v1/games/baseball/today","mls":"https://api.edgebets.fun/api/v1/games/soccer/today"},"picks_free":{"today":"https://api.edgebets.fun/api/v1/picks/today","track_record":"https://api.edgebets.fun/api/v1/picks/track-record","description":"FREE - Get daily pick and track record"},"simulate_paid":{"url":"https://api.edgebets.fun/api/v1/x402/simulate/{sport}/{game}","cost":"$1.00 USDC","game_accepts":["Number (3)","Team name (rockets)","Full ID (nba-2026-03-04-hou-gs)"],"method":"GET or POST"}},"quick_reference":["1. GET /api/v1/picks/today (FREE - get pick of the day)","2. GET /api/v1/picks/track-record (FREE - see win/loss record)","3. GET /api/v1/games/basketball/today (FREE - list games)","4. User picks game 3 or 'rockets'","5. GET /api/v1/x402/simulate/nba/3 → Returns 402 with payment headers","6. Send 0.5 USDC to X-Payment-Address → Get tx signature","7. GET /api/v1/x402/simulate/nba/3?signature=TX_SIG → Returns {status: 'processing', poll_url: '...'}","8. GET poll_url every 3 seconds until status is 'complete'","9. Show simulation results to user"],"POLLING_FLOW":{"step_1":"GET https://api.edgebets.fun/api/v1/x402/simulate/nba/1?signature=YOUR_TX_SIG","response_1":{"status":"processing","poll_url":"https://api.edgebets.fun/api/v1/x402/result/abc123"},"step_2":"Wait 3 seconds, then GET the poll_url","step_3":"Repeat until status is 'complete'","step_4":"When complete, response contains full simulation results","note":"No long timeouts needed! Each request is fast."},"_api_spec":{"openapi":"3.1.0","info":{"title":"EdgeBets Sports Simulation API","description":"Professional Monte Carlo simulations for sports betting analysis. Pay per simulation with USDC on Solana via x402 protocol.","version":"1.0.0","x-logo":{"url":"https://api.edgebets.fun/favicon.svg"}},"servers":[{"url":"https://api.edgebets.fun","description":"EdgeBets API"}],"paths":{"/api/v1/x402":{"get":{"operationId":"discoverApi","summary":"Discover EdgeBets API","description":"Get full API documentation, available leagues, endpoints, and x402 payment details. START HERE.","tags":["Discovery"],"responses":{"200":{"description":"API discovery information including all endpoints, payment info, and usage instructions"}}}},"/api/v1/x402/leagues":{"get":{"operationId":"getLeagues","summary":"Get available leagues","description":"Returns all supported sports leagues (NBA, NFL, MLB, MLS) and their game endpoints.","tags":["Leagues"],"responses":{"200":{"description":"List of leagues with their games endpoints"}}}},"/api/v1/games/basketball/today":{"get":{"operationId":"getNbaGamesToday","summary":"Get today's NBA games","description":"Returns all NBA games scheduled for today with game IDs for simulation. FREE - no payment required.","tags":["Games"],"responses":{"200":{"description":"List of NBA games with game IDs, teams, and start times"}}}},"/api/v1/games/football/today":{"get":{"operationId":"getNflGamesToday","summary":"Get today's NFL games","description":"Returns all NFL games scheduled for today with game IDs for simulation. FREE - no payment required.","tags":["Games"],"responses":{"200":{"description":"List of NFL games with game IDs, teams, and start times"}}}},"/api/v1/games/baseball/today":{"get":{"operationId":"getMlbGamesToday","summary":"Get today's MLB games","description":"Returns all MLB games scheduled for today. FREE - no payment required.","tags":["Games"],"responses":{"200":{"description":"List of MLB games"}}}},"/api/v1/games/soccer/today":{"get":{"operationId":"getMlsGamesToday","summary":"Get today's MLS games","description":"Returns all MLS soccer games scheduled for today. FREE - no payment required.","tags":["Games"],"responses":{"200":{"description":"List of MLS games"}}}},"/api/v1/picks/today":{"get":{"operationId":"getTodaysPick","summary":"Get today's pick of the day","description":"Returns the daily expert pick with analysis. FREE - no payment required. If game already played, indicates result and when next pick is available (2 AM Central).","tags":["Picks"],"responses":{"200":{"description":"Today's pick with win probability, confidence, and analysis"}}}},"/api/v1/picks/track-record":{"get":{"operationId":"getTrackRecord","summary":"Get pick track record","description":"Returns overall W-L-P record, win rate, current streak, and recent picks with results. FREE - no payment required.","tags":["Picks"],"parameters":[{"name":"limit","in":"query","required":false,"description":"Number of recent picks to include (default 30)","schema":{"type":"integer","default":30}}],"responses":{"200":{"description":"Track record with wins, losses, pushes, win rate, streak, and recent picks"}}}},"/api/v1/x402/simulate/{sport}/{game_id}":{"get":{"operationId":"runSimulation","summary":"Run Monte Carlo simulation","description":"Run 10,000 Monte Carlo simulations for a specific game. COSTS $1.00 USDC via x402 payment. Returns 402 Payment Required if no payment proof provided.","tags":["Simulation"],"parameters":[{"name":"sport","in":"path","required":true,"description":"Sport type: nba, nfl, mlb, or mls","schema":{"type":"string","enum":["nba","nfl","mlb","mls"]}},{"name":"game_id","in":"path","required":true,"description":"Game ID from the games endpoint","schema":{"type":"string"}},{"name":"signature","in":"query","required":false,"description":"Solana transaction signature proving USDC payment","schema":{"type":"string"}}],"responses":{"200":{"description":"Simulation results with win probabilities, projected scores, and betting analysis"},"402":{"description":"Payment required. Send $1.00 USDC to the treasury wallet and retry with signature.","headers":{"X-Payment-Address":{"description":"Wallet address to send USDC to","schema":{"type":"string"}},"X-Payment-Amount":{"description":"Amount in USDC (6 decimals, so 500000 = $1.00)","schema":{"type":"string"}},"X-Payment-Currency":{"description":"Currency (USDC)","schema":{"type":"string"}},"X-Payment-Network":{"description":"Network (solana-mainnet)","schema":{"type":"string"}}}}},"x-x402":{"required":true,"price":"$1.00 USDC","network":"solana-mainnet","recipient":"DuDLnnPzzRo8Yi9AKFEE7rsESVyTzQVPgC6h3FXYaDB4"}}},"/api/v1/x402/quote":{"get":{"operationId":"getPaymentQuote","summary":"Get payment requirements","description":"Get x402 payment requirements including price, wallet address, and USDC mint.","tags":["Payment"],"responses":{"200":{"description":"Payment requirements for x402"}}}},"/api/v1/x402/test":{"get":{"operationId":"testX402Compatibility","summary":"Test x402 compatibility","description":"Test if your agent handles x402 correctly. Returns 402, your agent should retry with ?signature=test. NO REAL PAYMENT NEEDED.","tags":["Testing"],"parameters":[{"name":"signature","in":"query","required":false,"description":"Set to 'test' to simulate successful payment","schema":{"type":"string"}}],"responses":{"200":{"description":"Test passed - agent is x402 compatible"},"402":{"description":"Test challenge - agent should retry with ?signature=test"}}}}},"components":{"securitySchemes":{"x402Payment":{"type":"apiKey","in":"query","name":"signature","description":"Solana transaction signature proving USDC payment to treasury wallet"}}},"tags":[{"name":"Discovery","description":"Start here - discover what the API can do"},{"name":"Games","description":"Get today's games (FREE)"},{"name":"Picks","description":"Get daily pick and track record (FREE)"},{"name":"Simulation","description":"Run Monte Carlo simulations (PAID - $1.00 USDC)"},{"name":"Payment","description":"x402 payment information"},{"name":"Testing","description":"Test your x402 setup"}],"x-agent-instructions":{"getting_started":["1. Call GET /api/v1/picks/today to get FREE pick of the day","2. Call GET /api/v1/picks/track-record to show W-L record (FREE)","3. Call GET /api/v1/games/basketball/today to see NBA games (FREE)","4. Pick a game and call GET /api/v1/x402/simulate/nba/{game_id}","5. You'll get a 402 response - pay $1.00 USDC to the wallet in headers","6. Retry with ?signature=YOUR_TX_SIGNATURE to get simulation results"],"on_first_contact":"Offer today's FREE pick first, then games. Only mention payment for simulations.","payment_flow":"402 response → send USDC → get tx signature → retry with ?signature=TX_SIG"}}}