Skip to main content

Errors and status codes

The API uses standard HTTP status codes and returns errors as JSON. Applications should check the HTTP status before processing the response body.

Error response

An error response can contain a status code, machine-readable error identifier and human-readable message:

{
"statusCode": 400,
"error": "Bad Request",
"message": "radius_km requires near or both lat and lon"
}

Do not build application logic around the human-readable message. Messages may become clearer over time without constituting an API contract change. Use the HTTP status and a machine-readable error code when one is provided.

Common status codes

StatusMeaningRecommended action
200 OKThe request succeededProcess the response
400 Bad RequestA parameter or request value is invalidCorrect the request before retrying
401 UnauthorizedThe API key is missing, invalid or revokedCheck the Bearer token
403 ForbiddenThe key is valid but lacks permissionRequest the required scope or use another key
404 Not FoundThe requested resource does not existVerify the endpoint and club slug
429 Too Many RequestsThe applicable rate limit was exceededWait before retrying
500 Internal Server ErrorThe API could not complete the requestRetry later with backoff
502 Bad GatewayA required upstream service failedRetry later with backoff
503 Service UnavailableThe service is temporarily unavailableRetry later with backoff

Place search may return location_not_found, geocoding_api_key_invalid, geocoding_configuration_error, geocoding_quota_exceeded, geocoding_failed or geocoding_unavailable. See place and radius search.

Handle errors in JavaScript

const response = await fetch(
'https://api.eae.golf/v1/clubs?limit=20',
{
headers: {
Authorization: `Bearer ${apiKey}`,
Accept: 'application/json'
}
}
);

const body = await response.json().catch(() => null);

if (!response.ok) {
throw new Error(
body?.message ?? `API request failed with status ${response.status}`
);
}

Retrying requests

Do not automatically retry validation, authentication or permission errors. The request must be corrected first.

Temporary server errors and rate-limit responses may be retried. Use exponential backoff with a small random delay and respect Retry-After whenever the header is present.

Avoid unlimited retries. Set a maximum number of attempts and report a useful error when the API remains unavailable.

Request identifiers

When a response contains a request identifier, record it in application logs. Include that identifier when reporting an API problem, but never include the API key itself.