You need to ship a JavaScript integration that finds golf courses and returns real scorecards, tee boxes, ratings, and coordinates. By the end of this guide, you’ll query the Golf Courses Data API on Zyla API Hub from JavaScript, handle responses, and know how to search by course name, coordinates, or state/province with copy-pasteable code.
What the Golf Courses Data API provides
The Golf Courses Data API returns structured data for golf courses, including location (address, city, state, country, latitude, longitude), contact details, hole count, tee boxes, slope and course ratings, and complete scorecards with per-hole yardages and totals. It’s used in sports apps, tee-time finders, course directories, and dashboards that need accurate course details.
You’ll access it via Zyla API Hub’s unified interface: one account, one API key, and a subscription + quota model (not pay-per-call). This API offers a 7-day trial or 50 requests to start; there’s no Free Plan. Check the API page for current access options and pricing.
Getting started on Zyla API Hub
- Open the Golf Courses Data API page on Zyla API Hub.
- Click Subscribe or Start Free Trial (when available) to get your API key.
- Include the header Authorization: Bearer YOUR_API_KEY in every request.
Zyla API Hub hosts more than 10,000 public APIs across categories, and all share the same auth pattern and marketplace experience. Create your account now to get an API key: Register.
Endpoints you can use today
Below are the available endpoints for the Golf Courses Data API, including methods, exact URLs, and the required parameters. All requests must include the Authorization header. Copy the provided curl examples exactly to validate your setup before coding.
1) Golf courses by name
Retrieve detailed golf course information by course name. The response can include location, contact, hole count, tee boxes, ratings, handicap indexes, and complete scorecards.
- Method: GET
- URL: https://zylalabs.com/api/2029/golf-courses-data-api/3594/golf-courses-by-name
- Required query parameter:
- filter[courseName] (string): e.g., Granadilla
Official curl (copy-paste):
curl -s -X GET "https://zylalabs.com/api/2029/golf-courses-data-api/3594/golf-courses-by-name?filter%5BcourseName%5D=Granadilla" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example JSON response:
{"courses":[{"courseName":"Franklin Bridge Golf Club","address1":"750 Riverview Dr.","city":"Franklin","state":"Tennessee","country":"USA","telephone":"6157949400","ratings":"[]","latitude":"35.8930130","longitude":"-86.8406430"},{"courseName":"Franklin Bridge Golf Course","address1":"","city":"Franklin","state":"Tennessee","country":"USA","telephone":"","latitude":"35.8912540","longitude":"-86.8393630","website":"","holes":18,"lengthFormat":"Y","scorecard":"[{\"1\": \"4\", \"2\": \"5\", \"3\": \"3\", \"4\": \"4\", \"5\": \"3\", \"6\": \"4\", \"7\": \"4\", \"8\": \"4\", \"9\": \"5\", \"Out\": \"36\", \"Hole:\": \"Par:\"}, {\"1\": \"350\", \"2\": \"469\", \"3\": \"166\", \"4\": \"356\", \"5\": \"169\", \"6\": \"363\", \"7\": \"416\", \"8\": \"356\", \"9\": \"503\", \"Out\": \"3148\", \"Hole:\": \"Gold:\"}, {\"1\": \"0\", \"2\": \"0\", \"3\": \"0\", \"4\": \"0\", \"5\": \"0\", \"6\": \"0\", \"7\": \"0\", \"8\": \"0\", \"9\": \"0\", \"Out\": \"0\", \"Hole:\": \"Gold (May 2023):\"}, {\"1\": \"17\", \"2\": \"9\", \"3\": \"13\", \"4\": \"5\", \"5\": \"15\", \"6\": \"11\", \"7\": \"1\", \"8\": \"7\", \"9\": \"3\", \"Out\": \"\", \"Hole:\": \"Handicap:\"}, {\"10\": \"5\", \"11\": \"4\", \"12\": \"3\", \"13\": \"4\", \"14\": \"3\", \"15\": \"4\", \"16\": \"4\", \"17\": \"5\", \"18\": \"4\", \"In\": \"36\", \"Hole:\": \"Par:\", \"Total\": \"72\"}, {\"10\": \"503\", \"11\": \"347\", \"12\": \"162\", \"13\": \"380\", \"14\": \"164\", \"15\": \"354\", \"16\": \"371\", \"17\": \"539\", \"18\": \"327\", \"In\": \"3147\", \"Hole:\": \"Gold:\", \"Total\": \"6295\"}, {\"10\": \"0\", \"11\": \"0\", \"12\": \"0\", \"13\": \"0\", \"14\": \"0\", \"15\": \"0\", \"16\": \"0\", \"17\": \"0\", \"18\": \"0\", \"In\": \"0\", \"Hole:\": \"Gold (May 2023):\", \"Total\": \"6067\"}, {\"10\": \"8\", \"11\": \"18\", \"12\": \"14\", \"13\": \"2\", \"14\": \"16\", \"15\": \"10\", \"16\": \"12\", \"17\": \"6\", \"18\": \"4\", \"In\": \"\", \"Hole:\": \"Handicap:\", \"Total\": \"\"}]","teeBoxes":"[{\"name\": \"Gold\", \"slope\": \"121\", \"rating\": \"70.5\"}, {\"name\": \"Gold (May 2023)\", \"slope\": \"120\", \"rating\": \"69.2\"}]"},{"courseName":"Franklin Canyon GC","address1":"Highway 4","city":"Hercules","state":"California","country":"USA","ratings":"[]","latitude":"38.0054700","longitude":"-122.2160290"},{"courseName":"Franklin Canyon Golf Course","address1":"CA-4","city":"Hercules","state":"California","country":"USA","telephone":"(510) 799-6191","latitude":"38.0148580","longitude":"-…
What you’ll actually use: - courses is an array. Each item can include courseName, address1, city, state, country, telephone, latitude, longitude. - Some items include holes, lengthFormat (Y for yards), scorecard (stringified JSON with per-hole Par and yardages), and teeBoxes (stringified JSON with tee name, slope, rating). - Treat scorecard and teeBoxes as strings that may need JSON parsing in your app before use.
2) Golf courses by coordinates
Find courses around a latitude/longitude within a specified radius. The radius must not be greater than 50. Pagination is supported via page.
- Method: GET
- URL: https://zylalabs.com/api/2029/golf-courses-data-api/3595/golf-courses-by-coordinates
- Required query parameters:
- radius (string): e.g., 10
- latitude (string): e.g., 4.702282
- longitude (string): e.g., -74.082695
- page (string): e.g., 1
Official curl (copy-paste):
Note on units and pagination: - radius is a numeric string and must be ≤ 50. - Use page to iterate through results; the response includes a courses array you can accumulate across pages.
3) Golf clubs by state or province
Retrieve golf courses filtered by state, with course name, address, location fields, contact details, and coordinates. Supports pagination with per_page and page.
- Method: GET
- URL: https://zylalabs.com/api/2029/golf-courses-data-api/3600/golf-clubs-by-state-or-province
- Required query parameters:
- filter[state] (string): e.g., florida
- per_page (number): e.g., 1
- page (number): e.g., 1
Official curl (copy-paste):
Use per_page and page to page through the dataset for a given state/province in your UI or ingestion task.
JavaScript: fetch the Golf Courses Data API
The following JavaScript example calls the “Golf courses by name” endpoint, handles auth, and safely parses the fields you’ll commonly display. This matches the official curl shown above.
// Label: JavaScript fetch example (Golf courses by name)
const API_URL = "https://zylalabs.com/api/2029/golf-courses-data-api/3594/golf-courses-by-name?filter%5BcourseName%5D=Granadilla";
async function fetchCoursesByName() {
const res = await fetch(API_URL, {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_API_KEY"
}
});
if (!res.ok) {
const text = await res.text();
throw new Error(`HTTP ${res.status}: ${text}`);
}
const data = await res.json();
// Expect data.courses to be an array
const courses = Array.isArray(data.courses) ? data.courses : [];
// Map to minimal objects your UI needs
return courses.map((c) => {
// scorecard and teeBoxes may arrive as stringified JSON
let scorecard = null;
if (typeof c.scorecard === "string" && c.scorecard.trim().startsWith("[")) {
try { scorecard = JSON.parse(c.scorecard); } catch { /* keep null */ }
}
let teeBoxes = null;
if (typeof c.teeBoxes === "string" && c.teeBoxes.trim().startsWith("[")) {
try { teeBoxes = JSON.parse(c.teeBoxes); } catch { /* keep null */ }
}
return {
name: c.courseName,
address: c.address1,
city: c.city,
state: c.state,
country: c.country,
telephone: c.telephone,
latitude: c.latitude,
longitude: c.longitude,
holes: c.holes,
lengthFormat: c.lengthFormat, // "Y" = yards (per listing)
scorecard,
teeBoxes
};
});
}
// Example usage
fetchCoursesByName()
.then((courses) => {
console.log("Courses:", courses);
const withScorecards = courses.filter(c => Array.isArray(c.scorecard));
if (withScorecards.length > 0) {
const first = withScorecards[0];
console.log("First course with scorecard:", first.name);
// Example: get front-nine Par total if present
const parRow = first.scorecard.find(r => r["Hole:"] === "Par:");
if (parRow && parRow["Out"]) {
console.log("Front nine Par total (Out):", parRow["Out"]);
}
// Tee boxes with slope/rating if available
console.log("Tee boxes:", first.teeBoxes);
}
})
.catch((err) => {
console.error("API error:", err);
});
cURL quick tests
Verify your key and network path with curl before coding. Use the official examples below exactly as shown (replace YOUR_API_KEY only):
By name:
By coordinates (radius ≤ 50):
By state or province (paginate with per_page and page):
Real-world implementation notes
- Authentication: Always send Authorization: Bearer YOUR_API_KEY. Do not include keys in query params.
- Scorecard parsing: Some responses include scorecard and teeBoxes as JSON strings. Check typeof first, then JSON.parse inside a try/catch.
- Units: lengthFormat "Y" denotes yardage; your UI can display units accordingly.
- Pagination:
- State/province endpoint supports per_page and page.
- Coordinates endpoint requires page; iterate pages for full coverage.
- Radius constraint: For the coordinates search, radius must not be greater than 50.
- Caching: If you show static course data (address, tee boxes, scorecards), consider caching responses locally to reduce redundant calls within your quota.
- Error handling: Treat non-2xx as errors; log response text for diagnostics.
- Quotas and subscriptions: Zyla APIs use subscription + quota, not pay-per-call. This API offers a 7-day trial or 50 requests to get started. Monitor your usage in your Zyla dashboard.
Use cases you can ship this week
- Search UI by name: Provide a minimal input that calls the “golf-courses-by-name” endpoint and lists city/state and a link to the scorecard view.
- Nearby courses map: Use the coordinates endpoint with the device’s current position (geolocation API in your frontend). Respect the radius ≤ 50 rule and paginate through results.
- State directory: Build a landing page for a state or province by hitting the state filter endpoint with per_page/page controls. Add infinite scroll to iterate pages.
- Scorecard viewer: When scorecard is present, parse the JSON string and render front/back nine Par rows and tee yardages. Include tee box slope and rating for golfers comparing difficulty.
Call this API from AI agents via MCP
Every API on Zyla can be called from AI agents through the MCP endpoint. See the docs here: MCP. MCP works with Claude Code, Cursor, Windsurf, and any MCP-compatible client. Pass your Zyla API key (apikey=YOUR_API_KEY) and call the exact Hub URLs listed above. This lets you wire the Golf Courses Data API into coding agents to scaffold fetch calls, test parameters, or transform responses.
Full integration checklist
- Create your Zyla account and subscribe to the API.
- Store YOUR_API_KEY securely (server-side environment variable for backend calls).
- Validate with the official curl example (expect a courses array in JSON).
- Implement JavaScript fetch with Authorization header.
- Parse stringified fields (scorecard, teeBoxes) safely.
- Handle pagination (page, per_page) where applicable.
- Keep radius ≤ 50 for coordinate-based searches.
- Cache stable course data to conserve quota.
FAQ
What authentication does the Golf Courses Data API use?
Use the header Authorization: Bearer YOUR_API_KEY on every request.
Is there a free plan?
There is no Free Plan. The API offers a 7-day trial or 50 requests to start. Check the API page for current access options and pricing.
How do I search by location?
Use the coordinates endpoint with radius, latitude, longitude, and page. The radius must not be greater than 50.
How do I handle pagination?
The state/province endpoint takes per_page and page. The coordinates endpoint requires page. Loop over page values until you have all the results you need.
Why are scorecards or tee boxes strings?
Some fields like scorecard and teeBoxes arrive as stringified JSON. Check if the value is a string and parse it (try/catch) before rendering.
Ready to build? Create your account on Zyla API Hub, subscribe to the Golf Courses Data API, and get your key to start testing: Register. You can explore more sports APIs and thousands of others on Zyla API Hub and ship your integration this week.
Official API response
{"courses":[{"courseName":"Franklin Bridge Golf Club","address1":"750 Riverview Dr.","city":"Franklin","state":"Tennessee","country":"USA","telephone":"6157949400","ratings":"[]","latitude":"35.8930130","longitude":"-86.8406430"},{"courseName":"Franklin Bridge Golf Course","address1":"","city":"Franklin","state":"Tennessee","country":"USA","telephone":"","latitude":"35.8912540","longitude":"-86.8393630","website":"","holes":18,"lengthFormat":"Y","scorecard":"[{\"1\": \"4\", \"2\": \"5\", \"3\": \"3\", \"4\": \"4\", \"5\": \"3\", \"6\": \"4\", \"7\": \"4\", \"8\": \"4\", \"9\": \"5\", \"Out\": \"36\", \"Hole:\": \"Par:\"}, {\"1\": \"350\", \"2\": \"469\", \"3\": \"166\", \"4\": \"356\", \"5\": \"169\", \"6\": \"363\", \"7\": \"416\", \"8\": \"356\", \"9\": \"503\", \"Out\": \"3148\", \"Hole:\": \"Gold:\"}, {\"1\": \"0\", \"2\": \"0\", \"3\": \"0\", \"4\": \"0\", \"5\": \"0\", \"6\": \"0\", \"7\": \"0\", \"8\": \"0\", \"9\": \"0\", \"Out\": \"0\", \"Hole:\": \"Gold (May 2023):\"}, {\"1\": \"17\", \"2\": \"9\", \"3\": \"13\", \"4\": \"5\", \"5\": \"15\", \"6\": \"11\", \"7\": \"1\", \"8\": \"7\", \"9\": \"3\", \"Out\": \"\", \"Hole:\": \"Handicap:\"}, {\"10\": \"5\", \"11\": \"4\", \"12\": \"3\", \"13\": \"4\", \"14\": \"3\", \"15\": \"4\", \"16\": \"4\", \"17\": \"5\", \"18\": \"4\", \"In\": \"36\", \"Hole:\": \"Par:\", \"Total\": \"72\"}, {\"10\": \"503\", \"11\": \"347\", \"12\": \"162\", \"13\": \"380\", \"14\": \"164\", \"15\": \"354\", \"16\": \"371\", \"17\": \"539\", \"18\": \"327\", \"In\": \"3147\", \"Hole:\": \"Gold:\", \"Total\": \"6295\"}, {\"10\": \"0\", \"11\": \"0\", \"12\": \"0\", \"13\": \"0\", \"14\": \"0\", \"15\": \"0\", \"16\": \"0\", \"17\": \"0\", \"18\": \"0\", \"In\": \"0\", \"Hole:\": \"Gold (May 2023):\", \"Total\": \"6067\"}, {\"10\": \"8\", \"11\": \"18\", \"12\": \"14\", \"13\": \"2\", \"14\": \"16\", \"15\": \"10\", \"16\": \"12\", \"17\": \"6\", \"18\": \"4\", \"In\": \"\", \"Hole:\": \"Handicap:\", \"Total\": \"\"}]","teeBoxes":"[{\"name\": \"Gold\", \"slope\": \"121\", \"rating\": \"70.5\"}, {\"name\": \"Gold (May 2023)\", \"slope\": \"120\", \"rating\": \"69.2\"}]"},{"courseName":"Franklin Canyon GC","address1":"Highway 4","city":"Hercules","state":"California","country":"USA","ratings":"[]","latitude":"38.0054700","longitude":"-122.2160290"},{"courseName":"Franklin Canyon Golf Course","address1":"CA-4","city":"Hercules","state":"California","country":"USA","telephone":"(510) 799-6191","latitude":"38.0148580","longitude":"-…
Official API response
{"courses":[{"courseName":"Franklin Bridge Golf Club","address1":"750 Riverview Dr.","city":"Franklin","state":"Tennessee","country":"USA","telephone":"6157949400","ratings":"[]","latitude":"35.8930130","longitude":"-86.8406430"},{"courseName":"Franklin Bridge Golf Course","address1":"","city":"Franklin","state":"Tennessee","country":"USA","telephone":"","latitude":"35.8912540","longitude":"-86.8393630","website":"","holes":18,"lengthFormat":"Y","scorecard":"[{\"1\": \"4\", \"2\": \"5\", \"3\": \"3\", \"4\": \"4\", \"5\": \"3\", \"6\": \"4\", \"7\": \"4\", \"8\": \"4\", \"9\": \"5\", \"Out\": \"36\", \"Hole:\": \"Par:\"}, {\"1\": \"350\", \"2\": \"469\", \"3\": \"166\", \"4\": \"356\", \"5\": \"169\", \"6\": \"363\", \"7\": \"416\", \"8\": \"356\", \"9\": \"503\", \"Out\": \"3148\", \"Hole:\": \"Gold:\"}, {\"1\": \"0\", \"2\": \"0\", \"3\": \"0\", \"4\": \"0\", \"5\": \"0\", \"6\": \"0\", \"7\": \"0\", \"8\": \"0\", \"9\": \"0\", \"Out\": \"0\", \"Hole:\": \"Gold (May 2023):\"}, {\"1\": \"17\", \"2\": \"9\", \"3\": \"13\", \"4\": \"5\", \"5\": \"15\", \"6\": \"11\", \"7\": \"1\", \"8\": \"7\", \"9\": \"3\", \"Out\": \"\", \"Hole:\": \"Handicap:\"}, {\"10\": \"5\", \"11\": \"4\", \"12\": \"3\", \"13\": \"4\", \"14\": \"3\", \"15\": \"4\", \"16\": \"4\", \"17\": \"5\", \"18\": \"4\", \"In\": \"36\", \"Hole:\": \"Par:\", \"Total\": \"72\"}, {\"10\": \"503\", \"11\": \"347\", \"12\": \"162\", \"13\": \"380\", \"14\": \"164\", \"15\": \"354\", \"16\": \"371\", \"17\": \"539\", \"18\": \"327\", \"In\": \"3147\", \"Hole:\": \"Gold:\", \"Total\": \"6295\"}, {\"10\": \"0\", \"11\": \"0\", \"12\": \"0\", \"13\": \"0\", \"14\": \"0\", \"15\": \"0\", \"16\": \"0\", \"17\": \"0\", \"18\": \"0\", \"In\": \"0\", \"Hole:\": \"Gold (May 2023):\", \"Total\": \"6067\"}, {\"10\": \"8\", \"11\": \"18\", \"12\": \"14\", \"13\": \"2\", \"14\": \"16\", \"15\": \"10\", \"16\": \"12\", \"17\": \"6\", \"18\": \"4\", \"In\": \"\", \"Hole:\": \"Handicap:\", \"Total\": \"\"}]","teeBoxes":"[{\"name\": \"Gold\", \"slope\": \"121\", \"rating\": \"70.5\"}, {\"name\": \"Gold (May 2023)\", \"slope\": \"120\", \"rating\": \"69.2\"}]"},{"courseName":"Franklin Canyon GC","address1":"Highway 4","city":"Hercules","state":"California","country":"USA","ratings":"[]","latitude":"38.0054700","longitude":"-122.2160290"},{"courseName":"Franklin Canyon Golf Course","address1":"CA-4","city":"Hercules","state":"California","country":"USA","telephone":"(510) 799-6191","latitude":"38.0148580","longitude":"-…