DEV Community

noah
noah

Posted on Originally published at birdieapi.com

How do I get a golfer's strokes versus the field for each round?

Every tournament a player teed up in a season, with each round's strokes, the field average that day and the difference, raw and adjusted for field strength.

Code verified October 10, 2026. It takes one call to get_player_results, 5 credits.

The call

player_id comes from search_players or get_leaderboard. Page with offset for more.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.birdieapi.com/v1/get_player_results",
    headers={"x-api-key": API_KEY},
    json={
        "player_id": "9478",
        "season": 2026,
        "limit": 30,
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

rows = []
for t in data["results"]:
    for r in t["rounds"]:
        rows.append({"tournament": t["name"], "start": t["start_date"], "round": r["round"],
                     "strokes": r["strokes"], "field_avg": r["field_avg"],
                     "vs_field": r["vs_field"], "adj_vs_field": r["adj_vs_field"]})
rounds = pd.DataFrame(rows)
print(len(rounds), "rounds")
print(rounds.groupby("tournament")[["vs_field", "adj_vs_field"]].mean().round(2).sort_values("adj_vs_field", ascending=False).head(8))
print("season average adjusted:", round(rounds["adj_vs_field"].mean(), 2))
Enter fullscreen mode Exit fullscreen mode

You need requests and pandas (pip install requests pandas) and a free API key from BirdieAPI.

What comes back

The data object, trimmed to the first rows. Every value is real output from the run above.

{
  "player_id": "9478",
  "results": [
    {
      "tournament_id": "401811964",
      "name": "TOUR Championship",
      "start_date": "2026-08-27",
      "field_size": 30,
      "position_display": "1",
      "to_par": -16,
      "total_strokes": 264,
      "earnings": 10000000,
      "rounds": [
        {
          "round": 1,
          "strokes": 65,
          "to_par": -5,
          "course_id": "57",
          "field_avg": 66.66,
          "vs_field": 1.66,
          "adj_vs_field": 3.23
        },
        "...3 more"
      ]
    },
    "...19 more"
  ],
  "count": 20,
  "next_offset": null
}
Enter fullscreen mode Exit fullscreen mode

What to do next

  • get_scorecard (2 credits). The hole-by-hole card for any of those rounds.
  • get_player_stats (5 credits). Season scoring, birdies, driving, greens and putting for the same player.

Originally published at birdieapi.com.

Top comments (0)