Last updated May 11, 2017



Shows account settings and access token expiration time.


Returns the list of events for (usually) the current date (Eastern time) or, if specified, the events on yyyyMMdd. This endpoint includes a field named event_status that can be used to check if the event has been processed in the database.

This endpoint returns a team's current roster.

Returns the current standings table or, if specified, the standings table on yyyyMMdd.

This is a convenience endpoint that returns the list of active teams.

Returns a team's full schedule and results.


Returns the box score of a game.

Returns the current wild card standings table or, if specified, the wild card standings table on yyyyMMdd.


Returns the box score of a game.

Returns round, pick, team, player, and player's career stats.

Returns leaders for specified stat category in current or most recent regular season or postseason. See the NBA Leaders page for an example of how this endpoint can be used.

Returns a list of players with the top performances for a given date.

Returns core stats for all teams and stats for team's opponents. Field goals, rebounds, assists, blocks, steals, turnovers, etc. Includes totals and per game convenience fields. By default, returns data for all teams, but can be filtered to return data for specified team only.

Request URL Convention

All API endpoints at xmlstats adhere to the same convention so constructing URLs is consistent. All requests must have:

Depending on the API endpoint, a sport (i.e., mlb, nba) and an ID may be required. The term ID here is used in a general sense. The documentation page for each endpoint will list a name_id where name is a descriptive term for the identifer. For example, box score endpoints use an event_id to uniquely identify the box score being requested and team_id is used by several endpoints to identify a specific team.

All possible combinations of API requests will take one of these forms.


The following Perl code snippet can be used to construct a proper request URL for any API endpoint. See the example listings for equivalent code using Node.js, PHP, Python, and Ruby.

# host*      = erikberg.com
# sport      = optional (e.g., mlb or nba)
# endpoint*  = API endpoint
# id         = optional ID (e.g., team_id, event_id, category_id)
# format*    = json or xml
# parameters = any optional parameters API endpoint takes
sub build_url {
    my ($host, $sport, $endpoint, $id, $format, %parameters) = @_;
    my ($path) = join("/", grep(defined, ($sport, $endpoint, $id)));
    my $url = "https://" . $host . "/" . $path . "." . $format;

    # check for parameters and create parameter string
    if (%parameters) {
        my @paramlist;
        for my $key (keys %parameters) {
            push @paramlist, uri_escape($key) . "=" . uri_escape($parameters{$key});
        my $paramstring .= join("&", @paramlist);
        if (@paramlist) { $url .= "?" . $paramstring }
    return $url;

URL building examples.

# https://erikberg.com/events.json
build_url("erikberg.com", undef, "events", undef, "json", undef);

# https://erikberg.com/mlb/standings.xml
build_url("erikberg.com", "mlb", "standings", undef, "xml", undef);

# https://erikberg.com/mlb/boxscore/20131023-st-louis-cardinals-at-boston-red-sox.xml
build_url("erikberg.com", "mlb", "boxscore", "20131023-st-louis-cardinals-at-boston-red-sox", "xml", undef);

# https://erikberg.com/nba/roster/indiana-pacers.json
build_url("erikberg.com", "nba", "roster", "indiana-pacers", "json", undef);

# https://erikberg.com/nba/leaders/points_per_game.json?limit=3&season_type=post
build_url("erikberg.com", "nba", "leaders", "points_per_game", "json", (limit => "3", season_type => "post"));