YouTube

API Overview Guide

The YouTube APIs and Tools let you bring the YouTube experience to your webpage, application, or device. The Data API lets you perform most of the operations a normal YouTube user can on the YouTube website. The Player APIs let you control the YouTube player using JavaScript or ActionScript. You can also use the basic embedded player, which already contains player controls, or the chromeless player, which lets you create your own player controls.

First, you should decide which of our APIs and tools best suits your needs. Start with the embedded player if you want to add a player to your website to show individual videos or a playlist. If you're comfortable with JavaScript or Flash, you may want to use the Player APIs to customize a chromeless player. If you are programming a device or server-side logic for a website, look at the Data API. The table below attempts to describe the experience level of a developer for each option:

Basic Player APIs with embedded player
Medium Player APIs with chromeless player
Advanced Data API and Player APIs with chromeless player

Players and Player APIs

YouTube players can be embedded in a web page or app using either an <iframe> tag or an <object> tag. YouTube supports two kinds of players:

  • An embedded player is a standard YouTube player that can be added to an app using embed code that you can generate or copy from a video's watch page on YouTube. Embedded players have standard controls, like a play/pause button, volume control, and video progress bar.

    You can customize the playback experience for an embedded player by appending parameters to the player's embed URL. For example, you can use the autoplay parameter to automatically play videos or the loop parameter to cause a video to play repeatedly.

  • A chromeless player is a YouTube player that has no player controls. (Interface elements and controls around content, such as the buttons at the top of a browser window, are referred to as "chrome.") A chromeless player can be customized within a Flash or HTML app.

Note: To allow room for critical player functionality, players must be at least 200px by 200px.

After selecting a player, you can use one of the YouTube Player APIs to control the player using either JavaScript or ActionScript. So, you can develop your own player controls or create other functions that respond to specific player events, and use a Player API to operate the controls or notify your application of those events.

  • The IFrame Player API lets you use JavaScript to control a player embedded in an <iframe> in your app. This API is only compatible with embedded <iframe> APIs.

  • The Flash (AS3) Player API lets you use ActionScript to control an embedded or chromeless player in a Flash application.

  • The JavaScript Player API lets you use JavaScript to control an embedded or chromeless Flash player in your app.

The player demo lets you preview the embedded and chromeless players using JavaScript and some simple HTML controls. You can also use the Google Code Playground to debug and run JavaScript player code.

Data API

The Data API allows a program to perform many of the operations available on the YouTube website. It is possible to search for videos, retrieve standard feeds, and see related content. A program can also authenticate as a user to upload videos, modify user playlists, and more.

The Data API is useful for sites or applications that want to have a deep integration with YouTube, such as an app that captures video and lets users upload that video directly to YouTube. The Data API gives you programmatic access to YouTube video and user information, enabling you to personalize your application with users' existing information and to perform actions, like rating or commenting on videos, on their behalf.

YouTube currently supports the following Data API versions:

  • API Version 3.0 provides rich client library support and is integrated with Google's common API infrastructure. It offers core functionality not available in older API versions, including Freebase integration via topics and universal search, which lets you send a single request to search for channels, playlists, and videos.

    • The Getting Started guide explains basic concepts of YouTube and of the API itself.
    • The API's guides and tutorials explain how to perform some of the API's core functions, such as implementing OAuth 2.0 authentication or uploading a video. Guides may also describe new and exciting API features, such as how to search with Freebase topics.
    • The reference guide explains how to use the API to perform all of the different supported operations.

  • API versions 2.0 and 2.1 are based on the Google Data Protocol and Atom Publishing Protocol standards. They provide a more comprehensive set of functionality than version 3.0, though the gap is narrowing quickly.

    • The Developer's Guide explains how the Data API works at the basic level using XML and HTTP. It details the requests and responses that the YouTube API servers expect and return.
    • The Reference Guide provides more detail about the structure of these requests and responses. It defines the API's feed types, HTTP request parameters, HTTP response codes, and XML elements.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.