The Isochrones API returns errors using the standard Google Cloud
google.rpc.Status JSON format:
{
"error": {
"code": 400,
"message": "Violation in GenerateIsochroneRequest.travel_duration: travel_duration must be at least 1 second and not exceed 3600 seconds (60 minutes) for DRIVE or TWO_WHEELER mode or 7200 seconds (120 minutes) for other modes",
"status": "INVALID_ARGUMENT"
}
}
Use the status (or HTTP code) field to handle errors programmatically. The
message text is intended for developers and might change, so don't parse it.
When working with the Isochrones API, you might encounter the following common error status codes:
400 INVALID_ARGUMENT: The request contains invalid parameters or malformed syntax:- Duration bounds: Make sure
travelDurationis at least"1s", ends with"s"(such as"1800s"), and doesn't exceed the mode limit:3600s(60 minutes) forDRIVEandTWO_WHEELER, or7200s(120 minutes) forWALKandBICYCLE. Zero ("0s"), negative values, and sub-second values under 1 second (such as"0.5s") are rejected. - Traffic preference: Make sure
routingPreferenceisn't set toTRAFFIC_AWAREwhentravelModeisWALKorBICYCLE. Live traffic is only supported forDRIVEandTWO_WHEELER. - Required enums: Ensure both
travelModeandtravelDirection(FROMorTO) are specified and aren't set to*_UNSPECIFIED. - Origin coordinates (
location): Set bothlatitude(in[-90, 90]) andlongitude(in[-180, 180]). An omitted field is treated as0without an error: omitting both gives(0, 0), which is rejected; omitting onlylatitudeplaces the origin on the Equator; and omitting onlylongitudeplaces it on the prime meridian. - Place ID format (
place): Ensureplaceis a place ID or aplaces/{place_id}resource name (for example,"places/ChIJIQBpAG2ahYAR_6128GcTUEo"), with no extra path segments, and refers to a valid place ID. - Field mask (
X-Goog-FieldMask): If provided, the header must reference valid response paths such asisochrone,isochrone.geoJson, or*. - Invalid API key (
API_KEY_INVALID): A malformed or unrecognized API key inX-Goog-Api-Keyor?key=returns400 INVALID_ARGUMENTwith reasonAPI_KEY_INVALID.
- Duration bounds: Make sure
403 PERMISSION_DENIED: Authentication or authorization failed:- No authentication credentials (
X-Goog-Api-Key,?key=, orAuthorization: Bearertoken) were provided in the request. - The Isochrones API (
isochrones.googleapis.com) isn't enabled on your Google Cloud project, or billing isn't enabled. - Your API key has API target, IP address, or HTTP referrer restrictions
that block requests to
isochrones.googleapis.com.
- No authentication credentials (
404 NOT_FOUND: The origin couldn't be resolved or snapped to the road network:- The
placecouldn't be resolved to a location. Check that the place ID is valid and current. - The origin
locationorplacecentroid lies farther from a mode-compatible road segment than the maximum snapping distance (about 200 meters, or less forWALKandBICYCLE). Move the coordinate closer to a public road or pass road-entrance coordinates instead of a large park or landmark place ID. - The coordinate is in an area without road data (such as open ocean).
- The
429 RESOURCE_EXHAUSTED: Your project exceeded its per-minute quota limit (default 300 requests per minute):{ "error": { "code": 429, "message": "Quota exceeded for quota metric 'Requests' and limit 'Requests per minute' of service 'isochrones.googleapis.com'.", "status": "RESOURCE_EXHAUSTED" } }Throttle client request rates and retry
429responses using exponential backoff with randomized jitter.503 UNAVAILABLE: The service is temporarily unavailable or overloaded. Retry the request using exponential backoff.500 INTERNAL: An internal server error occurred, such as a backend timeout. Retry the request using exponential backoff.