{"openapi":"3.1.0","info":{"title":"PolyEdge Prediction Market Arbitrage & Orderbook API","version":"1.0.0","description":"Deterministic Polymarket NegRisk complete-set arbitrage scanner, real CLOB orderbook walkthrough (VWAP & slippage), and Polymarket vs. Kalshi cross-venue comparison API. Supports RapidAPI subscriptions, Apify Store, and HTTP x402 Base USDC micropayments."},"servers":[{"url":"https://polyedge.dovafy.com","description":"PolyEdge Production API"}],"paths":{"/health":{"get":{"operationId":"getHealth","summary":"Live upstream connectivity and latency probe","parameters":[{"name":"fresh","in":"query","schema":{"type":"string","enum":["1"]},"description":"Optional. Pass fresh=1 to bypass the 5-second health cache."}],"responses":{"200":{"description":"Upstreams healthy or partially reachable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}},"503":{"description":"All upstreams unreachable"}}}},"/v1/sample":{"get":{"operationId":"getFreeSample","summary":"Free cached live preview sample (arbitrage, orderbook depth, cross-venue)","responses":{"200":{"description":"Cached real-time sample payload","content":{"application/json":{"schema":{"type":"object"}}}},"429":{"description":"Free endpoint rate limit exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/arbitrage/scan":{"get":{"operationId":"scanArbitrage","summary":"Scan Polymarket NegRisk multi-outcome events for real orderbook arbitrage","x-x402-price":"$0.005","parameters":[{"name":"minEdgeBps","in":"query","schema":{"type":"number","default":20,"minimum":0,"maximum":5000},"description":"Minimum net arbitrage ROI in basis points after fees."},{"name":"sizeUsd","in":"query","schema":{"type":"number","default":250,"minimum":1,"maximum":500000},"description":"Target deployment size in USD for multi-level VWAP calculation."},{"name":"limit","in":"query","schema":{"type":"integer","default":20,"minimum":1,"maximum":50},"description":"Maximum number of opportunities to return."}],"responses":{"200":{"description":"Ranked real-depth arbitrage opportunities and tightest near-arb markets","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArbitrageScanResponse"}}}},"400":{"description":"Invalid query parameters (no x402 charge)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"HTTP x402 payment required (or supply RapidAPI subscription)"}}}},"/v1/market/depth":{"get":{"operationId":"analyzeMarketDepth","summary":"Walk real Polymarket CLOB orderbook for VWAP, slippage, and size ladder","x-x402-price":"$0.002","parameters":[{"name":"tokenId","in":"query","schema":{"type":"string"},"description":"Polymarket CLOB ERC-1155 token ID."},{"name":"conditionId","in":"query","schema":{"type":"string"},"description":"Polymarket market conditionId (0x...)."},{"name":"slug","in":"query","schema":{"type":"string"},"description":"Polymarket market or event slug."},{"name":"outcome","in":"query","schema":{"type":"string","enum":["yes","no"],"default":"yes"},"description":"Outcome token to inspect when resolving via conditionId or slug."},{"name":"side","in":"query","schema":{"type":"string","enum":["buy","sell"],"default":"buy"},"description":"Execution side (buy walks asks; sell walks bids)."},{"name":"sizeUsd","in":"query","schema":{"type":"number","default":1000,"minimum":1,"maximum":1000000},"description":"Target USD notional order size."}],"responses":{"200":{"description":"Deterministic orderbook walkthrough, size ladder, and risk flags","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketDepthResponse"}}}},"400":{"description":"Invalid query parameters (no x402 charge)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"HTTP x402 payment required"},"404":{"description":"Market or CLOB token not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/v1/markets/compare":{"get":{"operationId":"compareMarkets","summary":"Compare aligned Polymarket and Kalshi markets with implied probability spread","x-x402-price":"$0.005","parameters":[{"name":"query","in":"query","schema":{"type":"string","maxLength":100},"description":"Optional topic filter (e.g., fed, bitcoin, tariff, ethereum)."},{"name":"limit","in":"query","schema":{"type":"integer","default":15,"minimum":1,"maximum":50},"description":"Maximum matched pairs to return."},{"name":"minConfidence","in":"query","schema":{"type":"number","default":0.42,"minimum":0.2,"maximum":1},"description":"Minimum deterministic match confidence score."}],"responses":{"200":{"description":"Aligned Polymarket vs. Kalshi markets with cross-venue spreads","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketsCompareResponse"}}}},"400":{"description":"Invalid query parameters (no x402 charge)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"402":{"description":"HTTP x402 payment required"}}}}},"components":{"securitySchemes":{"RapidApiProxySecret":{"type":"apiKey","in":"header","name":"X-RapidAPI-Proxy-Secret","description":"Automatically injected by RapidAPI gateway for active subscribers."},"ApifyProxySecret":{"type":"apiKey","in":"header","name":"X-PolyEdge-Apify-Secret","description":"Independent secret for Apify Store Actor authentication."}},"schemas":{"ErrorResponse":{"type":"object","required":["error","message"],"properties":{"error":{"type":"string"},"message":{"type":"string"},"details":{"type":"array","items":{"type":"string"}}}},"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok","degraded","down"]},"service":{"type":"string"},"version":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"upstreams":{"type":"object"}}},"RiskFlag":{"type":"string","enum":["WIDE_SPREAD","THIN_ORDERBOOK","EXPIRING_SOON","STALE_MARKET","NON_EXHAUSTIVE_OUTCOMES","LOW_MATCH_CONFIDENCE","UNFILLABLE_SIZE","ONE_SIDED_BOOK","EXPIRY_MISMATCH"]},"ArbitrageOpportunity":{"type":"object","properties":{"eventId":{"type":"string"},"slug":{"type":"string"},"title":{"type":"string"},"direction":{"type":"string","enum":["BUY_COMPLETE_SET","SELL_COMPLETE_SET"]},"outcomeCount":{"type":"integer"},"isExhaustive":{"type":"boolean"},"sumBestPrice":{"type":"number"},"sumVwapPrice":{"type":"number"},"estimatedFeePerSet":{"type":"number"},"grossEdgeBps":{"type":"number"},"netEdgeBps":{"type":"number"},"netEdgePct":{"type":"number"},"maxShares":{"type":"number"},"maxSizeUsd":{"type":"number"},"estimatedMaxProfitUsd":{"type":"number"},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"riskFlags":{"type":"array","items":{"$ref":"#/components/schemas/RiskFlag"}},"legs":{"type":"array","items":{"type":"object"}}}},"ArbitrageScanResponse":{"type":"object","properties":{"engine":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"cachedTtlSeconds":{"type":"integer"},"scannedNegRiskEvents":{"type":"integer"},"scannedOrderbooks":{"type":"integer"},"count":{"type":"integer"},"opportunities":{"type":"array","items":{"$ref":"#/components/schemas/ArbitrageOpportunity"}},"tightestMarkets":{"type":"array","items":{"type":"object"}}}},"MarketDepthResponse":{"type":"object","properties":{"engine":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"cachedTtlSeconds":{"type":"integer"},"market":{"type":"object"},"walkthrough":{"type":"object","properties":{"side":{"type":"string","enum":["buy","sell"]},"requestedSizeUsd":{"type":"number"},"filledUsd":{"type":"number"},"unfilledUsd":{"type":"number"},"filledShares":{"type":"number"},"fullyFillable":{"type":"boolean"},"bestBid":{"type":["number","null"]},"bestAsk":{"type":["number","null"]},"midPrice":{"type":["number","null"]},"spreadBps":{"type":["number","null"]},"vwap":{"type":["number","null"]},"slippageBps":{"type":["number","null"]},"slippagePct":{"type":["number","null"]},"depth2PctUsd":{"type":"number"},"depth5PctUsd":{"type":"number"}}},"sizeLadder":{"type":"array","items":{"type":"object"}},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"riskFlags":{"type":"array","items":{"$ref":"#/components/schemas/RiskFlag"}}}},"MarketsCompareResponse":{"type":"object","properties":{"engine":{"type":"string"},"timestamp":{"type":"string","format":"date-time"},"cachedTtlSeconds":{"type":"integer"},"venuesScanned":{"type":"object"},"count":{"type":"integer"},"comparisons":{"type":"array","items":{"type":"object","properties":{"matchConfidence":{"type":"number"},"matchMethod":{"type":"string"},"sharedSignals":{"type":"array","items":{"type":"string"}},"polymarket":{"type":"object"},"kalshi":{"type":"object"},"impliedProbDiffBps":{"type":["number","null"]},"crossArbitrage":{"type":"object"},"riskLevel":{"type":"string","enum":["LOW","MEDIUM","HIGH"]},"riskFlags":{"type":"array","items":{"$ref":"#/components/schemas/RiskFlag"}}}}}}}}}}