The Maps Embed API quickstart

Place an interactive map, or Street View panorama on your web page with a simple HTTP request—no JavaScript required.

Costs

All Maps Embed API requests are available at no charge with unlimited usage. However, all requests still require a valid Google Cloud API key. 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:

Step 1

Console

  1. In the Google Cloud console, on the project selector page, click Create Project to begin creating a new Cloud project.

    Go to the project selector page

  2. Make sure that billing is enabled for your Cloud project. Confirm that billing is enabled for your project.

    Google Cloud offers a $0.00 charge trial. The trial expires at either end of 90 days or after the account has accrued $300 worth of charges, whichever comes first. Cancel anytime. Google Maps Platform features a recurring $200 monthly credit. For more information, see Billing account credits and Billing.

Cloud SDK

gcloud projects create "PROJECT"

Read more about the Google Cloud SDK , Cloud SDK installation , and the following commands:

Step 2

To use Google Maps Platform, you must enable the APIs or SDKs you plan to use with your project.

Console

Enable the Maps Embed API

Cloud SDK

gcloud services enable \
    --project "PROJECT" \
    "maps-embed-backend.googleapis.com"

Read more about the Google Cloud SDK , Cloud SDK installation , and the following commands:

Step 3

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:

Console

  1. Go to the Google Maps Platform > Credentials page.

    Go to the Credentials page

  2. On the Credentials page, click Create credentials > API key.
    The API key created dialog displays your newly created API key.
  3. Click Close.
    The new API key is listed on the Credentials page under API keys.
    (Remember to restrict the API key before using it in production.)

Cloud SDK

gcloud alpha services api-keys create \
    --project "PROJECT" \
    --display-name "DISPLAY_NAME"

Read more about the Google Cloud SDK , Cloud SDK installation , and the following commands:

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:

  1. Open your default text editor. You should have text editors such as TextEdit or Microsoft Windows Notepad installed on your device by default.
  2. Create an HTML file and name it index.html.
  3. Add the following code with the iframe you generated above:

    <html>
      <!-- Replace this code comment with your iframe. -->
    </html>
    
  4. Save your index.html HTML file.

  5. 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.

Cleaning up

You can delete your Google Cloud project to stop billing for all the resources used within that project.

  1. In the Google Cloud console, go to the Manage resources page:

    Go to the Manage resources page

  2. 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.
  3. In the project list, select the project that you want to delete and click Delete.
  4. In the dialog, type the project ID and click Shut down to delete the project.

Next steps