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.

MEDIAN LAGon demand
PARAMETERS14
TOTAL USERS207
MONTHLY ACTIVE33
TOTAL RUNS5,449
SUCCESS (30D)100.0%
RATING5.0 (4)
LAST MODIFIED2026-10-27
PUBLISHED2026-05

Input parameters

PARAMETERTYPEREQDEFAULTDESCRIPTION
start_addr string no — Enter the starting address or place name (e.g. 'New York, NY' or 'Empire State Building').
end_addr string no — Enter the destination address or place name (e.g. 'Boston, MA' or 'Fenway Park').
start_coords string no — Optionally set the origin as exact GPS coordinates in 'latitude,longitude' format (e.g. '40.7128,-74.0060').
end_coords string no — Optionally set the destination as exact GPS coordinates in 'latitude,longitude' format (e.g. '42.3601,-71.0589').
start_data_id string no — Optionally set the origin as a Google Maps place data ID (e.g. '0x89c24fa5d33f083b:0xc80b8f06e177fe62').
end_data_id string no — Optionally set the destination as a Google Maps place data ID.
travel_mode enum no best Choose how to travel. 'Best' returns the best options across modes; the others restrict the result to one mode.
distance_unit enum no auto Choose the distance unit for the results. 'Automatic' lets the region decide.
avoid_tolls boolean no False Enable to prefer routes without toll roads.
avoid_highways boolean no False Enable to prefer routes that avoid highways.
avoid_ferries boolean no False Enable to prefer routes that avoid ferries.
transit_prefer enum no none Set a preferred public transit mode.
transit_routing enum no none Set how transit routes are optimized.
time_type enum no leave_now Choose whether the time below is a departure time, an arrival time, or to leave now. 'Leave now' ignores the time value.

Worked examples

Basic — the required input, with the schema's own example values
{
  "start_addr": "New York, NY",
  "end_addr": "Boston, MA"
}

Coverage

7
travel mode — best driving cycling walking transit +2

Code

curl

curl -X POST "https://api.apify.com/v2/acts/johnvc~google-maps-directions-api/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"start_addr": "New York, NY", "end_addr": "Boston, MA"}'

Python

from apify_client import ApifyClient

client = ApifyClient("APIFY_TOKEN")
run = client.actor("johnvc/google-maps-directions-api").call(
    run_input={'start_addr': 'New York, NY', 'end_addr': 'Boston, MA'}
)
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

MCP

Apify's hosted MCP server loads this source from the URL below as the tool johnvc--google-maps-directions-api. Sign in to Apify when your client asks (OAuth), or send an Apify token as an Authorization: Bearer header.

https://mcp.apify.com/?tools=johnvc/google-maps-directions-api

Questions people ask

What does the Google Maps Directions API return?

For any route it returns Google Maps directions as JSON with the distance, the ETA and the turn-by-turn steps, for driving, transit, walking, cycling or flight.

How much does the Google Maps Directions API cost?

The default edition bills 0.015 USD per directions lookup, so each origin-to-destination query is one billable unit. There is also a free tier on Apify.

How do I specify the origin and destination for Google Maps Directions?

Use start_addr and end_addr with addresses or place names such as New York, NY and Boston, MA, or exact coordinates in start_coords and end_coords in latitude,longitude format, or Google Maps place data IDs in start_data_id and end_data_id.

Which travel modes does the Google Maps Directions API support?

Seven options through travel_mode, which defaults to best and returns the best options across modes, while the others such as driving, cycling, walking and transit restrict the result to one mode.

Can Google Maps Directions avoid tolls or set a departure time?

Yes. Enable avoid_tolls, avoid_highways or avoid_ferries to prefer routes without them, and use time_type to treat the given time as a departure or arrival time instead of the default leave now.

Can Claude or an AI agent call the Google Maps Directions API?

Yes. The source is exposed as an MCP tool on Apify's hosted MCP server, so Claude, Cursor and other agents can call it, and it is also available over REST. Routes are computed on demand.