← API Store
Search & SEO
Google Maps
Google Maps
Google Maps directions
GET /google-maps/v1/directionsRoutes between two points for a travel mode: distance, duration (typical and in current traffic), warnings (tolls, ferries) and turn-by-turn steps. Points are lat,lng or a place name (resolved with a Maps search). Every response includes credits_used: the credits this call cost.
Each call costs 1 credits; failed calls are free. Run it in the console playground to see a live result.
Parameters
| Name | Type | Description |
|---|---|---|
originrequired | string | Start: `lat,lng` or a place name. Example: 40.7580,-73.9855 |
destinationrequired | string | End: `lat,lng` or a place name. Example: JFK Airport |
mode | string | driving (default), walking, cycling or transit. Example: driving |
hl | string | Language (default en). |
gl | string | Country (default us). |
Every endpoint also takes: raw、fields、fresh、output、records
{
"cached": false,
"credits_used": 1,
"destination": {
"lat": 40.6446124,
"lng": -73.7797278,
"name": "John F. Kennedy International Airport"
},
"mode": "driving",
"origin": {
"lat": 40.758,
"lng": -73.9855,
"name": null
},
"routes": [
{
"distance": "17.4 miles",
"distance_m": 27937,
"duration": "41 min",
"duration_s": 2453,
"duration_typical": "1 hr 13 min",
"legs": [
{
"distance": "17.4 mi",
"distance_m": 27937,
"duration": "41 min",
"duration_in_traffic": "1 hr 13 min",
"duration_s": 2455,
"steps": [
{
"…": "6 fields"
},
{
"…": "6 fields"
},
"… 18 more"
]
}
],
"position": 1,
"summary": "I-495",
"warnings": [
"This route has tolls."
]
},
{
"distance": "17.0 miles",
"distance_m": 27343,
"duration": "1 hr 6 min",
"duration_s": 3930,
"duration_typical": "1 hr 27 min",
"legs": [
{
"distance": "17.0 mi",
"distance_m": 27343,
"duration": "1 hr 6 min",
"duration_in_traffic": "1 hr 27 min",
"duration_s": 3930,
"steps": [
{
"…": "6 fields"
},
{
"…": "6 fields"
},
"… 25 more"
]
}
],
"position": 2,
"summary": "Queens Blvd",
"warnings": []
},
"… 1 more"
]
} Response fields (33)
Field paths and types observed in the sample response; the live response is authoritative.
$ | object |
$.cached | boolean |
$.credits_used | integer |
$.destination | object |
$.destination.lat | number |
$.destination.lng | number |
$.destination.name | string |
$.mode | string |
$.origin | object |
$.origin.lat | number |
$.origin.lng | number |
$.origin.name | null |
$.routes | array |
$.routes[] | object | string |
$.routes[].distance | string |
$.routes[].distance_m | integer |
$.routes[].duration | string |
$.routes[].duration_s | integer |
$.routes[].duration_typical | string |
$.routes[].legs | array |
$.routes[].legs[] | object |
$.routes[].legs[].distance | string |
$.routes[].legs[].distance_m | integer |
$.routes[].legs[].duration | string |
$.routes[].legs[].duration_in_traffic | string |
$.routes[].legs[].duration_s | integer |
$.routes[].legs[].steps | array |
$.routes[].legs[].steps[] | object | string |
$.routes[].legs[].steps[].… | string |
$.routes[].position | integer |
$.routes[].summary | string |
$.routes[].warnings | array |
$.routes[].warnings[] | string |