Maps JavaScript API URL Parameters

This document discusses all of the parameters you can specify in the query string of the script loading URL when loading the Maps JavaScript API. Certain parameters are required while others are optional. As is standard in URLs, all parameters are separated using the ampersand (&) character.

The following example URL has placeholders for all possible parameters:

https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY
&callback=FUNCTION_NAME
&v=VERSION
&libraries="LIBRARIES"
&language="LANGUAGE"
&region="REGION"

The URL in the following example script tag loads the Maps JavaScript API:

<script defer
    src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
</script>

Required parameters

The following parameters are required when loading the Maps JavaScript API.

  • key: Your API key. The Maps JavaScript API will not load unless a valid API key is specified.

  • callback: The name of a global function to be called once the Maps JavaScript API loads completely.

Optional parameters

Use these parameters to request a specific version of the Maps JavaScript API, load additional libraries, or localize your map

  • v: The version of the Maps JavaScript API to use.

  • libraries: A comma-separated list of additional Maps JavaScript API libraries to load.

  • language: The language to use. This affects the names of controls, copyright notices, driving directions, and control labels, as well as the responses to service requests. See the list of supported languages.

  • region: The region code to use. This alters the map's behavior based on a given country or territory.