API v4 Documentation

Endpoints Code Lookup

Parameters

API Key

Each valid request requires the inclusion of a valid API key as a query parameter. A key contains 11 characters: four alphanumeric characters, a dash, then six alphanumeric characters. Your account's current API key can be found on the National Statistical account page (requires login, located underneath the list of active subscriptions. (For new accounts, please note that it may take a few minutes to generate an initial API key.)

https://api4.natst.at/xxxx-xxxxxx/...

If no key is specified, an AUTHORIZE_FAILED error will be returned. If an invalid key is specified, a UNAUTHORIZED error will be returned.

Data Service Code

Most valid API requests require the inclusion of one of National Statistical's 30 data services, which each represent a level of competition in basketball, baseball, hockey, American football or soccer. The level parameter must be passed after the endpoint key in the URI, using the following format:

https://api4.natst.at/xxxx-xxxxxx/games/XXX/...

Please note that the level parameter is not case sensitive. For instance: MiLB, MILB and milb will each work properly.

Player, Team Stats

When using the stats endpoint, add either player or team in the range. (The default is team.) The glossary endpoint returns a dictionary of stat codes that can be used in queries.

https://api4.natst.at/xxxx-xxxxxx/glossary/mlb/

Team, League, Player, Game Code Usage

Specifying a code in the range will return all available information regarding a single data record. With most endpoints, not specifying a code will result in an overview list of available records with valid codes.

Team: https://api4.natst.at/xxxx-xxxxxx/teams/milb/SLS

League: https://api4.natst.at/xxxx-xxxxxx/leaguecodes/milb/international

Player: https://api4.natst.at/xxxx-xxxxxx/players/milb/37994267

Game: https://api4.natst.at/xxxx-xxxxxx/games/milb/10186874