Playbook · Traffic Analytics & Navigation

Get the live drive time between two points

One call returns up to three routes between two points with travel time in current traffic, distance, toll price and a traffic label.

In short

Call the Waze /driving-directions endpoint with source_coordinates and destination_coordinates. Each route has duration_seconds in current traffic, length_meters, a traffic_label such as "usual traffic", and toll_price when the route has a toll.

The use case

How long does this drive take right now, and is it worse than usual? Dispatch tools need it to promise arrival times, delivery apps to set ETAs, and travel and real-estate products to show commute times. Waze computes routes on live traffic, so the answer reflects the road as it is when you ask.

Who does this: Delivery and dispatch software, field-service and ride services, travel and airport transfer sites, and real-estate and relocation tools showing commute times.

How to do it

Uses the Waze API, tested live on November 1, 2026. One call per trip. Here, Times Square to JFK Airport. The cURL tab shows the same call:

import requests

API_KEY = "YOUR_API_KEY"

routes = requests.get("https://api.openwebninja.com/waze/driving-directions",
                      headers={"x-api-key": API_KEY},
                      params={"source_coordinates": "40.7580,-73.9855",          # Times Square
                              "destination_coordinates": "40.6413,-73.7781"}     # JFK Airport
                      ).json()["data"]
for r in routes:
    print(f'{r["duration_seconds"] // 60} min  {r["length_meters"] / 1000:.1f} km  '
          f'{r["traffic_label"]:<26} toll: {r.get("toll_price") or "-"}  {r["route_name"]}')
Result (Python)
32 min  27.9 km  usual traffic              toll: 12.03  I-495 E • Long Island Expwy Queens (12.03)
38 min  29.1 km  usual traffic              toll: -  3rd Ave Manhattan
44 min  27.2 km  heavier traffic than usual toll: 12.03  Cross Bay Blvd Queens (12.03)
Full response of the cURL call above (Times Square to JFK) · JSON
{
  "status": "OK",
  "request_id": "0ea75f9a-ff84-4b16-9985-cd49822f0efa",
  "parameters": {
    "source_coordinates": "40.7580,-73.9855",
    "destination_coordinates": "40.6413,-73.7781",
    "return_route_coordinates": false,
    "toll_passes": false
  },
  "data": [
    {
      "route_coordinates": [],
      "route_name": "I-495 E • Long Island Expwy Queens (12.03)",
      "length_meters": 27862,
      "duration_seconds": 1976,
      "passes_through_danger_area": false,
      "is_toll": true,
      "is_hov": false,
      "is_fastest": true,
      "alerts": [],
      "jams": [],
      "traffic_label": "usual traffic",
      "toll_price": 12.03,
      "toll_price_currency": "USD",
      "toll_road_name": "E-ZPass - NY"
    },
    {
      "route_coordinates": [],
      "route_name": "3rd Ave Manhattan",
      "length_meters": 29137,
      "duration_seconds": 2329,
      "passes_through_danger_area": false,
      "is_toll": false,
      "is_hov": false,
      "is_fastest": false,
      "alerts": [],
      "jams": [],
      "traffic_label": "usual traffic"
    },
    {
      "route_coordinates": [],
      "route_name": "Cross Bay Blvd Queens (12.03)",
      "length_meters": 27205,
      "duration_seconds": 2666,
      "passes_through_danger_area": false,
      "is_toll": true,
      "is_hov": false,
      "is_fastest": false,
      "alerts": [],
      "jams": [],
      "traffic_label": "heavier traffic than usual",
      "toll_price": 12.03,
      "toll_price_currency": "USD",
      "toll_road_name": "E-ZPass - NY"
    }
  ]
}

For a whole list

Time a list of trips and keep the fastest route for each in a CSV:

import csv
import requests

API_KEY = "YOUR_API_KEY"
TRIPS = [  # (name, from "lat,lng", to "lat,lng")
    ("Times Square to JFK", "40.7580,-73.9855", "40.6413,-73.7781"),
    ("Newark Airport to Times Square", "40.6895,-74.1745", "40.7580,-73.9855"),
    ("Downtown Brooklyn to LaGuardia", "40.6928,-73.9903", "40.7769,-73.8740"),
    ("Jersey City to Stamford", "40.7178,-74.0431", "41.0534,-73.5387"),
]

with open("drive_times.csv", "w", newline="") as f:
    w = csv.writer(f)
    w.writerow(["trip", "fastest_min", "km", "traffic", "toll", "route", "alternatives"])
    for name, src, dst in TRIPS:
        routes = requests.get("https://api.openwebninja.com/waze/driving-directions",
                              headers={"x-api-key": API_KEY},
                              params={"source_coordinates": src, "destination_coordinates": dst},
                              timeout=60).json().get("data") or []
        if not routes:
            continue
        best = min(routes, key=lambda r: r["duration_seconds"])
        w.writerow([name, best["duration_seconds"] // 60, round(best["length_meters"] / 1000, 1),
                    best["traffic_label"], best.get("toll_price"), best["route_name"], len(routes) - 1])
drive_times.csv
trip,fastest_min,km,traffic,toll,route,alternatives
Times Square to JFK,32,27.9,usual traffic,12.03,I-678 S • Van Wyck Expwy Queens,2
Newark Airport to Times Square,27,26.6,usual traffic,30,Lincoln Tunnel E Manhattan (30.0),2
Downtown Brooklyn to LaGuardia,20,15.9,usual traffic,,"I-278 E • Bklyn-Qns Expwy, I-278 E • Kosciuszko Br Brooklyn",2
Jersey City to Stamford,62,68.9,usual traffic,29.65,I-95 N Greenwich (29.65),2

Four calls took 11 seconds. Run it on a schedule to see how each trip changes through the day.

Good to know

  • Times are for traffic at the moment of the call. To compare rush hour with the rest of the day, call the same trip on a schedule and store each result.
  • The API returned three routes for every trip in our runs. The first was the fastest, and the others can be better if you want to avoid tolls.
  • toll_price and toll_price_currency appear only on toll routes; Newark Airport to Times Square through the Lincoln Tunnel showed 30 USD.
  • Points are latitude,longitude pairs. To start from a place name, the Waze API's /autocomplete endpoint returns coordinates ("JFK Airport Terminal 4" gave 40.6434,-73.7827).

Frequently asked questions

How do I get the current travel time between two addresses with an API?

Turn each address into coordinates (for example with /autocomplete), then call /driving-directions with both points. duration_seconds is the travel time in current traffic.

Can I get several route options with tolls and distance?

Yes. Each call returns up to three routes with time, distance, a traffic label and, for toll routes, the toll price.

Can I calculate drive times for a list of trips at once?

Yes. Loop over your trips as in the script above; each trip is one call and returns in a few seconds.

Start building with real-time web data

Every API includes a free tier. No credit card required, and the first request is a minute away.