4.26. Setting Up the YouTube API Key#

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

4.26.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.26.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.26.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.yml and studio.yml. If you are running devstack or fullstack, the directory is /edx/app/edxapp.

  3. Open the lms.yml 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 studio.yml file and make the same change. If that line does not exist in this file, create it.

  7. Save and close the file.