View Categories

How to Secure Your Google Maps Platform API Keys

Overview #

Unrestricted Google Maps Platform API keys are vulnerable to abuse if exposed publicly, such as in website code or mobile apps. If unauthorized users gain access to your keys, they may generate charges on your account.

To prevent this, you should secure your API keys by applying the correct restrictions.


Why It Matters #

  • Unauthorized usage risk: Anyone who finds your unrestricted key can use it.
  • Unexpected charges: Usage by unauthorized third parties will be billed to your account.
  • Service interruptions: Prolonged abuse can result in account suspension.

Types of Key Restrictions #

There are two main ways to secure your keys:

  1. Application restrictions – Control where the key can be used:
    • HTTP referrers (websites)
    • IP addresses (server-side apps)
    • Android apps (package name & SHA-1)
    • iOS apps (bundle ID)
  2. API restrictions – Limit the key to specific Google Maps Platform APIs.

Note: Each key can only support one application restriction type. If you use a key across multiple platforms (e.g., web and mobile), create and restrict separate keys for each.


Steps to Restrict Your API Keys #

  1. Sign in to the Google Cloud Console.
  2. Go to APIs & Services > Credentials.
  3. Find the key you want to secure.
  4. Click the edit icon next to the key.
  5. Under Application restrictions, select the correct restriction type (e.g., HTTP referrers for websites).
  6. Add the allowed values (for example: https://example.com/*).
  7. Under API restrictions, limit the key to only the APIs you use.
  8. Save changes.
CleanShot 2025 09 15 at 16.58.43@2x
CleanShot 2025 09 15 at 16.59.20@2x

Best Practices #

  • Use different keys for each environment (development, staging, production).
  • Separate keys per platform (web, iOS, Android, backend).
  • Apply both application and API restrictions for stronger protection.
  • Review and rotate keys regularly to reduce risk.

For Vacation Rental Businesses Looking To Get More Direct Bookings:

Book A Call With Us