Skip to main content
Version: 0.2.0

Golf — PGA TOUR GraphQL API (orchestrator.pgatour.com; runtime only, public frontend key or $PGA_API_KEY) — Player

pgatour_player​

One player's profile: name, country, world ranking, height, weight, birth date and place, year turned pro, school, residence.

Endpoint URL: POST https://orchestrator.pgatour.com/graphql

Example request: curl -X POST 'https://orchestrator.pgatour.com/graphql' -H 'Content-Type: application/json' -d '{"operationName": "Player", "query": "query Player($id: ID!) {\n player(id: $id) {\n id\n firstName\n lastName\n displayName\n country\n countryFlag\n bioLink\n owgr\n playerBio {\n heightImperial\n heightMeters\n weightImperial\n weightKilograms\n age\n born\n birthplace { city state country }\n turnedPro\n school\n degree\n graduationYear\n residence { city state country }\n family\n }\n }\n}\n", "variables": {"id": "28237"}}'

API ParameterPythonInPatternRequiredNullableDescription
idplayer_idbodyYPGA TOUR player id, e.g. 28237.

Returns​

return_parsed=True (default) — a tidy polars.DataFrame with the columns below; pass return_as_pandas=True for a pandas.DataFrame.

col_nametypedescription
player_idStringPGA TOUR player id.
first_nameStringPlayer's first (given) name.
last_nameStringPlayer's last (family) name.
display_nameStringPlayer's full name as the site displays it (e.g. "Rory McIlroy").
countryStringCountry the player represents.
country_codeStringCountry code (e.g. "NIR").
owgrStringOfficial World Golf Ranking position as displayed.
heightStringHeight in feet and inches as displayed.
height_metersStringHeight in meters.
weightStringWeight in pounds.
weight_kilogramsStringWeight in kilograms.
ageStringPlayer's age in years, as text (e.g. "37").
bornStringBirth date as displayed (e.g. "May 4, 1989").
birthplace_cityStringBirthplace city.
birthplace_stateStringBirthplace state or province.
birthplace_countryStringBirthplace country.
turned_proStringYear the player turned professional.
schoolStringCollege or university.
residence_cityStringCity of residence.
residence_stateStringState or province of residence.
residence_countryStringCountry of residence.
familyStringFamily as listed on the profile.
bio_linkStringThe player's pgatour.com profile URL.

return_parsed=False — the operation's answer (dict), its compressed payload decoded; pgatour_past_champions adds the tournamentId it was asked for, which the answer does not repeat.

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist. The API answered null for the request (an unknown tournament, player or stat id), or pgatour_past_results was asked for a season the tournament has no edition in.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help. The API rejected the query variables, or a variable is not of its type (a year that is not a season).
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty. Any other GraphQL error, or a compressed payload that does not decode.

Example​

pgatour_player(player_id='28237')

pgatour_player_directory​

A tour's player directory: one row per player (id, name, country, age, college, year turned pro).

Endpoint URL: POST https://orchestrator.pgatour.com/graphql

Example request: curl -X POST 'https://orchestrator.pgatour.com/graphql' -H 'Content-Type: application/json' -d '{"operationName": "PlayerDirectory", "query": "query PlayerDirectory($tourCode: TourCode!, $active: Boolean) {\n playerDirectory(tourCode: $tourCode, active: $active) {\n tourCode\n players {\n id\n isActive\n firstName\n lastName\n shortName\n displayName\n country\n countryFlag\n playerBio { age education turnedPro }\n }\n }\n}\n", "variables": {"tourCode": "R"}}'

API ParameterPythonInPatternRequiredNullableDescription
tourCodetour_codebodyYTour code (R PGA TOUR, S PGA TOUR Champions, H Korn Ferry Tour).
activeactivebodyYTrue for active players only; omitted, every player in the directory.

Returns​

return_parsed=True (default) — a tidy polars.DataFrame with the columns below; pass return_as_pandas=True for a pandas.DataFrame.

