Web research5 min readBy Purrkey team

How to compare driving routes with Google Maps directions

Get route options between two addresses with distance, duration, step details, and transit information in normalized JSON

On this page

You have six candidate office locations and one downtown address, and you need to compare driving and transit durations before choosing a shortlist. Call POST /v1/runs with the toolId for the directions tool once for each start and end pair, then read the route rows and the mode summary to keep or drop each candidate

No run has been executed for this guide. The tables below are a design, not a result

Example inputs and the comparison table

Example (invented) destination: 900 Example Plaza, New York, NY 10001. Example (invented) candidates: 100 Example Street, New York, NY 10002; 200 Sample Avenue, New York, NY 10003; 300 Placeholder Road, New York, NY 10004; 400 Draft Lane, New York, NY 10005; 500 Demo Boulevard, New York, NY 10006; 600 Trial Drive, New York, NY 10007. Replace these with real addresses before running

The worksheet has one row per route option. Values here are placeholders showing the shape

candidate_locationdirections.formatted_distancedirections.formatted_durationdirections.viadirections.travel_modedirections.typical_duration_range
Candidate A(placeholder distance)(placeholder duration)(placeholder via)driving(placeholder range)

A call can return up to 10 route options. If a candidate has more than one, repeat candidate_location for each row. If you compare driving and transit, keep a travel_mode value on each row so the two passes stay separate

What the directions call takes

serpapi.google_maps.directions requires start_addr and end_addr. Both are strings of 1 to 200 characters. Put the candidate address in start_addr and the downtown address in end_addr. The input notes list travel_mode, distance_unit and avoid as optional fields

travel_mode values are 6 default, 0 driving, 9 two-wheeler, 3 transit, 2 walking, 1 cycling and 4 flight. distance_unit takes 0 for kilometers or 1 for miles. avoid takes highways, tolls or ferries

How to read the route output

The response schema lists directions, durations, places_info, engine and notice. Use durations for the mode summary: each item has travel_mode, formatted_duration and numeric duration. Use directions for route detail: each item can include formatted_distance, formatted_duration, via, travel_mode, typical_duration_range, numeric distance and duration, start_time, end_time, cost, currency, trips and extensions

The limit sits at this step: one call returns up to 10 route options in directions and up to 10 items in durations. If the search returns no results, notice is set and the search still counts as one search. Failed searches are not charged

For the decision, compare durations.formatted_duration for driving and transit against your own cutoff. Then open the matching directions rows and use formatted_duration, formatted_distance, via, travel_mode and typical_duration_range to fill the table. Keep numeric duration and distance beside the formatted fields if you plan to sort in a spreadsheet. A candidate with a driving duration above your cutoff can stay in the list if its transit duration is below the cutoff; mark which mode passed. The tool cannot choose a cutoff for you

If a candidate moves to a site visit, use the companion guide to confirm a venue address and contact details before booking

The agent prompt

Example (invented) addresses are below. Replace them with the real candidate and downtown addresses

Agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to compare driving and transit routes for six candidate office locations against one downtown address. Check the current inputs and price of serpapi.google_maps.directions before running anything. Run one call per candidate with travel_mode 0 and one call per candidate with travel_mode 3, using distance_unit 1. The addresses below are examples; replace them with the real addresses before the run. Return a table with candidate_location, directions.formatted_distance, directions.formatted_duration, directions.via, directions.travel_mode, directions.typical_duration_range, plus durations.formatted_duration for the mode summary. If directions is empty, show the notice and mark the candidate as no route. Do not guess addresses.

Destination: 900 Example Plaza, New York, NY 10001
Candidate 1: 100 Example Street, New York, NY 10002
Candidate 2: 200 Sample Avenue, New York, NY 10003
Candidate 3: 300 Placeholder Road, New York, NY 10004
Candidate 4: 400 Draft Lane, New York, NY 10005
Candidate 5: 500 Demo Boulevard, New York, NY 10006
Candidate 6: 600 Trial Drive, New York, NY 10007

Estimated tool cost

The price is $0.015 per call, read through the Purrkey catalog on November 20, 2026. The cost table uses the max_call unit: "Maximum per call. Successful runs settle at the actual AnyAPI charge." The totals below are ceilings, not settled charges. Model fees for the agent are not counted

StepFormulaUnit pricePlanned quantityTotal
One travel mode6 calls x $0.015$0.015 per call6$0.09
Driving and transit12 calls x $0.015$0.015 per call12$0.18

For six candidate locations, one travel mode is 6 calls and at most $0.09. Driving and transit for the same six locations is 12 calls and at most $0.18. If a call returns no results, it still counts as one search; failed searches are not charged. If you add another mode, add 6 calls and $0.09 to the ceiling

Next action

Open the Google Maps directions tool and run the first candidate pair before loading the other five

Get started by giving this to your agent

  • Claude Code
  • Codex
  • Gemini CLI
  • Cursor
  • GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with Google Maps.
Explore Google Maps tools and pricing

FAQ

How do I compare driving routes for six office locations?

Run serpapi.google_maps.directions once per candidate and destination pair, then compare the directions.formatted_duration and durations.formatted_duration values for driving and transit against your own cutoff.

What inputs does serpapi.google_maps.directions take?

It requires start_addr and end_addr. The input notes list travel_mode, distance_unit and avoid as optional fields.

What output fields should I use for a route comparison?

Use directions.formatted_distance, directions.formatted_duration, directions.via, directions.travel_mode and directions.typical_duration_range for the route table, and durations.formatted_duration for the mode summary.

How many route options does one call return?

One call returns up to 10 route options in directions and up to 10 items in durations. A no-results response sets notice and still counts as one search; failed searches are not charged.

How much does it cost to compare six candidate locations?

At $0.015 per call, one travel mode for six locations is 6 calls and at most $0.09. Driving and transit for the same six locations is 12 calls and at most $0.18. Model fees for the agent are not counted.

What happens if a directions search returns no route options?

The response sets notice when the search engine returned no results for the query. The search still counts as one search, while failed searches are not charged.

Next step

Try this with Google Maps

The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.

See Google Maps tools

Share this article