Google Maps Directions API
Pricing
from $0.01 / 1,000 results
Google Maps Directions API
Get Google Maps directions for any route - driving, transit, walking, cycling, or flight - with distance, ETA, and turn-by-turn steps as JSON. Use addresses, coordinates, or place IDs; avoid tolls, highways, or ferries; set departure or arrival time. MCP-ready for Claude and AI agents.
Pricing
from $0.01 / 1,000 results
Rating
5.0
(4)
Developer
John
Maintained by CommunityActor stats
4
Bookmarked
2
Total users
1
Monthly active users
9 hours ago
Last modified
Categories
Share
πΊοΈ Google Maps Directions API
Get Google Maps directions between any origin and destination as structured JSON: route options for driving, transit, walking, cycling, and flight, with distance, ETA, traffic-aware duration ranges, and turn-by-turn steps. Provide addresses, GPS coordinates, or place IDs. MCP-ready so Claude and other AI agents can call it as a tool.
Example code (Python): https://github.com/johnisanerd/Apify-Google-Maps-Directions-API
π What this API returns
| Field | Description |
|---|---|
start, end | The origin and destination used for the lookup. |
travel_mode | The requested mode: best, driving, cycling, walking, transit, flight, or two-wheeler. |
directions_found | true if at least one route option was returned. |
directions_count | Number of route options in directions. |
best_duration, best_distance | ETA and distance of the first (recommended) option, e.g. 3 hr 38 min, 215 miles. |
places_info | Resolved origin and destination: formatted address, place ID, and GPS coordinates. |
directions | Each route option with mode, distance, duration, route summary (via), notes (extensions), and trips containing turn-by-turn steps. Transit options include stops, lines, operators, and times. |
durations | Travel time by mode (driving, transit, walking, cycling, flight) for this origin and destination. |
google_maps_directions_url | A direct Google Maps link that opens the same route in a browser. |
π― Use cases
- Logistics and delivery. Compute ETA and distance between stops to plan and price routes.
- Travel and trip planning. Compare driving, transit, walking, and cycling options for a journey.
- Apps and dashboards. Embed turn-by-turn directions and a Google Maps link without managing a maps key.
- AI agent workflows. Drive this API over MCP from Claude (see below) to answer "how do I get from A to B?" in-conversation.
- Transit analysis. Pull public-transit legs, operators, and departure/arrival times for a corridor.
βοΈ Input examples
Basic route (best options across modes)
{"start_addr": "New York, NY","end_addr": "Boston, MA"}
Driving, avoid tolls and highways, in miles
{"start_addr": "Los Angeles, CA","end_addr": "San Francisco, CA","travel_mode": "driving","distance_unit": "miles","avoid_tolls": true,"avoid_highways": true}
Transit, arriving by a specific time
{"start_addr": "Brooklyn, NY","end_addr": "Times Square, New York, NY","travel_mode": "transit","transit_routing": "less_walking","time_type": "arrive_by","time_value": "2026-06-01T09:00:00"}
Exact coordinates
{"start_coords": "40.7128,-74.0060","end_coords": "42.3601,-71.0589","travel_mode": "driving"}
Provide an origin and a destination as an address, coordinates (latitude,longitude), or a Google Maps place ID. The API returns one row per run.
π¦ Example output (trimmed)
{"result_type": "directions","start": "New York, NY","end": "Boston, MA","travel_mode": "best","directions_found": true,"directions_count": 3,"best_duration": "3 hr 38 min","best_distance": "215 miles","places_info": [{ "address": "New York", "data_id": "0x89c24fa5d33f083b:0xc80b8f06e177fe62", "gps_coordinates": { "latitude": 40.7127753, "longitude": -74.0059728 } },{ "address": "Boston, Massachusetts", "data_id": "0x89e3652d0d3d311b:0x787cbf240162e8a0", "gps_coordinates": { "latitude": 42.3555076, "longitude": -71.0565364 } }],"directions": [{"travel_mode": "Driving","via": "CT-15 N and I-90 E","distance": 346243,"duration": 13082,"formatted_distance": "215 miles","formatted_duration": "3 hr 38 min","typical_duration_range": "3 hr 21 min to 4 hr 10 min","extensions": ["Fastest route now due to traffic conditions", "This route has tolls."],"trips": [{"travel_mode": "Driving","title": "Get on FDR Dr","formatted_distance": "0.9 mi","formatted_duration": "5 min","details": [{ "title": "Head toward Park Row", "action": "straight", "formatted_distance": "200 ft", "formatted_duration": "21 sec" }]}]}],"durations": [{ "travel_mode": "Driving", "formatted_duration": "3 hr 38 min" },{ "travel_mode": "Transit", "formatted_duration": "4 hr 25 min" },{ "travel_mode": "Flight", "formatted_duration": "1 hr 15 min" }],"google_maps_directions_url": "https://www.google.com/maps/dir/...","gl": "us","hl": "en","fetched_at": "2026-05-29T12:00:00+00:00"}
π° Pricing (pay-per-event)
| Event | Price | When it fires |
|---|---|---|
setup | $0.01 | Once per Actor run, at startup. |
directions_processed | $0.015 | Once per route lookup. One lookup returns every route option for the origin and destination. |
A single route lookup costs $0.01 + $0.015 = $0.025, flat and predictable. One lookup with the default best mode returns several route options (driving, transit, flight, and more) in that one charge.
π Use this API from Claude (MCP)
This Actor is MCP-server-compatible, so Claude Code (free trial), Claude (desktop and web), Cursor, and other MCP clients can call it as a tool through Apify's hosted MCP server.
Add it with this Actor-specific URL:
https://mcp.apify.com/?tools=actors,docs,johnvc/google-maps-directions-api
Setup walkthrough:
Apify MCP integration docs: https://docs.apify.com/platform/integrations/mcp
New to Claude Code or Claude Cowork? Start a free trial here: https://claude.ai/referral/uIlpa7nPLg
Then ask Claude:
"Use the Google Maps Directions API to get driving directions from New York, NY to Boston, MA, and tell me the distance and ETA."
π How to get started
- Open the Actor and enter a start and end point (address, coordinates, or place ID).
- Optionally choose a travel mode, units, avoidance options, transit preferences, or a departure/arrival time.
- Run it and read the results from the dataset (JSON, CSV, Excel, or API).
β FAQ
Which travel modes are supported?
Best (all modes), driving, cycling, walking, transit, flight, and two-wheeler. Flight and two-wheeler are only available for some regions and routes; when a mode has no route, the row comes back with directions_found: false and a short note.
Can I use coordinates or place IDs instead of addresses?
Yes. Set start_coords/end_coords as latitude,longitude, or start_data_id/end_data_id with a Google Maps place ID. Coordinates take precedence over place ID, which takes precedence over address.
How do I set a departure or arrival time?
Set time_type to depart_at or arrive_by and put an ISO 8601 datetime (or a Unix timestamp) in time_value. This is most useful for transit, and a departure time also informs driving traffic estimates.
Do I need a Google Maps API key? No. Supply only the input fields; the Actor handles data retrieval for you.
Last Updated: 2026.06.01