Google Maps API: How to Get Started

Jamie Juviler
Jamie Juviler

Published:

Google Maps is the leading location data and visualization platform for the web. You might use it for finding the fastest way to drive to your friend’s house, which bus to take to work, or where to get comfort food at 2 AM.

man using google maps API on his mobile phone

However, the functionality of Google Maps goes well beyond its mobile app — if you run a business website or app and want to include location displays in any way, Google Maps offers developer APIs that grant access to Google’s plethora of geographic data.

With a Google Maps API, you can display interactive maps and customize them how you want on your website. If you’re a travel site, you can leverage maps to help users create itineraries. A delivery or ridesharing service might use Google Maps to show driver routes. Google Maps data also refreshes in real-time, meaning that maps you create with Google API will always be up-to-date for visitors.

There are virtually endless ways to incorporate maps into your site and a lot to unpack, so let’s start with the basics: What is a Google Maps API, and how do you get started?

Download Now: How to Use an API [Free Ebook]

What is a Google Maps API?

A Google Maps API is an API (short for "application programming interface") that allows developers to access Google Maps data and functionality for their own projects. If you want to incorporate customized Google Maps on your website or application, you can use a Google Maps API.

Currently, the Google Maps Platform offers multiple APIs for different aspects of its service. There’s a Maps Static API for simple Google Map embeds, a Maps JavaScript API for interactive and customizable maps, a Places API to access data about points of interest, and a Directions API to provide routes to a location, to name just a few.

You probably won’t utilize every Google Maps API on your website, but you may need several API integrations depending on what functions you’re looking for. When you register to use the API, you’ll have access to all of these APIs, plus other tools for developers.

So, how do you actually access Google Maps APIs? The first step is to sign up and get an API key. Let’s learn how.

How to Get Your Google Maps API Key

An API key is a unique code associated with your project. APIs distribute keys to users in order to track how the API is being used. Requests you make to an API include your API key so the API knows it’s you making the request.

API keys also help regulate the number of calls the API receives at any given time and prevent attacks. Without API keys, it would be possible to crash any API server with an influx of malicious requests.

To make calls to Google’s API, you’ll first need to acquire an API key for the service. Getting a key itself is free, and Google offers a limited free trial that includes $300 in credit for your first 90 days of use.

After your trial, Google will provide $200 of credit per month toward your Maps API usage. After you exceed this credit, Google charges in a pay-by-use model — see Google Maps API Pricing below for more info.

Note that you’re required to provide billing information when registering for a free key. However, Google won’t charge you for exceeding your trial limits unless you turn on automatic billing in your account. This means you can test out the API without worrying about unintended fees.

How to Create a Google Maps API Key for Free

To register for and receive a Google Maps API key, follow these steps:

1. On the Google Maps Platform homepage, click Get Started.

2. If not already signed into a Google account, you’ll be prompted to sign in or create an account.

3. Google will take you through the steps to sign up for a Google Cloud Platform Free Trial. Read and agree to the terms of service, then click Continue.

Google Maps API Key free

4. On the next screen, confirm your identity by entering your phone number, then click Send Code. Enter the verification code you’ve received and click Verify.

Google Maps API Key free: verify contact info

5. On the next screen, choose your Account type (Businesses or Individual) and enter your Business name. Then, enter your credit or debit card information (or PayPal or bank account information). Google will not charge you for usage unless you enable automatic billing.

Google Maps API Key free: enter payment information

6. You’ll receive your API key, which you can copy to your clipboard. Keep this key stored safely and do not share it outside of those on your team using the API. You can also choose to enable access to all Google Maps APIs and receive monthly budget alerts.

Google Maps API Key free: getting an api key

7. If you’d like, click Build a Demo to learn the basics of the Maps API. Otherwise, click Maybe Later. For now, let’s choose Maybe Later.

8. Google also recommends restricting requests using your API key to prevent harmful use in case your key is ever stolen. To restrict your key, choose your restriction type from the Select restriction type dropdown (depending on your project) and any other required information for your restriction. Then, click Restrict Key.

Google Maps API Key free: setting restrictions on google api key

