New pricing changes went into effect on July 16, 2018. For more information, check out the Guide for Existing Users.

Get API Key

To use the Maps SDK for iOS, you must get an API key which you can then add to your mobile app, website, or web server.  The API key is used to track API requests associated with your project for usage and billing. To learn more about API keys, see the API Key Best Practices and the FAQs.

Console

You can use the Google Cloud Platform Console to manage projects, get API keys, and set up API key restrictions. For more information about the console, see the Google Cloud Platform Console Help.

Quick guide

Step 1: Get an API key

Click the button below to get an API key using the Google Cloud Platform Console. You will be asked to (1) pick one or more products, (2) select or create a project, and (3) set up a billing account. Once your API key is created you will be prompted to restrict the key's usage. (For more information, see Restricting an API key.)

Get Started

Step 2: Add the API key to your app

Swift

Add your API key to your AppDelegate.swift as follows:

  1. Add the following import statement:
    import GoogleMaps
  2. Add the following to your application(_:didFinishLaunchingWithOptions:) method, replacing YOUR_API_KEY with your API key:
    GMSServices.provideAPIKey("YOUR_API_KEY")
  3. If you are also using the Places API, add your key again as shown here:
    GMSPlacesClient.provideAPIKey("YOUR_API_KEY")

Objective-C

Add your API key to your AppDelegate.m as follows:

  1. Add the following import statement:
    @import GoogleMaps;
  2. Add the following to your application:didFinishLaunchingWithOptions: method, replacing YOUR_API_KEY with your API key:
    [GMSServices provideAPIKey:@"YOUR_API_KEY"];
  3. If you are also using the Places API, add your key again as shown here:
    [GMSPlacesClient provideAPIKey:@"YOUR_API_KEY"];

Detailed guide

Follow these steps to get an API key and add restrictions:

  1. Go to the Google Cloud Platform Console.
  2. From the Project drop-down menu, select or create the project for which you want to add an API key.
  3. From the Navigation menu, select APIs & Services > Credentials.
  4. On the Credentials page, click Create credentials > API key.
    The API key created dialog displays your newly created API key.
  5. On the dialog, click Restrict Key.
    (For more information, see Restricting an API key.)
  6. On the API key page, under Key restrictions, set the Application restrictions.
    • Select iOS apps.
    • Add your app's bundle identifier (see the example).
    • Click Save.

Detailed guide for Premium Plan customers

Follow these steps to get an API key and add restrictions:

  1. Go to the Google Cloud Platform Console.
  2. From the Project drop-down menu, select the project created for you when you purchased theGoogle Maps APIs Premium Plan. The project name starts with Google Maps APIs for Business or Google Maps for Work or Google Maps.
  3. From the Navigation menu, select APIs & Services > Credentials.
  4. On the Credentials page, click Create credentials > API key.
    The API key created dialog displays your newly created API key.
  5. On the dialog, click Restrict Key.
    (For more information, see Restricting an API key.)
  6. On the API key page, under Key restrictions, set the Application restrictions.
    • Select iOS apps.
    • Add your app's bundle identifier (see the example).
    • Click Save.

Restricting an API key

Google Maps APIs are available for iOS and Android apps, web browsers, and via HTTP web services. APIs in any platform can use an unrestricted API key. You can optionally add a restriction to the API key. For iOS apps, you restrict the key to your app's bundle identifier. Once restricted, a key will only work on platforms that support that type of restriction.

To add restrictions for an API key, do the following:

  1. Go to the Google Cloud Platform Console.
  2. From the Project drop-down menu, select the project that contains the API key you want to secure.
  3. From the Navigation menu, select APIs & Services > Credentials.
  4. On the Credentials page, click the name of the API key that you want to secure.
  5. On the API key page, under Key restrictions, set the Application restrictions.
    • Select iOS apps.
    • Add your app's bundle identifier (see the example).
    • Click Save.

Send feedback about...

Maps SDK for iOS
Need help? Visit our support page.