MLB Stats API Docs

Type to search endpoints by name, path, or keyword.

GET/api/v1/leagues

Leagues

Leagues and their season/structure metadata.

On this page

Try it

Query
https://statsapi.mlb.com/api/v1/leagues?sportId=1
const 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

NameTypeRequiredDescription
sportIdnumberno

Sport id. 1 is MLB.

leagueIdscsvno

One or more league ids.

seasonnumberno

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