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
- Overview
- Create a Google Cloud Platform Account
- Set Up a New Project
- Enable APIs
- Create API Key
- Restrict API Key (Optional but Recommended)
- C&C Set up (Optional)
TLDR – Too Long, Didn’t Read
- Create a Google Cloud Platform account (enter billing info, but get $200/month free usage).
- Enable needed APIs (Maps, Geocoding, Places, YouTube).
- Generate an API key (a digital access key).
- For security, restrict key usage to your website URLs.
- Send key to C&C admin to add to your website’s code.
- 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
- Go to the Google Cloud Platform website: https://console.cloud.google.com/.
- Click on the “Get Started” button.
- Follow the prompts to create your account.
Step 2: Set Up a New Project
- On the Google Cloud Platform Console, click the project drop-down menu at the top and select “New Project.”
- Enter a name for your project, and optionally, you can also choose an organization and location for the project.
- Click the “Create” button.
Step 3: Enable APIs
- In the Cloud Platform Console, navigate to the “APIs & Services” > “Library” section.
- Search for the APIs you need to enable:
- Maps JavaScript API
- Geocoding API
- Places API
- YouTube Data API v3
- Click on each API and then click the “Enable” button.
Step 4: Create API Key
- In the Cloud Platform Console, navigate to “APIs & Services” > “Credentials.”
- Click the “Create Credentials” button and select “API Key.”
- 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)
- While still on the “APIs & Services” > “Credentials” page, click on your API key.
- Under “Key restriction,” click “API restrictions.”
- Choose “HTTP referrers” from the dropdown menu.
- Add the following URLs to allow the API key to work (make sure to change websiteurl.com to your own URL):
- 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.