Each league on StatsPlus has a unique URL, like https://statsplus.net/usba. In this case "usba" is the LGURL.
In all cases, the APIs are accessed at endpoints following the pattern:
https://statsplus.net/LGURL/api/APINAME
At this time, APIs are available by simply making an HTTP request to the URL endpoint, which will typically return data in CSV or JSON format.
The /ratings and /mycsv APIs require the user to be logged in, and it's expected that API will be used via a browser.
"ID","Name","Nickname","Parent Team ID"
"ID","First Name","Last Name","Team ID","Parent Team ID","Level","Pos","Role","Age","Retired"
This API returns a JSON structure containing the current game date, and then a dictionary with the last 10 valid game dates as keys, and the values as a list of team IDs with valid exports for the game date.
For a request of https://statsplus.net/LGURL/api/exports/, the response would be similar to this JSON:
{"current_date": "2043-08-31", "2043-08-31": [59, 57, 52, 42, 58, 46, 34, 55, 54], "2043-08-24": [ ... ] }
This indicates the current league file date is 2043-08-31, and team IDs 59, 57, 52, ... had valid exports for the 2043-08-31 game date.
Returns a CSV file including all major league games since the league started using StatsPlus, along with some details like score, starting pitchers, winning/losing pitcher, game date, etc.
"game_id","league_id","home_team","away_team","attendance","date","time","game_type","played","dh","innings","runs0","runs1","hits0","hits1","errors0","errors1","winning_pitcher","losing_pitcher","save_pitcher","starter0","starter1","cup"
"2013000001","100","2","6","0","2013-04-01","1905","0","1","0","9","4","7","9","13","0","0","","","","","","0"
These endpoints respond with a CSV file to be downloaded. Each endpoint has entries for overall, plus left and right splits. The last column is the "split_id", where 1 = overall, 2 = vsL and 3 = vsR.
This query can include a year to get previous season player stats. Format is
https://statsplus.net/LGURL/api/playerbatstats/?year=NNNN
The year parameter is optional.
The API responds with a CSV file including three batting and pitching stat lines for players in the major leagues for the specified year, one overall and then a vsL and vsR split. The split column is "split_id", where 1 = overall, 2 = vsL and 3 = vsR.
See "Web API for Drafted Players" section on Draft Help and FAQs
Visit https://statsplus.net/LGURL/api/ratings/
Note that you must be logged in to the league at https://statsplus.net/LGURL and linked to a team in that league when visiting the URL, or the API will refuse to work.
This will return a response like:
Request received, please check https://statsplus.net/LGURL/api/mycsv/?request=19d757bc-accc-43a2-a3df-zzzzzzzzz for output.
The process may take several minutes, the link will be valid for 30 minutes.
Copy-paste the URL into the address bar and visit it. When the background work is done, the second URL will return a CSV file. The process will almost always take at least 30 seconds, and could take up to 5 minutes in some cases.
There are many fields in the response, and the format or order may change in the future, so don't program anything based on the current specific order of the columns.
Important notes about the data:
Level IDs:
1 = ml
2 = aaa
3 = aa
4 = a
5 = short a
6 = rookie
7 = indy
8 = international
10 = college
11 = high school