Skip to content

Instantly share code, notes, and snippets.

@akeaswaran
Last active September 19, 2024 16:27
Show Gist options
  • Save akeaswaran/b48b02f1c94f873c6655e7129910fc3b to your computer and use it in GitHub Desktop.
Save akeaswaran/b48b02f1c94f873c6655e7129910fc3b to your computer and use it in GitHub Desktop.
ESPN hidden API Docs

ESPN's hidden API endpoints

Football

College Football

Latest News: http://site.api.espn.com/apis/site/v2/sports/football/college-football/news

Latest Scores: http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard

  • query params:

    • calendar: 'blacklist'
    • dates: any date in YYYYMMDD

Game Information: http://site.api.espn.com/apis/site/v2/sports/football/college-football/summary?event=:gameId

  • params:

    • gameId: identifier of some game (EX: 400934572 for 2017 Army vs Navy)

Team Information: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/:team

  • params:

    • team: some team abbreviation (EX: 'all' for Allegheny, 'gt' for Georgia Tech, 'wisconsin' for Wisconsin)

Rankings: http://site.api.espn.com/apis/site/v2/sports/football/college-football/rankings

NFL

Scores: http://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/football/nfl/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/:team

Baseball

MLB

Scores: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/teams/:team

College Baseball

Scores: https://site.api.espn.com/apis/site/v2/sports/baseball/college-baseball/scoreboard

Hockey

Scores: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/teams/:team

Basketball

NBA

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams/:team

WNBA

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/teams/:team

Women's College Basketball

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/teams/:team

Men's College Basketball

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/teams/:team

Soccer

Scores: http://site.api.espn.com/apis/site/v2/sports/soccer/:league/scoreboard

  • params:

    • league: some league abbreviation (EX: 'eng.1' for EPL, 'usa.1' for MLS)

Latest News: http://site.api.espn.com/apis/site/v2/sports/soccer/:league/news

List of Team Information: http://site.api.espn.com/apis/site/v2/sports/soccer/:league/teams

Will update with more information as I find more...

@mauzybwy
Copy link

mauzybwy commented Aug 5, 2024

Anybody know if this is good to use for commercial purposes? Is it gonna all come tumbling down?

@ryanbuckner
Copy link

ryanbuckner commented Aug 5, 2024 via email

@mattabets
Copy link

I am pulling NFL team schedules, the endpoint: https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/12/schedule?season=2024
only has the preseason for 2024, other years have the full regular season. Anyone know if the Regular season data is added after the preseason concludes?

@jb082005
Copy link

jb082005 commented Aug 8, 2024

I am pulling NFL team schedules, the endpoint: https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/12/schedule?season=2024 only has the preseason for 2024, other years have the full regular season. Anyone know if the Regular season data is added after the preseason concludes?

If you add &seasontype=2 it should show regular season data.
type 1 - preseason
2 - regular season
3 - postseason

@rtvenge
Copy link

rtvenge commented Aug 8, 2024

I was sniffing the Network tab on the Olympic Medal Webpage and found this AJAX call: https://site.api.espn.com/apis/site/v2/scoreboard/activeSports?v=1&editionKey=espn-en&lang=en&region=us

That could be a good hint to the syntax of the sports.

@mattabets
Copy link

I am pulling NFL team schedules, the endpoint: https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/12/schedule?season=2024 only has the preseason for 2024, other years have the full regular season. Anyone know if the Regular season data is added after the preseason concludes?

If you add &seasontype=2 it should show regular season data. type 1 - preseason 2 - regular season 3 - postseason

Lifesaver. Thank you!

@ryanbuckner
Copy link

I am pulling NFL team schedules, the endpoint: https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/12/schedule?season=2024 only has the preseason for 2024, other years have the full regular season. Anyone know if the Regular season data is added after the preseason concludes?

If you add &seasontype=2 it should show regular season data. type 1 - preseason 2 - regular season 3 - postseason

Lifesaver. Thank you!

You can see examples here in my AppScript https://docs.google.com/spreadsheets/d/18GZQQ7DPXBhBLtoRBBqNZV7KXVseVPB_udfyfU4K6vY/copy

@mattabets
Copy link

I am pulling NFL team schedules, the endpoint: https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/12/schedule?season=2024 only has the preseason for 2024, other years have the full regular season. Anyone know if the Regular season data is added after the preseason concludes?

If you add &seasontype=2 it should show regular season data. type 1 - preseason 2 - regular season 3 - postseason

Lifesaver. Thank you!

You can see examples here in my AppScript https://docs.google.com/spreadsheets/d/18GZQQ7DPXBhBLtoRBBqNZV7KXVseVPB_udfyfU4K6vY/copy

Thanks man, just saw your reddit post too lol

@EvanZ
Copy link

EvanZ commented Aug 13, 2024

@cermuel you can add ?enable=roster at the end of the url and the players will be under athletes.

For instance, if you're looking at Atlanta United FC in MLS, then your url would be: http://site.api.espn.com/apis/site/v2/sports/soccer/{usa.1}/teams/{18418}?enable=roster

The two items in brackets are based on which league and team you're looking at.

image image

Any idea if it's possible to specify season too?

@akreu
Copy link

akreu commented Aug 13, 2024

Any idea if it's possible to specify season too?

@EvanZ

You can also try this endpoint:
https://sports.core.api.espn.com/v2/sports/soccer/leagues/usa.1/seasons/2024/teams/18418/athletes/

