Skip to content

Guides

How do I get a golfer's hole-by-hole scorecard in Python?

Every hole of every round a player played in a tournament, with par, yardage, strokes and the result of each hole.

Code verified October 10, 2026. One call to get_scorecard, 2 credits.

The call

tournament_id comes from list_tournaments and player_id from get_leaderboard or search_players.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.birdieapi.com/v1/get_scorecard",
    headers={"x-api-key": API_KEY},
    json={
        "tournament_id": "401811941",
        "player_id": "3470",
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

holes = pd.DataFrame([
    {"round": r["round"], **h} for r in data["rounds"] for h in r["holes"]
])
holes["to_par"] = holes["strokes"] - holes["par"]
print(data["result"]["name"], data["result"]["tournament"])
print(holes.groupby("result").size().sort_values(ascending=False))
print(holes.groupby("par")["to_par"].mean().round(2))

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.

{
  "result": {
    "tournament_id": "401811941",
    "tournament": "Masters Tournament",
    "season": 2026,
    "start_date": "2026-04-09",
    "player_id": "3470",
    "name": "Rory McIlroy",
    "position_display": "1",
    "status": "finished",
    "to_par": -12,
    "total_strokes": 276
  },
  "rounds": [
    {
      "round": 1,
      "strokes": 67,
      "to_par": -5,
      "out": 34,
      "in": 33,
      "course": "Augusta National Golf Club",
      "field_avg": 74.65,
      "vs_field": 7.65,
      "holes": [
        {
          "hole": 1,
          "par": 4,
          "yards": 445,
          "strokes": 4,
          "result": "par"
        },
        {
          "hole": 2,
          "par": 5,
          "yards": 585,
          "strokes": 4,
          "result": "birdie"
        },
        "...16 more"
      ]
    },
    {
      "round": 2,
      "strokes": 65,
      "to_par": -7,
      "out": 34,
      "in": 31,
      "course": "Augusta National Golf Club",
      "field_avg": 72.85,
      "vs_field": 7.85,
      "holes": [
        {
          "hole": 1,
          "par": 4,
          "yards": 445,
          "strokes": 4,
          "result": "par"
        },
        {
          "hole": 2,
          "par": 5,
          "yards": 585,
          "strokes": 4,
          "result": "birdie"
        },
        "...16 more"
      ]
    },
    "...2 more"
  ]
}

What to do next

  • get_course (2 credits). Par and yards per hole and how each hole played across the field.
  • get_leaderboard (2 credits). Where the round put the player against everyone else.

More guides

Start with 500 free credits

No card. REST or MCP.