Guide on how to use YouTube API to get or retrieve comments

Discover how to harness the YouTube API for fetching and extracting video comments. This guide provides step-by-step tips for efficient data retrieval.

Table of Content

The Comments section of your YouTube video is the prime real estate for interacting with your target audience. Knowing what your viewers say about your brand can help you create content tailored to their preferences. Not to mention, creators who respond to the comments on their videos can quickly expand their reach and become cult audience favorites, which, in turn, can help them gain brand partnerships as popular influencers.

With a user base of more than 2.7 billion unique monthly active viewers (as of 2023), leveraging YouTube can be very beneficial for creators and businesses. While it can be a place for negativity, the Comments section can be an excellent opportunity for influencers and brands to generate community engagement. Moreover, engaging with comments also comes with the additional benefit of boosting the video in the YouTube algorithm. 

YouTube comments
Image source

In short, comments can be a great indicator of how engaged a creator’s audience is—which can help inform important decision-making when it comes to brands collaborating with the right influencers. Thus, if collecting YouTube comments is part of your influencer marketing strategy in 2024, extracting YouTube comments from a creator’s profile can also be super important for you. In light of this, we want to introduce you to the YouTube API’s capability to fetch video comments.

In this blog, we will enlighten you about how you can extract YouTube comments from YouTube API to scrape comment replies from a specific YouTube video, the challenges and best practices to fetch comments from the YouTube Comments API, and how the YouTube API from Phyllo can simplify fetching comments from YouTube videos.

But first, let’s understand which YouTube API methods you can use for accessing comments.

Related Read: How to Get YouTube API Key

Specific YouTube API Methods for Accessing Comments

To get comments from a particular YouTube video, you must use the YouTube Data API (v3). We will focus on two use cases below: extracting comments from a specific YouTube video and fetching comments associated with a specific page or channel.

Extracting Comments from a YouTube Video

You can use the commentThreads.list method to get a list of all the comment threads for a particular video. In your request, you must enter the values for the following parameters:

  • Part: If you simply want to retrieve top-level comments, set the parameter value to snippet; if you also want to retrieve answers to top-level comments, set the parameter value to snippet, replies. (Note that you must use the comments; a commentThread resource may not always include every response to a comment. If you wish to get every response for a specific comment, use the comments.list method.)
  • videoId: You can simply enter the ID of the YouTube video you are trying to get comments for to retrieve comments.

Extracting Comments from a YouTube Channel

The YouTube Comments API response also facilitates the retrieval of comment threads related to a channel or the retrieval of all comment threads linked to a channel. In the second scenario, comments regarding the channel or any of the channel's videos may be included in the API response.

You must use the same process outlined above to get comments about a channel. However, to identify the video ID and channel, set the channelId option instead of the videoId parameter.

You can also refer to the guidelines for retrieving comments for a video to retrieve comments related to a channel.

To identify the channel, however, set the parameter to allThreadsRelatedToChannelId instead of the videoId option.

Getting Started with YouTube API for Comments

The YouTube Comments API is an extension of the YouTube Data API, which lets you incorporate functions normally conducted on the YouTube platform into your own website or third-party application. For instance, you can use the YouTube API to upload a video, access analytics data, moderate categories of videos, find out which languages and regions support the YouTube website, and much more.

One of the resources provided by this API is the comment resource. This resource provides information about a single YouTube comment. A comment resource can be used to call a comment regarding a channel or a video. The comment may also be a top-level comment or a response to another top-level statement.

To successfully call an API request, you need to fulfill the following requirements:

  • Include an OAuth 2.0 token or include an API key (with the key parameter) for each request. You can find the API key specific to your project in the API Access window for your project in the Developer Console. To generate an API key, follow these steps outlining how to get your YouTube API key.
  • Supply an authorization token each time you make any request that retrieves personal information from an authenticated user. Furthermore, certain resource retrieval API methods might allow authorization-required parameters or, if a request is approved, it might provide extra metadata.
  • Provide an OAuth 2.0 token since the API supports the OAuth 2.0 authentication protocol in the following ways:

    - Use the access_token query parameter like this: ?access_token=oauth2-token
    - Use the HTTP Authorization header like this: Authorization: Bearer oauth2-token

Once you complete these steps, you can retrieve comments using the YouTube API through the list method.

Here is the HTTP request


This returns a list of comments that match the API request’s parameters. 

Here are the supported parameters for this API request:

Required Parameters:

  • part
    Type: String
    Explanation: The "part" parameter requires a comma-separated list, determining one or more comment resource properties included in the API response code. The available part names for the parameter value are "id" and "snippet."


  • id
    Type: String
    Explanation: The "id" parameter takes a comma-separated list of comment IDs for the resources being retrieved. In a comment resource, the "id" property specifies the comment's unique ID.
  • parentid
    Type: String
    Explanation: The "parentid" parameter designates the ID of the comment for which replies should be retrieved.

Note: Only top-level comment replies are currently supported by YouTube. 

For properties and errors related to the Comments API, check the documentation

Read Also: What Is Youtube Analytics API? How it Delivers Insights

YouTube Comments API Limitations and Best Practices

