{"id":681,"date":"2025-03-24T14:27:23","date_gmt":"2025-03-24T14:27:23","guid":{"rendered":"https:\/\/wpgeodirectory.com\/documentation\/article\/get-a-google-api-key\/"},"modified":"2025-04-03T15:23:44","modified_gmt":"2025-04-03T14:23:44","slug":"get-a-google-api-key","status":"publish","type":"gd_place","link":"https:\/\/wpgeodirectory.com\/documentation\/article\/installation\/get-a-google-api-key\/","title":{"rendered":"Get a Google API Key"},"content":{"rendered":"\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\"><strong>Open Street Maps <\/strong>(OSM) can be used as a <strong>free alternative<\/strong> to Google Maps. Simply leave the Google API Key input empty and the system will use Open Street Maps.<\/span><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>API Key<\/strong> &#8211; A Google <strong>API key is required<\/strong> to use Google Maps features.<\/li>\n\n\n\n<li><strong>Google Account<\/strong> &#8211; A Google account (which is free) is required to be able to generate an API Key.<\/li>\n\n\n\n<li><strong>Billing Account<\/strong> &#8211; Google now <strong>requires a credit or debit card <\/strong>on file <strong>for Maps to work<\/strong>.&nbsp; You are given <strong>$200 free credit each month<\/strong> which will essentially mean the service is <strong>still free for the majority of users<\/strong>.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1 &#8211; Sign in or Signup to Google<\/h2>\n\n\n\n<p>You are <strong>required to have a Google account<\/strong> to obtain an API key. <a href=\"https:\/\/accounts.google.com\/signin\/v2\/identifier\" target=\"_blank\" rel=\"noopener\">Sign in to Google or Create an account.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2 &#8211; Generate an API Key<\/h2>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-danger mb-3\" role=\"alert\"><span class=\"fas fa-exclamation-triangle me-2\"><\/span><span class=\"flex-grow-1\"><strong>IMPORTANT: <\/strong>Google maps <strong>will not work until a billing account has been created<\/strong>, if you do not have an active billing account please follow <strong>step 3<\/strong> after this.<\/span><\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container bg-image-fixed list-group list-group-numbered\">\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Generate a Key<\/strong> &#8211; In your website&#8217;s GeoDirectory Settings under <strong>GeoDirectory &gt; Settings &gt; General &gt;&nbsp;Google Maps API KEY<\/strong>.&nbsp; You will see a button to generate an API Key, <strong>click the button<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"123\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-toGq7wD3Im.jpg\" alt=\"\" class=\"wp-image-1211\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-toGq7wD3Im.jpg 872w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-toGq7wD3Im-300x42.jpg 300w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-toGq7wD3Im-768x108.jpg 768w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Create a Project <\/strong>&#8211; You are required to create a project name, we suggest &#8220;GeoDirectory&#8221; however if you already have a project you wish to use then you can select it from the list. <strong>Once done, click NEXT<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"263\" height=\"223\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-acUOF8rK8Z.png\" alt=\"\" class=\"wp-image-1212\"\/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Copy &amp; Save API Key<\/strong> &#8211; After you click &#8220;Next&#8221; on the last screen <strong>you will be shown your API key<\/strong>, you need to <strong>copy this and paste it into your GeoDirectory Settings and Save<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"562\" height=\"81\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-zNyXvE31pn.png\" alt=\"\" class=\"wp-image-1213\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-zNyXvE31pn.png 562w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-zNyXvE31pn-300x43.png 300w\" sizes=\"auto, (max-width: 562px) 100vw, 562px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3 &#8211; Activate Billing Account<\/h2>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container bg-image-fixed list-group list-group-numbered\">\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Select Project <\/strong>&#8211; <a href=\"https:\/\/console.cloud.google.com\/projectselector2\/billing\/enable\" target=\"_blank\" rel=\"noopener\">Open this Google page<\/a> and select the project you created or selected in<strong> step 2<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"200\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-tvA0C2JHHR.png\" alt=\"\" class=\"wp-image-1214\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-tvA0C2JHHR.png 436w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-tvA0C2JHHR-300x138.png 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Enable Billing<\/strong> &#8211; If you do not already have a billing account setup then you will be asked to create one. <strong>Click &#8220;Create Billing Account&#8221;.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"583\" height=\"255\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-GwadIfioJU.png\" alt=\"\" class=\"wp-image-1215\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-GwadIfioJU.png 583w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-GwadIfioJU-300x131.png 300w\" sizes=\"auto, (max-width: 583px) 100vw, 583px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Enter Billing Details<\/strong> &#8211; Follow the instructions and <strong>fill out the billing details and Submit<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"509\" height=\"99\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-wkXic4pK5g.png\" alt=\"\" class=\"wp-image-1216\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-wkXic4pK5g.png 509w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-wkXic4pK5g-300x58.png 300w\" sizes=\"auto, (max-width: 509px) 100vw, 509px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Add billing to the project &#8211; <\/strong>once you have billing setup, then you must assign the billing account to serve as the billing account for the API project you are working with.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Done<\/strong> &#8211; After completion, <strong>it may take up to 15 minutes before your API key will start working.<\/strong><\/p>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4 &#8211; Restrict API Key Access<\/h2>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-warning mb-3\" role=\"alert\"><span class=\"fas fa-exclamation-triangle me-2\"><\/span><span class=\"flex-grow-1\"><strong>WARNING: <\/strong>Restricting the API key HTTP referrers will <strong>prevent our import feature<\/strong> that attempts to <strong>fix addresses with missing location data<\/strong>, if you plan to use this feature then please<strong> follow step 5<\/strong>.<\/span><\/div>\n\n\n\n<p>At this point, your API key should be working on your site, <strong>the issue is that anyone could view your key<\/strong> and use it on their site, using up your budget. You may have received an email titled &#8220;Publicly accessible Google API key for Google Cloud Platform project&#8221;, this is how you restrict the API key.<\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container bg-image-fixed list-group list-group-numbered\">\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Select Project<\/strong> &#8211; Open your <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\" target=\"_blank\" rel=\"noopener\">Google Console credentials page<\/a> and select the project you are using for GeoDirectory.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"375\" height=\"43\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-1Va1v2FAxl.png\" alt=\"\" class=\"wp-image-1217\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-1Va1v2FAxl.png 375w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-1Va1v2FAxl-300x34.png 300w\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Select the Key to Edit<\/strong> &#8211; Click the edit icon next to the key you wish to edit.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"998\" height=\"148\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-4XzvW0jzeT.png\" alt=\"\" class=\"wp-image-1218\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-4XzvW0jzeT.png 998w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-4XzvW0jzeT-300x44.png 300w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-4XzvW0jzeT-768x114.png 768w\" sizes=\"auto, (max-width: 998px) 100vw, 998px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Restrict Access<\/strong> &#8211; Set the restriction to &#8220;HTTP referrers&#8221; and then enter any websites you wish your key to work on in the settings.<\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-alert d-flex align-items-center fade show alert alert-info mb-3\" role=\"alert\"><span class=\"fas fa-info-circle me-2\"><\/span><span class=\"flex-grow-1\">Please note the format where * represents a wildcard.\u00a0 If you enter only mywebsite.com then www.mywebsite.com will not work, so either enter both or use the wild card of *.mywebsite.com\/*\u00a0<br><strong>Please Note:<\/strong>\u00a0*.mywebsite.com\/* will not work if your domain is https:\/\/mywebsite.com you MUST also add\u00a0<strong>mywebsite.com\/*\u00a0<\/strong><\/span><\/div>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"527\" height=\"409\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-GmohDozJsL.png\" alt=\"\" class=\"wp-image-1219\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-GmohDozJsL.png 527w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-GmohDozJsL-300x233.png 300w\" sizes=\"auto, (max-width: 527px) 100vw, 527px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5 &#8211; Geocoding API Key (optional)<\/h3>\n\n\n\n<p>When <strong>importing listing with partial location info<\/strong> our system will attempt to fill in the missing parts by adding either GPS or location data.&nbsp; If the main API key is HTTP referrer restricted then this functionality will not work, the solution to this is to <strong>create a second private key that is unrestricted<\/strong> or IP restricted to your server.<\/p>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container bg-image-fixed list-group list-group-numbered\">\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Select Project<\/strong> &#8211; Open your <a href=\"https:\/\/console.cloud.google.com\/apis\/credentials\" target=\"_blank\" rel=\"noopener\">Google Console credentials page<\/a> and select the project you are using for GeoDirectory.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"375\" height=\"43\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-1Va1v2FAxl.png\" alt=\"\" class=\"wp-image-1217\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-1Va1v2FAxl.png 375w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-1Va1v2FAxl-300x34.png 300w\" sizes=\"auto, (max-width: 375px) 100vw, 375px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Create API Key<\/strong> &#8211; Select &#8220;Create Credentials&#8221; and then &#8220;API key&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"628\" height=\"290\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-zffYsK6Ub1.png\" alt=\"\" class=\"wp-image-1221\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-zffYsK6Ub1.png 628w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-zffYsK6Ub1-300x139.png 300w\" sizes=\"auto, (max-width: 628px) 100vw, 628px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Rename<\/strong> &#8211; As this key may need to be unrestricted to work we suggest editing and renaming the key such as &#8220;<strong>Secret Geocode<\/strong>&#8220;.<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-blockstrap-blockstrap-widget-container border-0 bg-image-fixed list-group-item\">\n<p><strong>Save<\/strong> &#8211; On your GeoDirectory Website visit GeoDirectory > Settings > General >\u00a0(<strong>click advanced, top right<\/strong>) >\u00a0Google Geocoding API Key. Paste the secret key into the setting and save.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"581\" height=\"158\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-o4FwS6dlmh.png\" alt=\"\" class=\"wp-image-1222\" srcset=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-o4FwS6dlmh.png 581w, https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/file-o4FwS6dlmh-300x82.png 300w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">APIs required<\/h2>\n\n\n\n<p>The most important points for this second key are that the project has all 11 APIs added and the second key should have no restrictions.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/63117fbeab6515dc92b2ab56a10a4783.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/wpgeodirectory.com\/documentation\/wp-content\/uploads\/2025\/03\/4f921ab5164eba3f4815cdb0e1f015a3.png\" alt=\"\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Help! My Maps aren&#8217;t Loading for Users!&nbsp;<\/h2>\n\n\n\n<p>If, despite following the above instructions, your Maps do not seem to work for your site visitors, but you can load them perfectly fine when logged in, it is almost always a caching issue.&nbsp;<\/p>\n\n\n\n<p>Try to clear your website&#8217;s cache &#8212; you can do it from your caching plugin. More importantly, try to delete any CSS\/JS minification files as well. After that, Maps should load perfectly fine.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Help! I was using the Google Maps Trial and it stopped working!<\/strong><\/h2>\n\n\n\n<p>Even though Google collects your CC when you sign up for the trial, when the trial ends they do not auto-bill you. You have to log back into the console and &#8216;upgrade&#8217; to the paid version.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisites Step 1 &#8211; Sign in or Signup to Google You are required to have a Google account to obtain an API key. Sign in to Google or Create an account. Step 2 &#8211; Generate an API Key Step 3 &#8211; Activate Billing Account Step 4 &#8211; Restrict API Key Access At this point, your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"article\/tags":[447,448,449],"article\/categories":[208,394],"class_list":["post-681","gd_place","type-gd_place","status-publish","hentry","gd_place_tags-google-maps-api","gd_place_tags-integrating-google-maps","gd_place_tags-api-integration","gd_placecategory-getting-started","gd_placecategory-installation"],"_links":{"self":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/681","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=681"}],"version-history":[{"count":0,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/681\/revisions"}],"wp:attachment":[{"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/media?parent=681"}],"wp:term":[{"taxonomy":"gd_place_tags","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/tags?post=681"},{"taxonomy":"gd_placecategory","embeddable":true,"href":"https:\/\/wpgeodirectory.com\/documentation\/wp-json\/wp\/v2\/article\/categories?post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}