{"id":2367,"date":"2026-10-20T08:32:19","date_gmt":"2026-10-20T07:32:19","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/google-api-key-restrictions-geocoding-import\/"},"modified":"2026-10-20T08:40:21","modified_gmt":"2026-10-20T07:40:21","slug":"google-api-key-restrictions-geocoding-import","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/troubleshooting\/google-api-key-restrictions-geocoding-import\/","title":{"rendered":"Google API key restrictions: maps work but geocoding on import fails"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Use two keys. Maps run in the visitor&#8217;s browser and suit a key restricted to your website (HTTP referrers). Geocoding during CSV imports runs on your server, and Google rejects referrer restricted keys for server requests. GeoDirectory has a separate field for that second key.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set up the two keys<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>In the Google Cloud Console, keep your current key restricted by HTTP referrers (your domain). This is the Google Maps API KEY in GeoDirectory.<\/li>\n\n\n\n<li>Create a second key in the same project and restrict it by IP address, using your server&#8217;s IP. Allow the Geocoding API and Time Zone API on it.<\/li>\n\n\n\n<li>In WordPress, go to GeoDirectory > Settings > General and click Show Advanced.<\/li>\n\n\n\n<li>Paste the second key into Google Geocoding API Key and save.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">When the Geocoding key field is empty, GeoDirectory uses the Maps key for server requests too, which is why imports fail with a referrer restricted key and why maps fail when the only key is IP restricted.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What uses which key<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Maps key: the maps, address search on the add listing map, and the search bar&#8217;s near lookups, all in the browser.<\/li>\n\n\n\n<li>Geocoding key: geocoding addresses during CSV imports, time zone lookups for business hours, and other address lookups GeoDirectory makes from the server.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The Generate Key button next to the geocoding field opens Google with the Geocoding and Time Zone APIs selected. If imports still fail, the import log shows the status Google returned, for example &#8220;Google geocode failed: REQUEST_DENIED&#8221;. There are more import tips in <a href=\"https:\/\/wpgeodirectory.com\/documentation\/article\/how-tos\/csv-imports-useful-tips\/\">our CSV imports guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Use two keys. Maps run in the visitor&#8217;s browser and suit a key restricted to your website (HTTP referrers). Geocoding during CSV imports runs on your server, and Google rejects referrer restricted keys for server requests. GeoDirectory has a separate field for that second key. Set up the two keys When the Geocoding key field [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[],"article\/categories":[211,437],"class_list":["post-2367","gd_place","type-gd_place","status-publish","hentry","gd_placecategory-tips-tricks-more","gd_placecategory-troubleshooting"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article"}],"about":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/types\/gd_place"}],"author":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/comments?post=2367"}],"version-history":[{"count":1,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2367\/revisions"}],"predecessor-version":[{"id":2428,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/2367\/revisions\/2428"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=2367"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=2367"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=2367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}