Here are some of the limitations associated with the YouTube Comments API:

  • Quotas: There are quotas on how many requests you can make using any YouTube API. These YouTube API limits are subject to change based on things like the kind of request you are making, the kind of API key you are using, and whether you are using a free or premium developer account. The limits are placed to ensure fair usage and prevent misuse of the API.
  • API Key: To use any YouTube API, you need to establish a project in the Google Cloud Console and get an API key. This key typically has varying usage limitations depending on the kind of key you have (server key, browser key, etc.).
  • Authentication: Certain YouTube API requests may call for OAuth 2.0 authentication. This may impact your usage limits and ability to use particular features.
  • Paging: Retrieving results when working with huge datasets, such as comments on popular videos, can be challenging and push you to use multiple page tokens to paginate through the results. Learn more on How To Use YouTube API To Upload Videos

To overcome these challenges, here are some best practices associated with the YouTube Comments API:

  • Employ Authentication with API Keys: You must activate OAuth 2.0 by generating an API key and using it whenever you need to make an API request. This key is linked to your project and helps identify and approve your requests by YouTube.
  • Manage Limits and Quotas: Understanding the usage quotas and limitations related to your account type and API key is essential. You should monitor how your application is used to ensure you don't exceed any quotas. If you do, you must have error handling for such situations.
  • Enhance Your Queries: You should specify your field parameters correctly only to request the required data. This can speed up reaction times and decrease the volume of data delivered. You should employ parameters and filters to focus search terms and obtain targeted data.
  • Implement Rate Limiting and Caching: You should store and reuse responses using caching methods when appropriate. This can enhance your application's performance by lowering the quantity of requests. You should also observe the rate restrictions set by the API to prevent blocking or throttleing.
  • Comply with YouTube’s Policies: You should ensure that your application abides by YouTube's standards, community guidelines, and terms of service. When accessing or presenting user-generated content, you also need to be mindful of the privacy and permissions of the user.
  • Use Page Tokens for Pagination: When working with large datasets or through a sizable results page, you must paginate through the results using the page tokens that the API provides. This guarantees that all of the data may be retrieved in one big request.

How Does the Phyllo YouTube API Help Overcome Challenges and Limitations?

While the YouTube APIs, including the Comments API, can help creators and businesses with exceptional capabilities, accessing accurate analytics data in real-time can still be difficult. 

This is where the universal API from Phyllo can be a better alternative.  

Phyllo offers a powerful third-party data aggregator API that can directly source account data from the YouTube platform. A few examples of account data parameters include a creator's profile views, audience demographics, content feeds, and content impressions. 

The Phyllo Comments API was launched to help developers learn details about the commenters and their comments on a content thread. This data can help you find out the general audience sentiment about the creator and who their top viewers are (the majority of platforms do not automatically disclose this information). 

Phyllo comments API
Image source

The Comments API from Phyllo is an extension of its Engagement API, and developers can use it to fetch comment text, its status of publication, the commenter's username, and engagement metrics like the number of likes and responses, among many other things. Other use cases powered by Phyllo’s Comments API include:

  • Creator Communities: Creators may invite their top viewers to exclusive communities based on comments and other social media interactions
  • Influencer Marketing Platforms: Brands may find creators with an engaged audience and greater audience impact by studying the comments under their videos
  • Membership Platforms: Creators can choose to provide special subscriptions to their most engaged commenters
  • Media Kits: Brands can get a detailed overview of the most engaged commenters and the content in the comments 
  • Creator Marketplaces: Creators can invite their top viewers to exclusive workshops and provide them access to special content based on comments and other interactions

Phyllo creator catalogue
Image source

The API integration from Phyllo also resolves the problems with YouTube’s quota limits and permission management (through its Connect SDK function). Moreover, it offers increased data refresh frequencies, in addition to the Webhooks function that informs developers every time there is an update to creator data, enabling users access to accurate and real-time data whenever they need.  

Final Thoughts 

YouTube is one of the most widely used social media platforms worldwide, with a growing number of creators and businesses serving its user base on a daily basis. This is inevitably leading to more influencer-brand partnerships and sponsored YouTube videos.

Consequently, more developers are increasingly rising to the challenge of finding better ways to access high-quality creator data. 

As illustrated above, comments can provide valuable insights into how engaged a creator’s audience truly is and enable brands to make the right decisions when it comes to influencer partnerships— and the YouTube API integration from Phyllo is the perfect tool to help you fetch comments from a specific YouTube video or channel. If you want to extract accurate creator data from the YouTube platform in real-time, Phyllo’s experts can guide developers in understanding and adjusting to API changes without compromising data quality.

Book a free call to extract comments and make informed decisions about creator partnerships with Phyllo today!    


  1. What are the Common Issues in Collecting YouTube Comments?

Here are five common issues you may face in collecting YouTube comments with the YouTube API:

  • Authentication errors (in case of an invalid API key or OAuth 2.0 credentials)
  • Usage quota or rate limits
  • Invalid parameters in API requests
  • Pagination errors (in case page tokens returned by the API to paginate through results are incorrect)
  • Insufficient permissions (in case your third-party applications do not have the required permissions via your access token)
  1. How to Debug API Requests for Comment Access?

To debug requests made to the YouTube Comments API, you must first confirm that authentication is correct and then review the parameters in the API documentation. You can also examine the request format, look over error responses, validate parameters, and verify pagination. 

Once you are done, you can begin testing using smaller datasets and make sure the network is connected. Following these steps can help you locate, debug, and resolve your API request issues, which, in turn, will allow you access to the comments you want to retrieve seamlessly.

Common Challenges with TikTok API and How to Overcome Them

Download Now
Charu Mitra Dubey
Content Marketing Manager at Phyllo

Be the first to get insights and updates from Phyllo. Subscribe to our blog.

Ready to get started?

Sign up to get API keys or request us for a demo