Google Distance Matrix API in Zapier: Setup Guide + Key Restrictions

Set up Google Distance Matrix API in Zapier: create a Google Cloud project, enable billing, generate an API key, and apply safe restrictions so your Zap runs.

Mar 22, 2026
Google Distance Matrix API in Zapier: Setup Guide + Key Restrictions
If you want to use the Google Distance Matrix API inside Zapier, you need three things: a Google Cloud project, billing enabled on that project, and an API key that is restricted for safety. The setup is not hard, but a few common “gotchas” (wrong project selected, API not enabled, or overly strict key restrictions) can stop your Zap cold.

What you are building

You are creating a Google Cloud project that has the Distance Matrix API enabled, then generating an API key you can use in Zapier to calculate distance and travel time between addresses.

Checklist: Google Distance Matrix API setup for Zapier

1) Create a dedicated Google Cloud project

  1. Open the Google Cloud Console.
  1. In the top bar, select the project dropdown.
  1. Click New Project.
  1. Name it something easy to recognize later, like Zapier-Distance-Matrix.
⚠️
Gotcha: Project names cannot include some special characters (for example, “/”).

2) Enable billing for the project (required)

Google requires billing to be enabled on the project to use Distance Matrix API.
  1. In Google Cloud Console, go to Billing.
  1. If you do not have a billing account yet, create one.
  1. Link your new project to the billing account.
Budgets and alerts help prevent surprise spend.
  1. In Billing, open Budgets & alerts.
  1. Create a budget for this billing account or project scope.
  1. Add alert thresholds (example: 50%, 90%, 100%).

3) Enable the Distance Matrix API

  1. In Google Cloud Console, go to APIs & Services.
  1. Click Library.
  1. Search for Distance Matrix API.
  1. Click Enable.
⚠️
Gotcha: Make sure the correct project is selected in the top bar before you enable the API.

4) Create an API key

  1. Go to Google Maps Platform > Credentials.
  1. Click Create credentials > API key.

5) Restrict the API key (do not skip)

Google recommends restricting keys with both:
  • Application restrictions (where the key can be used)
  • API restrictions (which APIs the key can call)
In Credentials, click your new API key and apply restrictions:
  • API restrictions: Restrict to Distance Matrix API (and any other Maps API you truly need, such as Geocoding API).
  • Application restrictions: This depends on how you are calling the API.
    • If the key is only used in Zapier (server-side), keep it out of client-side code and do not share it publicly.
    • If you are embedding any Maps functionality client-side, use a separate browser-restricted key for that use case.
Gotcha: If you restrict the key too aggressively, your Zap may fail with “API project is not authorized” or similar errors. If that happens, confirm the API is enabled and revisit restrictions.

6) Add the key to Zapier

Where you add the key depends on your Zap:
  • If you are using Webhooks by Zapier, add the key as a query param (often key=YOUR_API_KEY) in your request URL.
  • If you are using a Code by Zapier step, store the key as an input field and reference it in code, rather than hardcoding it in multiple places.
If you want help implementing this safely inside your Zaps, Connex can help with Zapier support and build the complete workflow end to end.

Common setup errors (and quick fixes)

“This API key is invalid”

  • Confirm you copied the full key value.
  • Confirm billing is enabled for the same project the key belongs to.

“This API project is not authorized to use this API”

  • Confirm Distance Matrix API is enabled in APIs & Services > Library.
  • Confirm the key has API restrictions that include Distance Matrix API.
  • If you recently changed restrictions, wait a few minutes and try again.

Unexpected billing concerns

  • Set up a billing budget and alert thresholds.
  • Monitor usage and reduce calls by batching origins and destinations when possible.

Next step: build the Zap

If you share your workflow goal (for example, “cluster addresses that are close to each other”), we can recommend the right Zap structure and the safest way to store and rotate keys.
📞
Want help building this automation?