MLB Stats API Docs

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

GET/api/v1/sports

Sports

All sports/levels and their ids.

The lookup for sportId values used across the API. 1 is MLB; the rest are minor-league levels, college, international, etc.

On this page

Try it

https://statsapi.mlb.com/api/v1/sports
const res = await fetch('https://statsapi.mlb.com/api/v1/sports')
const data = await res.json()
curl -s 'https://statsapi.mlb.com/api/v1/sports'

Reference

Response

Type: SportsResponse

/** `GET /api/v1/sports` */
export interface SportsResponse extends WithCopyright {
	sports: Sport[]
}

Build with it

Live examples powered by this endpoint with real data. Inspiration — restyle and remix freely.

Sports & levels

Every sport/level the API knows, with ids (MLB is sportId 1).

Loading sports…

Example URLs

  • All sports: https://statsapi.mlb.com/api/v1/sports