4.19. Setting Up the YouTube API Key

This topic describes how to set the YouTube API key for your instance of Open edX.

4.19.1. Overview

If you intend for courses on your Open edX instance to include videos that are hosted on YouTube, you must get a YouTube API key and set the key in the Open edX Platform.

The Open edX Platform uses the YouTube Data API v3, which requires that the application uses an API key.

4.19.2. Get a YouTube API Key

To get the YouTube API key, follow YouTube’s instructions for obtaining authorization credentials. YouTube provides two different options for API keys: server keys or browser keys. You should use a browser key for Open edX.


Before proceeding, review Guidelines for Updating the Open edX Platform.

4.19.3. Install the YouTube API Key in Open edX

After you obtain a YouTube API key, you must install that key into your Open edX installation. There are two different ways you can do this. Option 2: JSON files

Ansible outputs information to several JSON files used by Open edX. If you prefer not to edit the Ansible configuration, you can edit these files directly.

However, every time you update Open edX, your edits will be overwritten by Ansible. As a result, we recommend setting your YouTube API key in Ansible’s configuration instead.

To set your YouTube API key by editing JSON files, complete the following steps.

  1. Find the edx-platform repository on your Open edX server. If you are running devstack or fullstack, the directory is /edx/app/edxapp/edx-platform.

  2. In the directory above your repository, there should be several JSON files, including lms.auth.json and cms.auth.json. If you are running devstack or fullstack, the directory is /edx/app/edxapp.

  3. Open the lms.auth.json file in your text editor.

  4. Find the line for the YouTube API key.


    Replace PUT_YOUR_API_KEY_HERE with your YouTube API key. Verify that the YouTube API key is between the quotation marks.

  5. Save and close the file.

  6. Open the cms.auth.json file and make the same change. If that line does not exist in this file, create it.

  7. Save and close the file.