Discover the contract
Start with API discovery and OpenAPI. There is no SDK. For MCP clients, use the MCP server.
Use the same authentication and access rules as any application.
Keep the tool small
Expose GET requests only. Keep the API key in the tool's server environment. Allow only the API origin, validate filter inputs, and bound pages, request count, retries, and execution time. Pass through request IDs and actionable errors.
JavaScript
const response = await fetch('https://api.golfapi.dev/drivers?limit=1', {
headers: { Authorization: `Bearer ${process.env.GOLFDEV_API_KEY}` },
signal: AbortSignal.timeout(10000),
});
if (!response.ok) throw new Error(`GolfAPI.dev ${response.status}: ${response.headers.get('Golfapi-Request-Id')}`);
const { data, page } = await response.json();
Python
Install the requests package in your application environment.
import os
import requests
response = requests.get(
'https://api.golfapi.dev/drivers',
params={'limit': 1},
headers={'Authorization': f"Bearer {os.environ['GOLFDEV_API_KEY']}"},
timeout=10,
)
response.raise_for_status()
result = response.json()
Report data and access limits
Use Catalog to interpret missing values and empty results. Report permission errors, unavailable resources and empty results separately. Do not purchase a subscription, rotate credentials or change an account as automatic recovery.