Get started with Routes

Follow these steps to get set up with Routes Library, Maps JavaScript API

Get an API key and enable the Maps JavaScript API

Before using the Routes Library, Maps JavaScript API, you need a Cloud project with a billing account, and both the Maps JavaScript API and Routes API enabled. To learn more, see Set up your Google Cloud project.

Get an API key

Enable the Maps JavaScript API

Enable the Routes API

Update your map initialization code

  1. Load the Maps JavaScript API.
  2. Load the Routes library from within an async function when needed:
    const { Route, RouteMatrix } = await google.maps.importLibrary('routes');
        

Next steps