jon_childs
jon_childs

Reputation: 675

Is it possible to see what domains are using a Google API Key?

I've had a major spike in my Google API usage. Because many of my sites share the same key, I was hoping to see a sorted list of where the API calls are coming from. I haven't managed to find how to do that in the Google API Console. I know that you can restrict the keys to specific domains, but that's not realistic with hundreds of domains.

In the mean time I've regenerated the keys and deployed them in case they've been co-opted by someone else. If anyone has any insight, I'd really appreciate it. Thanks.

Upvotes: 3

Views: 2565

Answers (3)

Tyler Collier
Tyler Collier

Reputation: 11988

I'm able to using the following technique, although only by one API at a time. For me, I only cared about the Google Maps API so that was fine.

Go to https://console.cloud.google.com/google/maps-apis/metrics?project=MY_PROJECT_NAME&supportedpurview=project, replacing MY_PROJECT_NAME with your project name.

There is a drop-down at the top where you choose the API. Change it from All Google Maps Platform APIs to whichever you want, for example Maps JavaScript API. Then, ensure the filters are shown by using the SHOW FILTERS button. In the Grouped By filter, choose Domain. You'll then see the domains graphed. You'll also see the domains listed, though that is not shown in my screenshot. If you hover your mouse in the graph, it will identify the domain. You can choose individual domains to show in the Domain filter.

graph by domain

Upvotes: 4

ecg8
ecg8

Reputation: 1392

You can do this for all future requests but not for past ones. Google recently implemented a channel parameter in requests. You can add a different channel (from 0 to 999) to your requests from different URLs and then filter your billing reports on that channel to see exactly what you are looking for in your billing report moving forward. https://developers.google.com/maps/reporting/gmp-reporting#usage-tracking-per-channel

Upvotes: 2

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117136

Is it possible to see what domains are using a Google API Key?

No its not.

If you want to know where the calls are coming from i would make project for each domain and then create a key. This will mean monitoring 100 google projects and creating billing accounts for each. I dont really see any other way around it though.

Upvotes: 0

Related Questions