# API Youtube

To set up the YouTube API, follow the steps one by one.<br>

#### 1. Create a Google Cloud Project

1. Go to the [Google Cloud Console](https://console.cloud.google.com/)
2. Sign in with your Google account
3. At the top, click on **"Select a project"**
4. Click on **"NEW PROJECT"**
5. Give your project a name (e.g., "CarPlay FiveM")
6. Click **"Create"**
7. Wait a few seconds for the project to be created
8. Select your new project from the dropdown at the top

#### 2. Enable YouTube Data API v3

**IMPORTANT:** If you cannot find "YouTube Data API v3", follow these steps:

**Option A: Through the API Library**

1. In the left menu (☰), click **"APIs & Services"**
2. Click **"Library"**
3. In the search bar, type: `YouTube Data API v3`
4. Click the result **"YouTube Data API v3"**
5. Click the blue **"ENABLE"** button
6. Wait a few seconds for the API to be activated<br>

**Option B: Using the Search Bar**

1. Go to <https://console.cloud.google.com>
2. In the top search bar (🔍), type: `YouTube Data API v3`
3. Select **"YouTube Data API v3"** from the results
4. Click **"ENABLE"**

#### 3. Create an API Key

1. In the left menu, go to **"APIs & Services" > "Credentials"**
2. Click **"+ CREATE CREDENTIALS"** at the top
3. Select **"API Key"**
4. Your API key will be generated
5. (Recommended) Click **"RESTRICT KEY"** to secure it
6. Under **"API Restrictions"**, select **"YouTube Data API v3"**
7. Click **"Save"**

#### 4. Configure the API Key in FiveM

1. Open your `server.cfg` file
2. Add the following line with your API key:

```cfg
setr youtube_api_key "YOUR_API_KEY_HERE"
```
