Google now requires that all users of its Maps API have an API key.
Step 1: Sign In or Create a Google Account
Go to https://accounts.google.com/ and either sign in to your existing Google account or create a new one.
Step 2: Access Google Cloud Console
Navigate to https://console.cloud.google.com/
Step 3: Create a New Project
- On the project selector page, click "Create Project" to begin creating a new Cloud project
- Enter a project name (for example, "My Maps Project" or "Website Maps") - recommend entering your domain name with no http prefix and no periods..
- Click the "Create" button
Step 4: Set Up Billing
This is required
even if you only plan to use the free tier:
- Give your billing project a name, then click Continue
- Choose your country from the dropdown
- Enter your contact information and payment details into the form, then choose Next
- Complete the billing setup (you'll get $200 free monthly credit which covers most usage)
Step 5: Enable the Required APIs
- From the navigation menu (top left), select "APIs & Services" → "Library"
- Use the search bar to find "Maps JavaScript API" and press enter
- Use the search bar to find "Directions API" and press enter
- Click on "Maps JavaScript API" in the results
- Click the "Enable" button
Step 6: Create Your API Key
- Go to the Google Maps Platform > Credentials page
- Click "Create credentials" > "API key"
- A pop-up window will appear, revealing the Map API key that has been generated for you
- Copy this key immediately and save it somewhere safe
- Click "Close"
Step 7: Restrict Your API Key
To prevent
unauthorized use and unexpected charges:
- On the Credentials page, click on your newly created API key
- Under Application restrictions, choose one:
- Under API restrictions, select "Restrict key" and choose which specific APIs this key can access. Make sure Maps Javascript API and Directions API are checked.
- Click "Save"
Note: It may take up to 5 minutes for settings to take effect
Important Reminders
- The API key will initially be labeled generically (like "API Key 1") - rename it for clarity
- Keep your API key secure and never share it publicly
- Monitor your usage in the Google Cloud Console to avoid unexpected charges
- The $200 monthly credit covers the vast majority of small to medium usage needs