Get started with the Distance Matrix API

Sample request and response

This example requests the distance matrix data between Washington, DC and New York City, NY, in JSON format:



curl -L -X GET ''

Try it! Test this request by entering the URL into your web browser - be sure to replace YOUR_API_KEY with your actual API key. The response shows the distance and duration between the specified origins and destinations.

Learn how to build request URLs, including all available parameters.

This code sample is in JSON and XML formats:


  "destination_addresses": ["New York, NY, USA"],
  "origin_addresses": ["Washington, DC, USA"],
              "distance": { "text": "228 mi", "value": 367654 },
              "duration": { "text": "3 hours 55 mins", "value": 14078 },
              "status": "OK",
  "status": "OK",


 <origin_address>Washington, DC, USA</origin_address>
 <destination_address>New York, NY, USA</destination_address>
    <text>3 hours 55 mins</text>
    <text>228 mi</text>

Check the developer's guide to understand the response.