Season Stats & Analytics
Team season leaderboard
Baseball (mlb, kbo, npb) and NBA. Returns every club's season
line for one role, ranked by one measure, in the same shape as the
TypeScript analytics SDK's teamSeasonLeaderboard (camelCase keys;
rows[] of rank / teamId / abbreviation / name / sampleSize / values).
role=batter (default) reads the all scope of team_batting_stats
and appends the team fielding fold: stolen_bases, caught_stealing,
errors (line-score errors, null unless every final game has them),
putouts / assists / fielding_pct (from per-game team fielding,
null unless every final game carries all three), fielding_games, and
for MLB Savant's oaa and fielding_runs_prevented_sum (null elsewhere).
role=pitcher reads team_pitching_stats; NPB publishes no pitching
aggregate and answers an empty board with note. NBA uses role=team
over team_season_stats.
metrics lists every measure key the board can carry for the role;
a key a league's producer does not publish is null on every row
(KBO publishes walks_plus_hbp, not walks). Nulls sort last.
Requires the stats entitlement (a paid plan). See Responses & Errors for the success envelope and availability rules.
https://api.sportquanta.com/v1/{league}/teams/season-leaderboardReference context: NPB.
Overview · Response conventions
Authorizations
AuthorizationstringheaderrequiredSend a workspace API token in the Authorization: Bearer <token> header.
Path Parameters
leagueenum<string>default:npbrequiredLeague for this reference section: npb.
Available options: npb
Query Parameters
seasonintegerrequiredSeason year (baseball) or season start year (NBA).
Required range: 1876 <= x, x <= 2100
roleenum<string>Defaults to batter for baseball; NBA accepts only team.
Available options: batter, pitcher, team
order_bystringOne of the role's metrics keys. Defaults to ops (batter), era (pitcher), net_rating (team).
directionenum<string>Defaults to the measure's conventional direction (asc for ERA, otherwise desc).
Available options: asc, desc
limitintegerdefault:30Required range: 1 <= x, x <= 50
provenancebooleandefault:falseOpt in to per-field provenance on supported single game, match, team, player, and venue reads. Lists and composites accept the flag but generally omit provenance. It is returned under _meta.provenance only when source metadata exists.
Response
application/jsonRanked team season board.
Query validation failed. Depending on the handler, invalid_query_parameter is returned with HTTP 400 or 422. Pre-read validation is non-billable.
Missing or invalid bearer API token.
Access is forbidden: the token lacks api.read scope, the plan lacks an endpoint/bookmaker capability, or configured billing access is inactive. Inspect error.code and details.feature when present.
The {league} segment is not in the Sportquanta catalog.
Hourly rate ceiling or monthly quota exceeded. The error code disambiguates
which limit was hit. X-RateLimit-* and X-Requests-*-Month response headers
carry the current state of both counters.
Token validation or an internal handler failed. Token-store failures use api_token_lookup_failed; unsupported internal sport dispatch can use data_layer_unavailable.
The data layer (Mongo / ClickHouse / Redis cache) is temporarily unreachable. The server attempted the lookup; it failed. Retry with backoff. Per the spec's order of evaluation, this DOES consume monthly quota — the request reached step 6.
The configured billing provider could not verify API access. The request is refused before the data handler and does not consume monthly quota.
dataobjectrequiredRanked team season board in the TypeScript analytics SDK's teamSeasonLeaderboard shape.
data.leaguestringrequireddata.roleenum<string>requiredAvailable options: batter, pitcher, team
data.seasonintegerrequireddata.metricsstring[]requiredEvery measure key the board carries for this role, in board order.
data.orderByobjectrequireddata.orderBy.measurestringrequireddata.orderBy.directionenum<string>requiredAvailable options: asc, desc
data.rowsobject[]requireddata.rows.rankintegerrequireddata.rows.teamIdstringrequireddata.rows.abbreviationstring | nullrequireddata.rows.namestring | nullrequireddata.rows.sampleSizenumber | nullrequiredAt-bats (batter), innings (pitcher) or games (team) behind the line.
data.rows.valuesobjectrequiredSeason values keyed by the response's metrics entries for the selected role. Keys and units depend on the sport and batter, pitcher or team role; for example ops is a batting ratio. A null value means the producer does not publish that metric, rather than zero.
data.rows.values.{key}number | nulldata.notestringExplains an empty or partial board (for example a league with no pitching aggregate).
_metaobjectResponse request/cache metadata. Optional evidence fields are specific to this handler; cache TTL does not measure source-data freshness.
_meta.request_idstring_meta.served_fromenum<string>Available options: live, cache
_meta.cache_ttl_secondsintegerResponse cache TTL; independent of source freshness. Omitted when zero.
errorobjectrequirederror.codestringrequiredStable machine-readable error code.
error.messagestringrequiredUser-facing error summary.
error.detailsanyOptional error details.