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.

APICost per 1,000 requestsFree monthly requests
Directions API$5.00~40,000
For most users, the free $200/month credit is more than sufficient. For example:
  • 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

  1. Go to console.cloud.google.com
  2. Sign in with your Google account (a personal Gmail account works; a Google Workspace account is fine too)
  3. 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:

  1. Click the project selector dropdown at the top of the page (next to the Google Cloud logo)
  2. Click New Project
  3. Enter a project name (e.g., "Driving Distance Calculator" or "CWT Tools")
  4. Click Create
  5. Wait for the project to be created (usually 10-15 seconds)
  6. 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.

  1. In the left sidebar, click APIs & Services > Library
  2. In the search bar, type "Directions API"
  3. Click on Directions API in the search results
  4. Click the blue Enable button
  5. 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.

  1. In the left sidebar, click Billing
  2. If prompted, click Link a billing account or Create billing account
  3. Follow Google's steps to add a payment method (credit card or bank account)
  4. 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

  1. In the left sidebar, click APIs & Services > Credentials
  2. Click + Create Credentials at the top of the page
  3. Select API key from the dropdown
  4. Google will generate and display your new API key (a string starting with "AIza...")
  5. 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

Restricting the key ensures it can only be used for the Directions API, reducing the risk if the key is ever exposed.

  1. In the Credentials list, click the pencil (edit) icon next to your new API key
  2. Under API restrictions, select Restrict key
  3. In the dropdown, check Directions API
  4. 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

To avoid unexpected charges:

  1. In the left sidebar, click Billing
  2. Click Budgets & alerts
  3. Click + Create Budget
  4. Set a budget amount (e.g., $5.00) for peace of mind
  5. Set alert thresholds (e.g., 50%, 90%, 100%)
  6. 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

  1. Return to the Driving Distance Calculator tool on customwebtools.com
  2. On the setup page, paste your API key into the Google Maps API Key field
  3. Click Save API Key
  4. The system will validate your key by making a test request
  5. 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.

  1. Go to APIs & Services > Library
  2. Search for "Directions API"
  3. Click Enable

"You have exceeded your daily request quota"

Your usage has exceeded the $200/month free credit.

  1. Go to Google Cloud Console > APIs & Services > Quotas
  2. Review your Directions API usage
  3. 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.

  1. Go to Credentials > click edit on your key
  2. Under Application restrictions, select None (or update your IP address)
  3. Save the key

The key was saved but the tool shows "Setup Required"

Try the following:

  1. Log out and log back in to customwebtools.com
  2. Navigate back to the tool page and check if the setup banner is gone
  3. 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:

  1. In Google Cloud Console, go to APIs & Services > Credentials
  2. Delete the old key or click the rotate icon
  3. Generate a new key following Steps 5-6 above
  4. Return to the tool setup page on customwebtools.com
  5. Enter the new key and click Save

  • Getting Started with the Driving Distance Calculator
  • Input Formatting and Best Practices

Was this article helpful?