{"openapi":"3.1.0","info":{"title":"Baseball Stats API","version":"1.0.0","description":"Baseball sabermetrics as an API, computed locally and deterministically — turn raw counting numbers into the rate stats that actually rank players. The batting endpoint takes at-bats, hits, doubles, triples, home runs, walks, hit-by-pitch and sacrifice flies and returns the batting average (H/AB), on-base percentage ((H+BB+HBP)/(AB+BB+HBP+SF)), slugging percentage (total bases/AB), OPS (on-base plus slugging), isolated power (SLG−AVG) and, when strikeouts are supplied, BABIP — a classic .300/.366/.530 line comes straight out. The pitching endpoint takes innings pitched, earned runs, hits, walks, strikeouts and home runs and returns the earned run average (9·ER/IP), WHIP ((BB+H)/IP), strikeouts and walks per nine innings, the strikeout-to-walk ratio and FIP, the fielding-independent pitching estimator (13·HR + 3·(BB+HBP) − 2·K)/IP + constant. Innings pitched is a true decimal, with an exact \"outs\" input for the 6.1/6.2 box-score convention. Everything is computed locally and deterministically, so it is instant and private. Ideal for fantasy-baseball, sports-analytics, sabermetrics and box-score app developers, scouting and stat-line tools, and teaching material. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 2 compute endpoints. This computes the stats from your numbers; for live scores, standings, teams and players use a sports-data API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/baseball-api","description":"oanor gateway"}],"tags":[{"name":"Baseball"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/batting":{"get":{"operationId":"get_v1_batting","tags":["Baseball"],"summary":"Batting rate stats","description":"","parameters":[{"name":"at_bats","in":"query","required":true,"description":"At-bats (AB)","schema":{"type":"string"},"example":"500"},{"name":"hits","in":"query","required":true,"description":"Hits (H)","schema":{"type":"string"},"example":"150"},{"name":"doubles","in":"query","required":false,"description":"Doubles (2B)","schema":{"type":"string"},"example":"30"},{"name":"triples","in":"query","required":false,"description":"Triples (3B)","schema":{"type":"string"},"example":"5"},{"name":"home_runs","in":"query","required":false,"description":"Home runs (HR)","schema":{"type":"string"},"example":"25"},{"name":"walks","in":"query","required":false,"description":"Walks (BB)","schema":{"type":"string"},"example":"50"},{"name":"hit_by_pitch","in":"query","required":false,"description":"Hit by pitch (HBP)","schema":{"type":"string"},"example":"5"},{"name":"sacrifice_flies","in":"query","required":false,"description":"Sacrifice flies (SF)","schema":{"type":"string"},"example":"5"},{"name":"strikeouts","in":"query","required":false,"description":"Strikeouts (for BABIP)","schema":{"type":"string"},"example":"100"}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"avg":0.3,"iso":0.23,"obp":0.366,"ops":0.896,"slg":0.53,"note":"AVG = H/AB; OBP = (H+BB+HBP)/(AB+BB+HBP+SF); SLG = total bases/AB; OPS = OBP+SLG; ISO = SLG−AVG. BABIP needs strikeouts.","babip":0.329,"inputs":{"hits":150,"walks":50,"at_bats":500,"doubles":30,"triples":5,"home_runs":25,"strikeouts":100,"hit_by_pitch":5,"sacrifice_flies":5},"singles":90,"total_bases":265},"meta":{"timestamp":"2026-06-05T19:50:09.638Z","request_id":"db9bd112-3b9f-43aa-adee-84b776f1ec5c"},"status":"ok","message":"Batting stats","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/pitching":{"get":{"operationId":"get_v1_pitching","tags":["Baseball"],"summary":"Pitching rate stats","description":"","parameters":[{"name":"innings_pitched","in":"query","required":false,"description":"Innings (true decimal)","schema":{"type":"string"},"example":"200"},{"name":"outs","in":"query","required":false,"description":"Outs recorded (alt to innings)","schema":{"type":"string"}},{"name":"earned_runs","in":"query","required":false,"description":"Earned runs (ER)","schema":{"type":"string"},"example":"70"},{"name":"hits_allowed","in":"query","required":false,"description":"Hits allowed (H)","schema":{"type":"string"},"example":"180"},{"name":"walks","in":"query","required":false,"description":"Walks (BB)","schema":{"type":"string"},"example":"50"},{"name":"strikeouts","in":"query","required":false,"description":"Strikeouts (K)","schema":{"type":"string"},"example":"200"},{"name":"home_runs","in":"query","required":false,"description":"Home runs (HR)","schema":{"type":"string"},"example":"20"},{"name":"hit_by_pitch","in":"query","required":false,"description":"Hit by pitch (HBP)","schema":{"type":"string"},"example":"5"},{"name":"fip_constant","in":"query","required":false,"description":"FIP constant (default 3.10)","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"era":3.15,"fip":3.23,"note":"ERA = 9·ER/IP; WHIP = (BB+H)/IP; FIP = (13·HR + 3·(BB+HBP) − 2·K)/IP + constant (~3.10). Innings is a true decimal — use 'outs' for the box-score 6.1/6.2 convention.","whip":1.15,"inputs":{"walks":50,"home_runs":20,"strikeouts":200,"earned_runs":70,"fip_constant":3.1,"hit_by_pitch":5,"hits_allowed":180,"innings_pitched":200},"h_per_9":8.1,"k_per_9":9,"bb_per_9":2.25,"hr_per_9":0.9,"k_bb_ratio":4},"meta":{"timestamp":"2026-06-05T19:50:09.740Z","request_id":"8b76bd97-c8ef-490f-87b7-06fa5b4233cb"},"status":"ok","message":"Pitching stats","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"notes":"Counting stats in, rate stats out. Innings pitched is a true decimal; pass 'outs' to express the 6.1/6.2 box-score convention exactly. For live scores and standings use a sports-data API.","service":"baseball-api","endpoints":{"GET /v1/meta":"This document.","GET /v1/batting":"Batting rate stats from AB, H, 2B, 3B, HR, BB, HBP, SF (+K for BABIP).","GET /v1/pitching":"Pitching rate stats from IP (or outs), ER, H, BB, K, HR, HBP."},"description":"Baseball sabermetrics: batting (AVG, OBP, SLG, OPS, ISO, BABIP) and pitching (ERA, WHIP, K/9, FIP) rate stats from counting numbers."},"meta":{"timestamp":"2026-06-05T19:50:09.851Z","request_id":"3afc4caf-d350-4f82-bc0d-94964e001d76"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":5350,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":425,"monthly_call_quota":54000,"rps_limit":6,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":1190,"monthly_call_quota":246000,"rps_limit":15,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":3650,"monthly_call_quota":1330000,"rps_limit":40,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/baseball-api"}