How do I get a tennis player's ranking history in Python?
A player's weekly ranking and points, newest first, for a season or for their career.
Code verified November 18, 2026. One call to get_rankings, 2 credits.
The call
player_id comes from search_players. Leave player_id out and pass date or week for the whole list on that day.
import requests
import pandas as pd
API_KEY = "YOUR_API_KEY"
resp = requests.post(
"https://mcp.acesapi.com/v1/get_rankings",
headers={"x-api-key": API_KEY},
json={
"player_id": "3782",
"season": 2026,
},
timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]
h = pd.DataFrame(data["history"]).sort_values("ranking_date")
h["points_change"] = h["points"].diff()
print(data["name"], "best rank", data["best_rank"])
print(h[["ranking_date", "rank", "points", "points_change"]].tail(10))
Replace YOUR_API_KEY with a key from your dashboard. Python needs requests and pandas (pip install requests pandas). JavaScript runs on Node 18 or newer, or in the browser.
Or use the official client: pip install acesapi
What comes back
The data object of the response, trimmed to the first rows. Every field is real output from the run above.
{
"tour": "ATP",
"player_id": "3782",
"name": "Carlos Alcaraz",
"best_rank": 1,
"history": [
{
"season": 2026,
"week": 46,
"ranking_date": "2026-11-12",
"rank": 3,
"previous_rank": 3,
"points": 6100
},
{
"season": 2026,
"week": 45,
"ranking_date": "2026-11-05",
"rank": 3,
"previous_rank": 3,
"points": 7100
},
"...28 more"
],
"count": 35
}What to do next
- get_ratings (2 credits). Our Elo rating, which moves with every match instead of every week.
- get_player (5 credits). Profile, career record, titles and recent matches.
The data this uses
Every row above comes from Tennis rankings history. Weekly ATP and WTA ranking lists since 2007, top 100 to 150 a week: rank, previous rank and points, and each player's history.
More guides
Rather ask Claude? 18 free Claude skills call these endpoints for you.
Start with 500 free credits every month
No card. REST or MCP.