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 requests per month. 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.
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.
From here, choose Credentials from the main navigation on the left.
Then choose Create Credentials -> API Key.
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.
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.
https://www.mysupercoolwebsite.com/ <- This line gives permission to your homepage to use the API key
https://www.mysupercoolwebsite.com/* <- 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.