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 October 10, 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.
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": 40,
"ranking_date": "2026-10-01",
"rank": 3,
"previous_rank": 3,
"points": 5560
},
{
"season": 2026,
"week": 39,
"ranking_date": "2026-09-24",
"rank": 3,
"previous_rank": 3,
"points": 5060
},
"...28 more"
],
"count": 30
}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.
More guides
Start with 500 free credits every month
No card. REST or MCP.