Get directions
goplaces_directionsGet directions between two locations with distance, duration, and warnings. Specify endpoints by text, place ID, or coordinates for walking, driving, cycling, or transit routes.
Instructions
Get directions, distance, duration, warnings, and optional steps between two locations using Google Routes. Each endpoint can be specified by text, place ID, or latitude/longitude. Supports walk, drive, bicycle, transit, units, departure/arrival time, drive avoid modifiers, and one compare mode.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Primary travel mode. Defaults to drive; pass walk explicitly for a walking route. | drive |
| units | No | Localized distance units. | metric |
| region | No | Optional CLDR region code, for example 'US' or 'DE'. | |
| to_lat | No | Destination latitude. Must be paired with to_lng. | |
| to_lng | No | Destination longitude. Must be paired with to_lat. | |
| to_text | No | Destination as an address or place name. Use only one destination form. | |
| from_lat | No | Origin latitude. Must be paired with from_lng. | |
| from_lng | No | Origin longitude. Must be paired with from_lat. | |
| language | No | Optional BCP-47 language code, for example 'en' or 'en-US'. | |
| from_text | No | Origin as an address or place name. Use only one origin form. | |
| waypoints | No | Up to 25 intermediate stops, in order, as addresses or place names. Text only; place IDs are not accepted here. | |
| avoid_tolls | No | Avoid toll roads. Requires drive mode for the affected route. | |
| to_place_id | No | Destination Google place ID. Use only one destination form. | |
| alternatives | No | Return alternative routes as well. Cannot be combined with waypoints. | |
| arrival_time | No | Optional RFC3339 transit arrival time. Requires transit mode and is mutually exclusive with departure_time. | |
| compare_mode | No | Optional second travel mode to compare with mode. | |
| avoid_ferries | No | Avoid ferries. Requires drive mode for the affected route. | |
| from_place_id | No | Origin Google place ID. Use only one origin form. | |
| include_steps | No | Include turn-by-turn steps in the response. | |
| transit_modes | No | Restrict transit to these vehicle types. Requires transit mode. | |
| avoid_highways | No | Avoid highways. Requires drive mode for the affected route. | |
| departure_time | No | Optional RFC3339 departure time, e.g. 2030-05-10T18:57:00-03:00. Mutually exclusive with arrival_time. | |
| routing_preference | No | Traffic handling for drive mode. Defaults to traffic_aware when a departure_time is given, because a traffic-unaware route ignores it. | |
| transit_routing_preference | No | Transit routing bias. Requires transit mode. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| legs | No | Present when waypoints were given. | |
| mode | No | ||
| error | No | Present only on failure; the result is also flagged isError. | |
| steps | No | Present when include_steps is true. Transit steps carry a transit object with line, headsign, stops, and times. | |
| routes | No | Present instead of a single route when compare_mode is used. | |
| summary | No | ||
| maps_url | No | ||
| warnings | No | ||
| end_address | No | ||
| alternatives | No | ||
| distance_text | No | ||
| duration_text | No | ||
| start_address | No | ||
| distance_meters | No | ||
| duration_seconds | No |