@stuarts205
Copy link

Does anyone know why I only get 50 teams when running the one to get the college-football teams?

@EvanZ
Copy link

EvanZ commented Aug 14, 2024

Does anyone know why I only get 50 teams when running the one to get the college-football teams?

It would help if you paste the url you’re using.

@stuarts205
Copy link

Does anyone know why I only get 50 teams when running the one to get the college-football teams?

It would help if you paste the url you’re using.

http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams

@EvanZ
Copy link

EvanZ commented Aug 14, 2024

Does anyone know why I only get 50 teams when running the one to get the college-football teams?

It would help if you paste the url you’re using.

http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams

Add ?limit=500 to the end of the url.

@stuarts205
Copy link

?limit=500

awesome. thanks

@daverz06
Copy link

daverz06 commented Aug 17, 2024

Is it possible to find game by game live stats through this api...
var url = "https://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard?seasontype=1&week=" + weeknum + "&dates=2024"

I can get them through this api...
var url = "http://site.api.espn.com/apis/site/v2/sports/football/nfl/summary?event=" + gameId[k];

BUT, I'm trying to limit the number of times I call the api. I searched through all the objects that I could think of from the original url but I can't find all game stats, only game leaders and that's not enough.

Is there anyway to call the api ONE time for all the games for the current week?

Thanks!

@ryanbuckner
Copy link

@ryanbuckner
Copy link

@mattabets
Copy link

does anyone know how to get different year rosters from this endpoint? &season={year} doesn't seem like it is doing anything. Still getting the current team rosters.

https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/12?enable=roster

@BarryLaminack
Copy link

BarryLaminack commented Sep 4, 2024

Anyone have a beat on the ESPN Fantasy API? My previous calls are no longer working that point here: http://fantasy.espn.com/apis/v3/games/ffl/seasons

I would imagine they updated it somehow but I'm unable to source it. Any help would be appreciated!

try adding " lm-api-reads. " in front of last years paths.

For example:

This...

https://fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/[leagueID]?view=mMatchupScore&view=mStandings&view=mTeam"

would now be this...

https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/[leagueID]?view=mMatchupScore&view=mStandings&view=mTeam"

@jsc31994
Copy link

Anyone have a beat on the ESPN Fantasy API? My previous calls are no longer working that point here: http://fantasy.espn.com/apis/v3/games/ffl/seasons
I would imagine they updated it somehow but I'm unable to source it. Any help would be appreciated!

try adding " lm-api-reads. " in front of last years paths.

For example:

This...

https://fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/[leagueID]?view=mMatchupScore&view=mStandings&view=mTeam"

would now be this...

https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/[leagueID]?view=mMatchupScore&view=mStandings&view=mTeam"

Dude you are a LIFE SAVER!! But do you know how to use this api with private leagues?

@BarryLaminack
Copy link

Anyone have a beat on the ESPN Fantasy API? My previous calls are no longer working that point here: http://fantasy.espn.com/apis/v3/games/ffl/seasons
I would imagine they updated it somehow but I'm unable to source it. Any help would be appreciated!

try adding " lm-api-reads. " in front of last years paths.
For example:
This...
https://fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/[leagueID]?view=mMatchupScore&view=mStandings&view=mTeam"
would now be this...
https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/seasons/2024/segments/0/leagues/[leagueID]?view=mMatchupScore&view=mStandings&view=mTeam"

Dude you are a LIFE SAVER!! But do you know how to use this api with private leagues?

Glad that helped.

I have found that the easiest workaround a private league is to change the "Make League Viewable to Public" to "Yes". This makes your league data readable. Otherwise from what I gathered in my research you have to grab your cookie with your log in credentials and present it each time you make a call.

That was a problem for me because I'm pulling data from 4 leagues, but I'm only in 1 of those leagues so...it was just MUCh easier to flip that setting above. Far as I know it's not a security risk. It's just "viewable". But I mean, who cares?

Hope that helps.

@sghavami
Copy link

does anyone know which endpoint to use to get the complete seasonal schedule for college foorball and basketball?

@Tryden12
Copy link

does anyone know which endpoint to use to get the complete seasonal schedule for college foorball and basketball?

https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard

Add the following query string param to find games based on date range: (format YYYYMMDD)
?dates=20240801-20250108

@jsc31994
Copy link

Glad that helped.

I have found that the easiest workaround a private league is to change the "Make League Viewable to Public" to "Yes". This makes your league data readable. Otherwise from what I gathered in my research you have to grab your cookie with your log in credentials and present it each time you make a call.

That was a problem for me because I'm pulling data from 4 leagues, but I'm only in 1 of those leagues so...it was just MUCh easier to flip that setting above. Far as I know it's not a security risk. It's just "viewable". But I mean, who cares?

Hope that helps.

Thank you. Yea after reading some info on the legacy api, it seems that you need to add the swid and espn_s2 cookies with the request. I tried this in postman and it seems to work just fine now 👍

@sghavami
Copy link

does anyone know which endpoint to use to get the complete seasonal schedule for college foorball and basketball?

https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard

Add the following query string param to find games based on date range: (format YYYYMMDD) ?dates=20240801-20250108

Many thanks!!!

@idoagv
Copy link

idoagv commented Sep 15, 2024

anyone knows how can i get a list of leagues related to my ESPN user ?

@Viaboom
Copy link

Viaboom commented Sep 18, 2024

@ryanbuckner
Copy link

ryanbuckner commented Sep 18, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment