Code Samples

Stay organized with collections Save and categorize content based on your preferences.

The following lists identify code samples available for the YouTube Analytics API and YouTube Reporting API. You can also download these samples from the youtube/api-samples GitHub repository.

Java

Bulk data reports (YouTube Reporting API)

  1. Create a reporting job (reportTypes.list, jobs.create)
  2. Retrieve reports (jobs.list, jobs.reports.list)

JavaScript

Query reports (YouTube Analytics API)

  1. Retrieve daily channel statistics (reports.query)

PHP

Bulk data reports (YouTube Reporting API)

  1. Create a reporting job (reportTypes.list, jobs.create)
  2. Retrieve reports (jobs.list, jobs.reports.list)

Python

Bulk data reports (YouTube Reporting API)

  1. Create a reporting job (reportTypes.list, jobs.create)
  2. Retrieve reports (jobs.list, jobs.reports.list)

Query reports (YouTube Analytics API)

  1. Retrieve daily channel statistics (reports.query)