How to setup a YouTube API Key (YouTube Integration)

Our Ultima Gaming WordPress theme comes with some YouTube integrations that requires the use of an API key. This is due to limitations on access to the YouTube API.

YouTube does not allow you to make unlimited use of it's API without paying. For free, you can get up to 10,000 API units per day. For most general usage this should be fine, but if you go over your limit you will be asked to add a credit card to your Google Cloud account in order to pay for any requests over your 10,000.

Google Cloud

The first step in obtaining your YouTube API key is to sign up for a Google Cloud account here.

Once signed up you need to navigate to your console here.

Enable YouTube API V3

First you must enable the YouTube API V3 on your account.

Choose APIs & Services -> Dashboardfrom the main navigation on the left.

Click Enable APIs and Services at the top.

You should now be in the API Library. Search for YouTube and select YouTube Data API V3. Make sure it's enabled.

Get your API Key

From here, choose APIs & Services -> Credentials from the main navigation on the left.

Then choose Create Credentials -> API Key.

This will instantly generate you an API key, which you should copy / paste into your theme settings now.

However, in order to prevent unauthorized usage of your API key you should click Restrict Key.

Under Application Restrictions, choose HTTP Referrers.

Then under Website Restrictions, choose Add an Item.

This is where we tell google which URLs should have access to our API key. This should match the URL of your website, and we can use wildcard selectors to define all pages. For example, adding these two lines gives your entire website access to your API key. <- This line gives permission to your homepage to use the API key* <- This line gives access to all other pages to use your API key

Once you're done, click Save at the bottom of the page.

Congratulations, you now have a free YouTube API key which will serve you up to 10,000 API requests each month.