col_nametypedescription
tour_codeStringTour code (R PGA TOUR, S PGA TOUR Champions, H Korn Ferry Tour).
player_idStringPGA TOUR player id.
is_activeBooleanTrue for a player active on the tour.
first_nameStringPlayer's first (given) name.
last_nameStringPlayer's last (family) name.
short_nameStringPlayer's first initial and last name (e.g. "L Åberg").
display_nameStringPlayer's full name as the site displays it (e.g. "Ludvig Åberg").
countryStringCountry the player represents.
country_codeStringThree-letter code of the country the player represents (e.g. "SWE").
ageStringPlayer's age in years, as text (e.g. "27"); null when the profile gives none.
educationStringCollege or university.
turned_proStringYear the player turned professional.

return_parsed=False — the operation's answer (dict), its compressed payload decoded; pgatour_past_champions adds the tournamentId it was asked for, which the answer does not repeat.

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist. The API answered null for the request (an unknown tournament, player or stat id), or pgatour_past_results was asked for a season the tournament has no edition in.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help. The API rejected the query variables, or a variable is not of its type (a year that is not a season).
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty. Any other GraphQL error, or a compressed payload that does not decode.

Example​

pgatour_player_directory(tour_code='R')

pgatour_player_results​

A player's career results on a tour: one row per tournament edition played (finish, score to par, total, points, money, round scores).

Endpoint URL: POST https://orchestrator.pgatour.com/graphql

Example request: curl -X POST 'https://orchestrator.pgatour.com/graphql' -H 'Content-Type: application/json' -d '{"operationName": "PlayerProfileTournamentResults", "query": "query PlayerProfileTournamentResults($playerId: ID!, $tourCode: TourCode) {\n playerProfileTournamentResults(playerId: $playerId, tourCode: $tourCode) {\n playerId\n tournaments {\n tournamentNum\n tournaments {\n tournamentId\n tournamentName\n year\n startDate\n courseName\n position\n toPar\n total\n points\n pointsRank\n winnings\n roundScores {\n roundNum\n roundScore\n }\n }\n }\n }\n}\n", "variables": {"playerId": "28237", "tourCode": "R"}}'

API ParameterPythonInPatternRequiredNullableDescription
playerIdplayer_idbodyYPGA TOUR player id, e.g. 28237.
tourCodetour_codebodyYTour code (R PGA TOUR, S PGA TOUR Champions, H Korn Ferry Tour).

Returns​

return_parsed=True (default) — a tidy polars.DataFrame with the columns below; pass return_as_pandas=True for a pandas.DataFrame.

col_nametypedescription
player_idStringPGA TOUR player id.
tournament_numStringTournament's permanent number (usually the last three digits of its tournament ids, e.g. "014").
tournament_idStringTournament id of the edition (e.g. "R2015009").
tournament_nameStringTournament name in that edition's season.
seasonInt64Season of the edition.
start_dateStringEdition start date as displayed (e.g. "3.19.2015").
course_nameStringCourse the edition was played on.
positionStringFinishing position as displayed ("1", "T11", "CUT", "DNS").
to_parStringScore to par as displayed (e.g. "-11").
totalInt64Total strokes; null for a match-play event.
pointsStringSeason points race (FedExCup) points earned, as displayed.
points_rankStringPoints race rank after the event, as displayed.
winningsStringPrize money as displayed (e.g. "$151,200.00").
round_1Int64Strokes in round 1.
round_2Int64Strokes in round 2.
round_3Int64Strokes in round 3; null for a round not played.
round_4Int64Strokes in round 4; null for a round not played.

return_parsed=False — the operation's answer (dict), its compressed payload decoded; pgatour_past_champions adds the tournamentId it was asked for, which the answer does not repeat.

Raises​

ExceptionDescription
NoDataErrorThe host answered 404 -- the requested resource does not exist. The API answered null for the request (an unknown tournament, player or stat id), or pgatour_past_results was asked for a season the tournament has no edition in.
ValueErrorThe host answered 400 / 422 -- the request is wrong; retrying cannot help. The API rejected the query variables, or a variable is not of its type (a year that is not a season).
AssetFetchErrorThe fetch failed (a non-2xx answer or a connection failure after retries, e.g. 401/403/429/5xx, or an empty or unreadable 200 body) -- the answer is unknown, not empty. Any other GraphQL error, or a compressed payload that does not decode.

Example​

pgatour_player_results(player_id='28237', tour_code='R')