How to Set Up Your Google Maps API Key
Google Maps API Pricing
Google charges per API request after the $200/month free credit is used.
| API | Cost per 1,000 requests | Free monthly requests |
|---|---|---|
| Directions API | $5.00 | ~40,000 |
- Processing 100 address pairs = 100 API requests
- 40,000 requests per month / 100 pairs per batch = 400 full batch runs per month at no cost
If you process very high volumes, you may incur charges, but you will receive billing alerts and can set spending limits to stay in control.
Step-by-Step: Creating Your Google Maps API Key
Step 1: Sign In to Google Cloud Console
- Go to console.cloud.google.com
- Sign in with your Google account (a personal Gmail account works; a Google Workspace account is fine too)
- If this is your first visit, you will be asked to agree to the Terms of Service and set up a billing account
Screenshot placeholder: Google Cloud Console homepage after sign-in, showing the project selector in the top navigation bar
Step 2: Create a Project (or Select an Existing One)
API keys are organized under Google Cloud projects. You can create a dedicated project for this tool or add the key to an existing project.
To create a new project:
- Click the project selector dropdown at the top of the page (next to the Google Cloud logo)
- Click New Project
- Enter a project name (e.g., "Driving Distance Calculator" or "CWT Tools")
- Click Create
- Wait for the project to be created (usually 10-15 seconds)
- Make sure the new project is selected in the dropdown
Screenshot placeholder: "New Project" dialog with project name field and Create button
Step 3: Enable the Directions API
Your project needs the Directions API enabled before you can use it.
- In the left sidebar, click APIs & Services > Library
- In the search bar, type "Directions API"
- Click on Directions API in the search results
- Click the blue Enable button
- Wait for the API to enable (page will refresh when complete)
Screenshot placeholder: Directions API page in the library with the Enable button highlighted
Step 4: Set Up Billing (Required by Google)
Google requires a billing account to use the Maps APIs, even for free-tier usage. The $200/month credit is applied automatically and most users never pay anything.
- In the left sidebar, click Billing
- If prompted, click Link a billing account or Create billing account
- Follow Google's steps to add a payment method (credit card or bank account)
- Google will not charge you until your usage exceeds $200/month
Note: Setting a budget alert is recommended. See Step 7 below.
Screenshot placeholder: Billing setup page showing payment method entry form
Step 5: Create an API Key
- In the left sidebar, click APIs & Services > Credentials
- Click + Create Credentials at the top of the page
- Select API key from the dropdown
- Google will generate and display your new API key (a string starting with "AIza...")
- Copy this key - you will need it in the next step
Screenshot placeholder: Credentials page with the "+ Create Credentials" button and the API key creation dialog showing a generated key
Step 6: Restrict Your API Key (Recommended)
Restricting the key ensures it can only be used for the Directions API, reducing the risk if the key is ever exposed.
- In the Credentials list, click the pencil (edit) icon next to your new API key
- Under API restrictions, select Restrict key
- In the dropdown, check Directions API
- Click Save
Optional - Application restrictions:
If you want to limit the key to only work from your IP address, under Application restrictions select IP addresses and add your machine's public IP. Note that this is optional and may cause issues if your IP changes.
Screenshot placeholder: API key restriction settings showing "Restrict key" selected and Directions API checked
Step 7: Set a Budget Alert (Highly Recommended)
To avoid unexpected charges:
- In the left sidebar, click Billing
- Click Budgets & alerts
- Click + Create Budget
- Set a budget amount (e.g., $5.00) for peace of mind
- Set alert thresholds (e.g., 50%, 90%, 100%)
- Click Save
Google will email you when your usage approaches the budget threshold. This does not stop API calls - it only sends a notification.
Screenshot placeholder: Budget alert creation form with amount and threshold fields
Step 8: Add Your API Key to the Driving Distance Calculator
- Return to the Driving Distance Calculator tool on customwebtools.com
- On the setup page, paste your API key into the Google Maps API Key field
- Click Save API Key
- The system will validate your key by making a test request
- If valid, you will see a green confirmation message
Screenshot placeholder: API key setup form with the key field and Save button, showing a green "API key validated successfully" confirmation
Troubleshooting Common API Key Issues
"API key not valid" or "REQUESTDENIED"
Causes and fixes:
- The key was copied incorrectly - Return to Google Cloud Console > Credentials and copy the key again. Make sure there are no extra spaces before or after the key.
- The Directions API is not enabled - Go to APIs & Services > Library, search for "Directions API", and click Enable.
- Billing is not set up - Google requires a billing account even for free-tier usage. Go to Billing and add a payment method.
- The project is not selected - Make sure you have the correct project selected in the Google Cloud Console dropdown.
"This API project is not authorized to use this API"
The Directions API has not been enabled on your project.
- Go to APIs & Services > Library
- Search for "Directions API"
- Click Enable
"You have exceeded your daily request quota"
Your usage has exceeded the $200/month free credit.
- Go to Google Cloud Console > APIs & Services > Quotas
- Review your Directions API usage
- Consider setting up a budget alert or increasing your spending limit
"API key restriction blocks this request"
If you added application restrictions (IP address restrictions), the request is being blocked.
- Go to Credentials > click edit on your key
- Under Application restrictions, select None (or update your IP address)
- Save the key
The key was saved but the tool shows "Setup Required"
Try the following:
- Log out and log back in to customwebtools.com
- Navigate back to the tool page and check if the setup banner is gone
- If it persists, go to the setup page and re-enter your API key
Rotating or Updating Your API Key
If your API key is compromised or you want to generate a new one:
- In Google Cloud Console, go to APIs & Services > Credentials
- Delete the old key or click the rotate icon
- Generate a new key following Steps 5-6 above
- Return to the tool setup page on customwebtools.com
- Enter the new key and click Save
Related Articles
- Getting Started with the Driving Distance Calculator
- Input Formatting and Best Practices