With YouTube being the largest video website on the internet, you may want to add YouTube videos to your web app. But first you will need to register a YouTube API key to do so. With your YouTube API key, you can access almost any data directly from YouTube. Get videos, playlists, even upload videos to your account. With all that data, you can create just about any web app or wordpress plugin you want!
What is a YouTube API key?
With the YouTube Data API, you can add a variety of YouTube features to your application. Use the API to upload videos, manage playlists and subscriptions, update channel settings, and more.YouTube Data API page (source)
It really is that simple. With the YouTube API, you can get access to all the YouTube data that your heart (and code) desires).
Is the YouTube API free?
Yes! The YouTube API is free. But it comes with some limitations. Don’t worry. Most user’s will not reach them.
The API uses a quota usage tracker to ensure people and applications are fairly using the data. When you register a YouTube API key, you get 10,000 units / day of usage. That’s a lot!
Every operation your do with your API key costs a different amount of “units”. But don’t worry, most
- A simple read operation that only retrieves the ID of each returned resource has a cost of approximately 1 unit.
- A write operation has a cost of approximately 50 units.
- A video upload has a cost of approximately 1600 units.
What can you do with the YouTube API?
With the YouTube API, you can get nearly any information from YouTube. Right from the source. You can read and write most information on YouTube, with the correct permissions of course.
You can read the getting started guide to find a more comprehensive list, but here are some examples of what you can do with the YouTube API:
- upload videos
- get a playlist and videos within
- get channel information like name and banner information
- so much more
Steps to Register a YouTube API Key
- Create a New Project on the Google Cloud Platform
- Register a new API key credential
- Grant YouTube API v3 access to your key
Step 1. Create a New Project on the Google Cloud Platform
First be sure you are logged into your Google account, then navigate over to the Google Cloud Platform website.
From this home page, you need to create a new project. Click on the “Select a Project” link. Then on the popup click “New Project.”
On the next page, simple enter your Project Name into the text box and click Create. To help me stay organized, I usually just enter the website or plugin name as the project name.
Step 2. Register a new API key credential
After creating your new project, you should get a notification once the project is setup. Then navigate over to the project page by clicking on the “Select a Project” link again.
On the left hand side, hover over the “APIs & Services” menu option. Then select “Credentials“. This will take you to the credentials manager for all the API keys, OAuth Client IDs, and Service accounts available for your account.
Then to register a API key, simply click the “Create Credentials” button at the top. Then select the “API Key” option.
After a few short seconds, you will get a popup with your new generic Google API key. You can copy this key into your web app or plugins now. Or come back to this Credentials page later to get your API key anytime.
Step 3. Grant YouTube API v3 access
With your generic Google API key created, you need to actually assign it access to the YouTube API v3. Version 3 being the most recent version of the YouTube API as of mid 2020.
Within the API & Services manager section of the Google Cloud Platform, you can actually register a YouTube API key. Or rather grant you API key access to the YouTube API.
On the left hand side, click on the “Library” tab. This will bring you to the whole collection of Google APIs and service you can access. Including the YouTube API, Google Maps API, and so much more,
Either browse on the API library home page or search for “YouTube” in the search box at the top. You will find the “YouTube API v3” option. Go ahead and click on it.
Then to register for YouTube API access, simply click on the “Enable” button. Once enabled, you may be redirected to the YouTube API metrics page where you can monitor the requests from your YouTube API key.
That’s it. You have successfully registered a YouTube API key!