How to Create a Google API Key for your Club Directory / County TV

If you want to put a map on your club directory or display your YouTube videos on County TV, you have to “create an API key.” Think of it like a special digital key that Google gives you so your website can talk to their services. Here’s a step-by-step tutorial on how to do this:

Quicklinks

TLDR – Too Long, Didn’t Read

  1. Create a Google Cloud Platform account (enter billing info, but get $200/month free usage).
  2. Enable needed APIs (Maps, Geocoding, Places, YouTube).
  3. Generate an API key (a digital access key).
  4. For security, restrict key usage to your website URLs.
  5. Send key to C&C admin to add to your website’s code.
  6. Remember to monitor your usage to avoid any unwanted billing.

Overview

As part of the setup, you’ll need to provide billing information. Don’t worry, Google provides $200 of usage every month for free. This means you can use their services without paying, up to a certain limit. This is like having a budget of up to 28,500 maploads per month, which is quite a lot!

Club & County use their own Google API key during development, but with the number of Counties/Provinces that we host, there’s a higher chance of us reaching these free limits sooner. This is why, to avoid any issues, it’s recommended that each County/Province creates their own API key once their site is live.

Please Note: You need to monitor your API usage and consider upgrading to a paid plan if your usage exceeds the free tier limits.

Step 1: Create a Google Cloud Platform Account

  1. Go to the Google Cloud Platform website: https://console.cloud.google.com/.
  2. Click on the “Get Started” button.
  3. Follow the prompts to create your account.

Step 2: Set Up a New Project

  1. On the Google Cloud Platform Console, click the project drop-down menu at the top and select “New Project.”
  2. Enter a name for your project, and optionally, you can also choose an organization and location for the project.
  3. Click the “Create” button.

Step 3: Enable APIs

  1. In the Cloud Platform Console, navigate to the “APIs & Services” > “Library” section.
  2. Search for the APIs you need to enable:
    • Maps JavaScript API
    • Geocoding API
    • Places API
    • YouTube Data API v3
  3. Click on each API and then click the “Enable” button.

Step 4: Create API Key

  1. In the Cloud Platform Console, navigate to “APIs & Services” > “Credentials.”
  2. Click the “Create Credentials” button and select “API Key.”
  3. A new API key will be created. You can now restrict its usage to ensure security and manage usage limits.

Step 5: Restrict API Key (Optional but Recommended)

  1. While still on the “APIs & Services” > “Credentials” page, click on your API key.
  2. Under “Key restriction,” click “API restrictions.”
  3. Choose “HTTP referrers” from the dropdown menu.
  4. Add the following URLs to allow the API key to work (make sure to change websiteurl.com to your own URL):
  5. Click “Save” to apply the restrictions.

C&C Set up (Optional)

If you’d prefer Club & County to set up the API key and restrictions for you, please send kristina@clubandcounty.com the login details to your Google Cloud Platform account once you’ve created your account + set up billing. We can then follow the steps outlined above to create the API key and set up restrictions on your behalf.