All Maps Embed API requests are free with unlimited usage. For more information, see Usage and Billing.
Before you begin
To create an embedded map on your web page, complete the required setup steps by clicking through the following tabs:
In the Google Cloud Console, on the project selector page, click Create Project to begin creating a new Cloud project.
Make sure that billing is enabled for your Cloud project. Confirm that billing is enabled for your project.
gcloud projects create "PROJECT"
To use Google Maps Platform, you must enable the APIs or SDKs you plan to use with your project.
gcloud services enable \ --project "PROJECT" \ "maps-embed-backend.googleapis.com"
This step only goes through the API Key creation process. If you use your API Key in production, we strongly recommend that you restrict your API key. You can find more information in the product-specific Using API Keys page.
The API key is a unique identifier that authenticates requests associated with your project for usage and billing purposes. You must have at least one API key associated with your project.
To create an API key:
Go to the Google Maps Platform > Credentials page.
On the Credentials page, click Create credentials > API key.
The API key created dialog displays your newly created API key.
The new API key is listed on the Credentials page under API keys.
(Remember to restrict the API key before using it in production.)
gcloud alpha services api-keys create \ --project "PROJECT" \ --display-name "DISPLAY_NAME"
Generating an iframe
Click through the following options and add a location and API key to generate an iframe for your webpage. For additional parameters and options, see Embedding a map.
Testing your iframe
To see your iframe in an HTML browser window:
- Open your default text editor. You should have text editors such as TextEdit or Microsoft Windows Notepad installed on your device by default.
- Create an HTML file and name it
Add the following code with the iframe you generated above:
<html> <!-- Replace this code comment with your iframe. --> </html>
Load the HTML file in a web browser by dragging it from your desktop onto your browser; alternatively, double-clicking the file works on most operating systems.
Congratulations! You just set up and built a map using the Maps Embed API.
You can delete your Google Cloud project to stop billing for all the resources used within that project.
- In the Google Cloud Console, go to the Manage resources page:
- If the project that you plan to delete is attached to an organization, select and expand the organization list at the top of the page.
- In the project list, select the project that you want to delete and click Delete.
- In the dialog, type the project ID and click Shut down to delete the project.