This guide explains how to create a [YouTube Data API v3] key for your application. The API key allows your application to communicate with the YouTube Data API and retrieve information such as channels, playlists, videos, statistics, and more.
[Step 1 – Sign in to Google Cloud]
Open the Google Cloud Console:
https://console.cloud.google.com/«
If this is your first visit, you will be presented with the [Google Cloud Terms of Service].
  1. Read the agreement.
  2. Select your country or region.
  3. Click Agree and Continue.
If you have previously used Google Cloud, you may already have one or more projects. The currently selected project is displayed at the top of the page, next to the [Google Cloud] logo.
[Step 2 – Create a New Project (New Users)]
If you do not already have a project:
  1. Click [Create Project].
  2. Enter a descriptive project name.
  3. Click [Create].
Wait for Google Cloud to finish creating the project before continuing.
[Step 3 – Enable the YouTube Data API]
Once your project has been created:
  1. Click [Enable APIs and Services].
  2. Scroll down to the [YouTube] section.
  3. Select [YouTube Data API v3].
  4. Click [Enable].
After a few moments, you will be redirected to the YouTube Data API v3 overview page.
[Step 4 – Create an API Key]
  1. Click [Create Credentials].
  2. Select [Public Data].
  3. Click [Next].
Google will generate a new API key.
[Step 5 – Restrict the API Key (Recommended)]
For production applications, you should always restrict your API key.
An unrestricted API key can be used by anyone who obtains it, allowing them to consume your daily API quota.
[To secure your key:]
  1. Click [Restrict Key].
  2. Enter a friendly name for the key.
  3. Under [API Restrictions], select [YouTube Data API v3].
  4. Under [Application Restrictions], choose the restriction method that best fits your application.
[Example:]
  • IP Address (recommended for applications running from a server with a static IP address)
  • HTTP Referrers (for browser-based applications)
  • Other restriction types, depending on your application's requirements
  • If you choose [IP Address], enter the server's public static IP address.
    Click [Save] when finished.
Important Note

After saving the API key restrictions, Google Cloud currently returns you to the [Create Credentials] page instead of displaying a confirmation page.
This can make it appear as though the key was not created.
The key has normally been created successfully.
[To verify:]
  1. Open [Credentials] from the left navigation menu.
  2. Your newly created API key should appear in the list.
  3. Click [Show Key] to display the key.
  4. Copy the API key and store it securely for use in your application.


[Security Recommendations]
Closing Comments

Your YouTube Data API v3 key is now ready to use. You can use it to retrieve information about channels, playlists, videos, video statistics, comments, and other public YouTube data supported by the YouTube Data API.