How do I get set-by-set tennis scores for a tournament in Python?
Every match of a tournament with seeds, winner and each set's games and tiebreak, flattened into one row per set.
Code verified October 10, 2026. One call to get_matches, 2 credits.
The call
tournament_id comes from list_tournaments. It is the tournament number and the year.
import requests
import pandas as pd
API_KEY = "YOUR_API_KEY"
resp = requests.post(
"https://mcp.acesapi.com/v1/get_matches",
headers={"x-api-key": API_KEY},
json={
"tournament_id": "42-2026",
"limit": 100,
},
timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]
matches = pd.DataFrame(data["matches"])
main = matches[matches["draw"] == "main"]
sets = pd.json_normalize(main.to_dict("records"), record_path="sets", meta=["match_id", "round", "player1", "player2"])
print(len(main), "main-draw matches,", len(sets), "sets")
print(sets[["round", "player1", "player2", "set_no", "games1", "games2", "tiebreak1", "tiebreak2"]].head(10))
print("sets decided by a tiebreak:", int(sets["tiebreak1"].notna().sum()))
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",
"matches": [
{
"match_id": "176456",
"tournament": "Rolex Monte-Carlo Masters",
"draw": "qualifying",
"round": "Qualifying 1st Round",
"player1": "Emilio Nava",
"seed1": null,
"player2": "Quentin Halys",
"seed2": null,
"winner_id": "3772",
"score": "6-4 6-4",
"sets": [
{
"set_no": 1,
"games1": 6,
"games2": 4,
"tiebreak1": null,
"tiebreak2": null,
"winner": 1
},
"...1 more"
]
},
"...75 more"
],
"count": 76,
"next_offset": null
}What to do next
- get_tournament (2 credits). The same tournament as a draw, round by round.
- list_tournaments (1 credit). Find tournament ids by season, surface or status.
More guides
Start with 500 free credits every month
No card. REST or MCP.