GET/api/v1/leagues
Leagues
Leagues and their season/structure metadata.
On this page
Try it
https://statsapi.mlb.com/api/v1/leagues?sportId=1const res = await fetch('https://statsapi.mlb.com/api/v1/leagues?sportId=1')
const data = await res.json()curl -s 'https://statsapi.mlb.com/api/v1/leagues?sportId=1'
Reference
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
sportId | number | no | Sport id. |
leagueIds | csv | no | One or more league ids. |
season | number | no | Four-digit year. |
Response
Type: LeaguesResponse
/** `GET /api/v1/leagues` */
export interface LeaguesResponse extends WithCopyright {
leagues: League[]
}Notes
103= American League,104= National League.
Build with it
Live examples powered by this endpoint with real data. Inspiration — restyle and remix freely.
Leagues
Leagues with abbreviations and current season state.
Loading leagues…
Example URLs
- MLB leagues:
https://statsapi.mlb.com/api/v1/leagues?sportId=1