Skip to content

Guides

How do I get a golf tournament leaderboard in Python?

A tournament's full leaderboard with position, each round, total, earnings and cup points, and the course and purse alongside.

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

The call

tournament_id comes from list_tournaments or get_schedule. Leave limit out for the whole field.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

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

t = data["tournament"]
print(t["name"], t["season"], "won by", t["winner_name"], t["winning_to_par"])
board = pd.DataFrame(data["players"])
board["round_scores"] = board["rounds"].apply(lambda rs: [r["strokes"] for r in rs])
print(board[["position_display", "name", "to_par", "total_strokes", "round_scores", "earnings"]].head(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.

{
  "tournament": {
    "tournament_id": "401811941",
    "name": "Masters Tournament",
    "season": 2026,
    "start_date": "2026-04-09",
    "purse": 22500000,
    "field_size": 91,
    "winner_name": "Rory McIlroy",
    "winning_to_par": -12,
    "winning_strokes": 276
  },
  "players": [
    {
      "position_display": "1",
      "player_id": "3470",
      "name": "Rory McIlroy",
      "to_par": -12,
      "total_strokes": 276,
      "rounds_played": 4,
      "earnings": 4500000,
      "rounds": [
        {
          "round": 1,
          "strokes": 67,
          "to_par": -5,
          "course_id": "21",
          "vs_field": 7.65
        },
        "...3 more"
      ]
    },
    "...29 more"
  ],
  "count": 30
}

What to do next

  • get_scorecard (2 credits). A player's hole-by-hole card for the tournament.
  • get_course (2 credits). How each hole played for the whole field.

More guides

Start with 500 free credits

No card. REST or MCP.