After completing these steps, you’re ready to use the Google Maps API.

How to View Your Google Maps API Keys

You can view your API Keys by choosing Credentials from the side menu of your Google Maps Platform dashboard.

list of api keys in the google developer portal

Google Maps API Pricing

As mentioned, you won’t be charged for your Google Maps API usage until you turn on auto-billing. The free trial limits you to $300 in credit over 90 days.

API users also get $200 of credit per month toward API requests, equal to 100,000 static map requests or around 28,000 dynamic map requests per month.

Beyond the trial and monthly credit, Google charges for Maps API by usage by number of requests. Charges vary by request type — for example, if you just want to display a static map as an image on your site, Google charges $2 per 1000 requests. For interactive maps, it’s $7 per 1000 requests.

You can view pricing for all API offerings on the Google Maps API pricing page, grouped by API category (Maps, Routes, and Places).

pricing table for google maps api requests

Image Source

How to Use a Google Maps API on Your Website

Once you’ve acquired your API key, how you go about placing a map on your website will depend on what CMS, website builder, or platform you use to manage your website, or if you’re creating your site from scratch.

If available, read into your provider’s documentation on incorporating Google Maps — some allow you to insert a native maps module after providing your API key (e.g., Shopify), while others require a third-party extension (e.g. WordPress — see our recommended Google Maps plugins).

If your website tool of choice doesn’t have native support for Google Maps APIs or if you’re coding your site from scratch, you can follow the Google Maps Platform documentation for your desired function and code your map. Making API requests is relatively straightforward if you stick to Google’s instructions.

As a simple use case to get started, try Google’s tutorial of its Maps JavaScript API. The Maps JavaScript API handles many of the interactive features you’ve likely seen from Google Maps. In this activity, you place a marker on a map of Australia.

google map image of australia

Image Source

Google Maps API Alternatives

The Google Maps Platform is a leader in interactive online maps. However, you might prefer an alternative that’s cheaper or offers different functionality than Google’s tool. Here are some popular alternatives to Google Maps APIs that are worth exploring.

Apple Maps

The developer tools for Apple Maps offer similar functionality to the Google Maps Platform, providing access to detailed maps location data, navigation, and more. Apple’s tools can be worked into websites and applications. Also of note is its new indoor mapping data format, useful for plotting out indoor layouts on your site or application.

screenshot of google maps api alternative apple maps

Image Source

TomTom

Known for its navigation products, TomTom has made its data accessible to developers through its premium API. It allows for more requests than the Google Maps API service, and a variety of map views. Plus, there’s the ability to look up locations, view traffic and public transport, and get directions.

screenshot of google maps api alternative tomtom

Image Source

Mapbox

If you’re looking to add more visual flair to your maps, you can leverage the customization tools from the Mapbox API. This premium service offers maps and services similar to previous options here, but also includes Mapbox studio, a map customizer that lets you tweak your map displays as you might in a tool like Photoshop. It lets you tweak small details of your maps to make the visuals your own.

screenshot of google maps api alternative mapbox

Image Source

HERE

HERE Is a powerful location data platform, offering data visualization, insights reporting, and mapping. The maps themselves are visually rich and aesthetically pleasing, as well as customizable. You can create maps displaying public areas as well as maps for private spaces. However, if you’re looking to just display interactive maps on a web page, this option might be overkill.

screenshot of google maps api alternative HERE

Image Source

Put Your Business on the Map

… or should I say, a map on your business. Google Maps APIs are well-documented and not too difficult to get started using if you’re familiar with APIs in general.

With some poking around, you might find some applications you hadn’t thought of before, and incorporate maps that enhance your website or service. Plus, there’s no harm in getting a free key and using your free requests to see what you can do.

api

Related Articles

We're committed to your privacy. HubSpot uses the information you provide to us to contact you about our relevant content, products, and services. You may unsubscribe from these communications at any time. For more information, check out our Privacy Policy.

Everything you need to know about the history and use of APIs.

CMS Hub is flexible for marketers, powerful for developers, and gives customers a personalized, secure experience

START FREE OR GET A DEMO