birdieapi
v0.2.0
Published
JavaScript and TypeScript client for the BirdieAPI Golf data API: stats, play-by-play, odds and player props. No dependencies.
Maintainers
Readme
birdieapi
Golf data and odds API. JavaScript and TypeScript client for the BirdieAPI Golf data API. No dependencies; Node 18+, Deno, Bun, and edge runtimes with fetch.
First call in plain Python
No package needed: standard library only. Set BIRDIEAPI_API_KEY to your key (free at https://birdieapi.com/signup) and run this. list_tournaments costs 1 credit.
import json, os, urllib.request
req = urllib.request.Request(
"https://mcp.birdieapi.com/v1/list_tournaments",
data=json.dumps({"season": 2025, "major": True, "limit": 3}).encode(),
headers={"x-api-key": os.environ["BIRDIEAPI_API_KEY"], "content-type": "application/json"},
)
with urllib.request.urlopen(req) as resp:
data = json.load(resp)["data"]
print("credits left:", resp.headers["x-credits-remaining"])
rows = next(v for v in data.values() if isinstance(v, list))
for row in rows[:5]:
print(row)Every tool works the same way: POST https://mcp.birdieapi.com/v1/, JSON in, {"data": ...} out, with X-Credits-Used and X-Credits-Remaining headers.
BirdieAPI at a glance
- Golf data and odds API: PGA Tour data from 2001: leaderboards, holes, courses, ratings, par-3/4/5 splits, major winner odds.
- 16 tools, every one on the free plan. Each call costs 1 to 10 credits; the table below has every price.
- Free: 500 credits every month, no card. Plans: Starter $19/month (10,000 credits), Pro $49/month (30,000 credits), Scale $149/month (125,000 credits), Business $299/month (300,000 credits). Top-ups: 400 credits per $1, from $5.
- MCP server: https://mcp.birdieapi.com/mcp?key=YOUR_API_KEY (or the key in an
x-api-keyheader; Claude and ChatGPT connect with a sign-in instead) - REST: POST https://mcp.birdieapi.com/v1/ with your key in an
x-api-keyheader and the arguments as a JSON body. - Python:
pip install birdieapi. JavaScript:npm install birdieapi - Hole by hole: 8.6 million holes. Strokes on each hole for about 99% of PGA Tour rounds since 2001, with par and yardage.
- Leaderboards: Five tours. Full fields with finishing position, status, rounds and money: PGA Tour, LPGA, LIV, DP World Tour and Korn Ferry Tour.
- Ratings: Strokes vs field. Each full round measured against its field on the same course, adjusted for field strength.
| Credits | Tools | | --- | --- | | 1 | get_data_status, list_tournaments, search_players, get_schedule | | 2 | get_leaderboard, get_scorecard, get_course, get_ratings | | 5 | get_player, get_player_results, get_player_stats, get_course_history, get_head_to_head, get_leaders, get_winner_odds | | 10 | get_tournament_forecast |
Install
npm install birdieapiGet a free key (500 credits every month, no card) at https://birdieapi.com/signup?utm_source=npm&utm_medium=readme&utm_campaign=birdieapi-js and set BIRDIEAPI_API_KEY.
import { Client } from "birdieapi"
const client = new Client() // reads BIRDIEAPI_API_KEY, or new Client({ apiKey: "..." })
const data = await client.listTournaments({"status":"final","limit":3})
console.log(data)
console.log("credits left:", client.lastCreditsRemaining)Every method takes one object with the API's parameter names and returns the unwrapped data. client.call("tool_name", {...}) reaches any tool newer than this package. Errors are typed: AuthError (401), InsufficientCreditsError (402), NotFoundError (404), RateLimitError (429, with retryAfter), APIError otherwise. 429 and 5xx responses are retried with backoff.
Load a whole season
client.loadSeason(dataset, season) pulls every page of one dataset for a season and returns an array of row objects. Nested fields become dotted keys (home.abbrev).
const rows = await client.loadSeason("tournaments", 2025) // first call: pages through the API
const again = await client.loadSeason("tournaments", 2025) // second call: read from ~/.cache/birdieapi/, no requests
await client.loadSeason("tournaments", 2025, { refresh: true }) // pull againSeasons are tour season years. The PGA Tour is the default; pass params: { league: ... } for another tour.
| Dataset | Tool | What a row is | Requests for a typical season | Credits for a typical season |
| --- | --- | --- | --- | --- |
| tournaments | listTournaments | a season's tournaments with winners and courses | 1 | 1 |
Price a big pull first
Every request costs the tool's normal credits. Per-game datasets (plays, odds and props by game) make one request per played game, so a full season is thousands of credits. Ask first:
console.log(await client.loadSeason("tournaments", 2025, { estimate: true }))
// { dataset: "tournaments", season: ..., calls: ..., credits: ..., basis: ..., data_calls: 0 }estimate: true makes no data requests and spends nothing. Where the tool accepts estimate_only (season-wide odds, props) it asks the server for the price; it uses the games already in your cache when there are some, and typical season sizes otherwise. The numbers in the table are the same typical sizes: they are approximate, an order of magnitude and not a quote.
maxCalls(default 100) stops a pull that turns out larger than expected. It throwsLoadLimitError, which holds the rows fetched so far (err.rows), and caches nothing. Raise it deliberately for a big pull.- Extra tool arguments go in
params({ team: "BOS" },{ league: "mls" }). Do not pass the season, paging or date arguments:loadSeasonsets them. - In Node the result is cached as JSON lines under
~/.cache/birdieapi/(cacheDirorBIRDIEAPI_CACHE_DIRmoves it,cache: falseskips it). Browsers and other runtimes withoutnode:fshave no cache. client.lastLoadreports the last load:rows,calls,creditsUsedandcached.- Per-game datasets skip games that start today or later.
Tools
| Method | What it returns | Credits |
| --- | --- | --- |
| listTournaments | List tournaments | 1 |
| getSchedule | Schedule | 1 |
| getLeaderboard | Leaderboard | 2 |
| getCourse | Course | 2 |
| searchPlayers | Search players | 1 |
| getPlayer | Player | 5 |
| getPlayerResults | Player results | 5 |
| getPlayerStats | Player stats | 5 |
| getScorecard | Scorecard | 2 |
| getCourseHistory | Course history | 5 |
| getHeadToHead | Head to head | 5 |
| getRatings | Ratings | 2 |
| getLeaders | Leaders | 5 |
| getWinnerOdds | Winner odds | 5 |
| getTournamentForecast | Tournament forecast | 10 |
| getDataStatus | Data status | 1 |
Full reference with response shapes: https://birdieapi.com/docs?utm_source=npm&utm_medium=readme&utm_campaign=birdieapi-js. The same data is available as a hosted MCP server for Claude, ChatGPT and Cursor: https://birdieapi.com/mcp. A Python client is on PyPI: pip install birdieapi.
MIT licensed.
