YouTube Data API (v3) Code Samples

  • Explore the use cases and code samples page to find examples for the YouTube Data API and YouTube Live Streaming API.

  • The use cases and code samples page provides interactive samples in Java, JavaScript, PHP, and Python, allowing you to adjust parameters and see updated code.

  • Standalone code snippets are available for Apps Script, Go, .NET, and Ruby, demonstrating common methods like uploading videos, searching for videos, and managing playlists.

  • The page provides code samples for several common methods including subscriptions.insert, channels.list, search.list, and videos.update, allowing developers to find quick snippets for their use cases.

  • Code samples are provided for various common tasks such as authorization, uploading, and searching for videos, as well as creating playlists and subscriptions.

You can explore common use cases for the YouTube Data API and YouTube Live Streaming API on the use cases and code samples page.

The page lets you select an API resource and method and then lists common use cases for that method. You can then click on any use case to populate the APIs Explorer widget with sample parameter and property values for that use case. You can also open the fullscreen APIs Explorer widget to see working code samples for Java, JavaScript, PHP, and Python. If you update parameter or property values in the APIs Explorer, the code samples also update to reflect your changes.

The following section lists code samples available in other languages.

Standalone code snippets

The lists below identify code samples available for the YouTube Data API (v3) in languages other than Java, JavaScript, PHP, and Python. As noted in the previous section, code samples for those languages are available on the use cases and code samples page.