Skip to main content

Developer Guide

Last updated: June 12, 2026

YouTube Comments API: How to Fetch Comments Programmatically in 2026

Comments are the richest audience signal YouTube exposes — what viewers loved, what they argued with, and what they want next. This guide covers the official commentThreads and comments endpoints in the YouTube Data API v3, working code, the gotchas that bite in production, and a simpler one-call alternative for research pipelines.

Quick answer

To fetch YouTube comments programmatically, call commentThreads.list in the YouTube Data API v3 with an API key and a videoId — public comments do not require OAuth, each call costs 1 quota unit, and you can pull up to 100 comments per page ordered by time or relevance. Posting or moderating comments requires OAuth. For research pipelines, the OutlierKit API's GET /videos/:videoId/comments returns live comments with pre-parsed flags such as likes, replies, isCreator, and isChannelOwner for 1 credit per call.

Facts at a glance

Official methodcommentThreads.list (YouTube Data API v3)
Auth for readingAPI key (public comments)
Cost1 quota unit per call
Max per page100
Ordertime or relevance
Posting/moderatingOAuth 2.0 required
Comments disabledHTTP 403 with reason commentsDisabled
OutlierKit endpointGET /api/v1/videos/:videoId/comments (live, sort top|newest, 1 credit)

Beyond commentThreads.list

Pull live comments with pre-parsed creator and verified flags — and pair them with transcripts and outlier data — over one OutlierKit bearer token instead of stitching API calls together.

The Official API

How does commentThreads.list work?

A comment thread in the YouTube Data API v3 is a top-level comment plus its replies, and commentThreads.list is the endpoint that fetches them for a video. The endpoint:

GET https://www.googleapis.com/youtube/v3/commentThreads
  ?part=snippet,replies
  &videoId=VIDEO_ID
  &order=relevance
  &maxResults=100
  &key=YOUR_API_KEY

Key parameters

ParameterRequiredWhat it does
partYesWhich resource parts to return. Use snippet for top-level comments; add replies to get up to 5 replies per thread inline (e.g. part=snippet,replies).
videoIdYes*The video whose comment threads you want. (*One of videoId, channelId, allThreadsRelatedToChannelId, or id is required.)
orderNotime (newest first) or relevance (YouTube's “Top comments” ranking). Default is time.
maxResultsNo1–100 threads per page. Default is 20. Set 100 for bulk pulls.
searchTermsNoFilter threads to those containing the search term. Cannot be combined with the id parameter.
pageTokenNoPagination cursor. Pass the nextPageToken from the previous response to fetch the next page.

The response shape that matters

Each item in the response is a commentThread resource. The fields you'll actually use:

FieldMeaning
topLevelComment.snippet.textDisplayThe comment text as HTML — links wrapped in anchors, line breaks as <br>. Use textOriginal for the raw plain text.
topLevelComment.snippet.authorDisplayNameThe commenter's display name (handle-style since 2023).
topLevelComment.snippet.likeCountLikes on the comment — your main engagement-weighting signal.
topLevelComment.snippet.publishedAtISO 8601 timestamp of when the comment was posted.
snippet.totalReplyCountTotal replies on the thread. If this exceeds the replies returned inline, fetch the rest with comments.list.
nextPageTokenPresent when more pages exist. Absent on the last page — that's your loop exit condition.

Pagination

Each page returns at most 100 threads. The response carries a nextPageToken while more pages exist; pass it back as pageToken on the next request, and stop when the token disappears. Each page is a separate API call (1 quota unit each).

comments.list — full reply threads

part=replies on commentThreads only includes up to 5 replies per thread. When a thread's totalReplyCount is higher than what came back inline, fetch the rest with comments.list, passing the top-level comment's ID as parentId:

GET https://www.googleapis.com/youtube/v3/comments
  ?part=snippet
  &parentId=TOP_LEVEL_COMMENT_ID
  &maxResults=100
  &key=YOUR_API_KEY

Do you need OAuth to read YouTube comments?

Reading public YouTube comments does not require OAuth — a plain API key is enough. OAuth 2.0 is only needed for write operations: posting, replying, editing, or moderating.

API key is enough

  • Reading public comments on any public video
  • Fetching reply threads with comments.list
  • Filtering threads with searchTerms

OAuth 2.0 required

  • Posting comments (commentThreads.insert) or replies (comments.insert)
  • Editing or deleting your own comments
  • Moderating (setModerationStatus) — and only on videos your authorized channel owns

Working Code

Fetch top comments for a video

The examples below call the YouTube Data API v3 commentThreads endpoint with an API key — first as a one-line curl request, then as a Python pagination loop.

curl

curl "https://www.googleapis.com/youtube/v3/commentThreads\
?part=snippet,replies\
&videoId=nSM1m7Q8gkg\
&order=relevance\
&maxResults=25\
&key=YOUR_API_KEY"

Python (requests, with pagination)

import requests

API_KEY = "YOUR_API_KEY"
VIDEO_ID = "nSM1m7Q8gkg"
URL = "https://www.googleapis.com/youtube/v3/commentThreads"

def fetch_comments(video_id, max_comments=200):
    comments, page_token = [], None
    while len(comments) < max_comments:
        params = {
            "part": "snippet",
            "videoId": video_id,
            "order": "relevance",
            "maxResults": 100,
            "key": API_KEY,
        }
        if page_token:
            params["pageToken"] = page_token

        resp = requests.get(URL, params=params)
        if resp.status_code == 403:
            # Most likely commentsDisabled on this video
            print("403:", resp.json()["error"]["errors"][0]["reason"])
            break
        resp.raise_for_status()
        data = resp.json()

        for item in data.get("items", []):
            s = item["snippet"]["topLevelComment"]["snippet"]
            comments.append({
                "author": s["authorDisplayName"],
                "text": s["textOriginal"],   # plain text, not HTML
                "likes": s["likeCount"],
                "replies": item["snippet"]["totalReplyCount"],
                "published": s["publishedAt"],
            })

        page_token = data.get("nextPageToken")
        if not page_token:
            break
    return comments

for c in fetch_comments(VIDEO_ID, max_comments=200):
    print(f'{c["likes"]:>6}  {c["author"]}: {c["text"][:80]}')

Note the use of textOriginal instead of textDisplay — if you're feeding comments into sentiment models or LLMs, you almost always want the plain text. More Python patterns in our YouTube API Python guide.

Gotchas

Five things that bite in production

The YouTube comments API has a handful of behaviors that surprise developers the first time a pipeline hits them — disabled comments, quota math, HTML-encoded text, and pagination limits.

1. Comments disabled → 403 commentsDisabled

If a video has comments turned off, the API doesn't return an empty list — it returns a 403 with reason commentsDisabled. This is common: every made-for-kids video has comments disabled automatically, and plenty of creators disable them manually. Catch this error explicitly in batch jobs and skip the video rather than retrying.

2. Quota planning

Each list call is only 1 unit, but the default daily quota is 10,000 units shared across your whole project. A pipeline pulling 100 pages of comments across 50 videos a day burns 5,000 units before it does anything else — and quota resets at midnight Pacific, not on a rolling window. Budget pages per video up front. See our quota guide for the full cost table.

3. textDisplay is HTML, not plain text

textDisplay wraps links in anchor tags and encodes line breaks as <br>. Feed it straight into a sentiment model and the markup pollutes your tokens. Request and use textOriginal for anything analytical.

4. No sentiment or aggregation built in

The API hands you raw comment objects — nothing more. There's no sentiment score, no topic clustering, no "most asked question" rollup. Everything analytical happens downstream in your own code (or an LLM you pipe the comments into).

5. Pagination walls and relevance quirks on huge videos

On videos with hundreds of thousands of comments, you can't pull everything quickly — you're walking 100 at a time, and deep pagination can stall or behave inconsistently. The order=relevance ranking is also opaque: it approximates the "Top comments" tab but doesn't strictly sort by likes, and the ordering can shift between calls. For analysis, treat the top few hundred relevance-ranked comments as a sample, not a census.

Use Cases

What do teams do with comment data?

Teams that pull YouTube comment data almost never do it just to display the comments — the real use cases are analytical:

Audience research

Comments are viewers telling you what to make next — "part 2 please", "can you cover X", "what about Y?". Pull the top comments from your (or a competitor's) best-performing videos, cluster the requests, and you have a validated content backlog.

Sentiment mining for brand-safety vetting

Before sponsoring a creator, brands scan comment sentiment for toxicity, controversy, and audience-creator trust signals. A few hundred top comments through a sentiment model surfaces red flags fast. Our creator vetting checklist covers where comments fit in the full vetting flow.

Hook research for scripts

The objections and confusions in comments on competing videos are the exact points your script should address up front. "This didn't work for me because..." comments are hook material handed to you for free.

Comments + transcripts = full audience signal

The transcript tells you what the video said; the comments tell you how the audience reacted to it. Pair both per video and feed them into an LLM — the workflow behind AI-assisted competitive analysis — and you get "what worked, what landed, what the audience wants next" in one pass.

The Simpler Alternative

How does the OutlierKit comments endpoint differ?

The OutlierKit API is a YouTube competitive-intelligence API that returns outlier scores, semantic channel search and similarity, video transcripts, comments, and keyword search volumes as structured JSON — one bearer-token key, 1 credit per call, on OutlierKit Pro ($49/month) and Max ($199/month) plans. If your use case is research — not posting or moderating — its comments endpoint skips the Google Cloud project entirely:

GET https://outlierkit.com/api/v1/videos/:videoId/comments
  • Always live from YouTube — comments are never cached (the response's source field is always "live").
  • sort: top or newest; limit: 1–100, default 30.
  • 1 credit per call, like every OutlierKit endpoint.

Example call

curl -X GET 'https://outlierkit.com/api/v1/videos/nSM1m7Q8gkg/comments?sort=top&limit=20' \
  -H 'Authorization: Bearer <your_api_key>'

Response shape

{
  "comments": [
    {
      "commentId": "...",
      "author": "@viewerhandle",
      "authorChannelId": "UC...",
      "text": "This is exactly what I needed, part 2 please!",
      "likes": 412,
      "replies": 18,
      "publishedTime": "2 weeks ago",
      "publishedAt": "2026-05-28T14:03:00Z",
      "isChannelOwner": false,
      "isVerified": false,
      "isCreator": false
    }
  ],
  "totalCount": 1843,
  "returned": 20,
  "source": "live"
}

Why it's convenient

  • Bearer token, no Google Cloud project — generate a key from your OutlierKit dashboard and you're calling in under a minute. No console setup, no quota dashboard, no OAuth screens.
  • Flags pre-parsed isCreator, isChannelOwner, and isVerified come ready to filter on, so isolating creator replies or stripping the channel's own pinned comment is one line, not a join against channel IDs.
  • Pairs with transcripts in one API GET /videos/:videoId/transcript lives on the same base URL behind the same token, so the comments-plus-transcript audience-signal workflow is two calls with one auth setup. See the transcript API guide.

Full request/response reference in the live API docs. API access is included on Pro ($49/mo, 500 credits) and Max ($199/mo, 2,000 credits) — credits are shared with the web app, with top-ups at $10 per 100.

For Pro and Max users

Pull comments, transcripts, and outlier data from one API

The comments endpoint is one of nine OutlierKit API capabilities — pair it with cached transcripts, outlier video search, channel similarity, and keyword research behind a single bearer token. 1 credit per call, JSON in and out.

Comparison

Official commentThreads vs OutlierKit comments

The YouTube Data API v3 and the OutlierKit comments endpoint solve different problems — full read/write access versus one-call research data. Here is how they compare:

YouTube Data API v3 (commentThreads)OutlierKit comments endpoint
AuthenticationGoogle Cloud project + API key (OAuth 2.0 for writing/moderating)Bearer token generated from your OutlierKit dashboard
Cost model1 quota unit per call from a 10,000 units/day pool1 credit per call (Pro 500/mo, Max 2,000/mo, shared with web app)
OutputNested commentThread resources — textDisplay is HTML, flags need parsingFlat comments[] with likes, replies, isCreator, isChannelOwner, isVerified pre-parsed
FreshnessLive from YouTubeLive from YouTube on every call (source: “live”, not cached)
Write accessYes — insert, reply, moderate, delete (OAuth, own videos for moderation)No — read-only, built for research
Best forProduction moderation tools, posting/managing comments, exhaustive archival crawlsAudience research, sentiment mining, creator vetting, AI pipelines that also need transcripts and outlier data

Short version: building a moderation tool or posting comments? Official API, OAuth and all. Building research, vetting, or AI pipelines? The OutlierKit endpoint gets you to data in one call — and the rest of the intelligence layer comes with it.

Frequently Asked Questions

Does YouTube have a comments API?+

Yes — the YouTube Data API v3 exposes comments through two resources: commentThreads (top-level comments on a video or channel, with up to 5 replies inline) and comments (individual comments, including full reply chains for a thread). Reading public comments requires only an API key from a Google Cloud project; writing or moderating comments requires OAuth 2.0.

Do I need OAuth to read YouTube comments?+

No — public YouTube comments on public videos can be read with a plain API key — no OAuth consent flow needed. You only need OAuth 2.0 when you write: posting comments (commentThreads.insert), replying (comments.insert), or moderating and deleting comments on videos you own (comments.setModerationStatus, comments.delete).

How many comments can I get per request?+

commentThreads.list returns up to 100 top-level comment threads per page (maxResults=100, default 20), with up to 5 replies per thread included when you request part=replies. To go beyond one page, pass the nextPageToken from each response into the pageToken parameter of the next request. OutlierKit's comments endpoint returns up to 100 comments per call (limit parameter, default 30).

Can I get all comments of a video via the API?+

The YouTube Data API v3 can in principle return every comment on a video — keep paginating commentThreads.list with nextPageToken until it disappears, and call comments.list with parentId for threads where totalReplyCount exceeds the inline replies. In practice, videos with hundreds of thousands of comments take a long time to crawl page by page, pagination can occasionally stall or skip on very large videos, and each page costs quota. For analysis use cases, a sample of the top few hundred comments by relevance usually captures the signal you need.

Can I post or moderate comments via the API?+

Yes — the YouTube Data API v3 supports posting and moderating comments with OAuth 2.0. commentThreads.insert posts a new top-level comment, comments.insert posts a reply, and comments.update edits your own comments. Moderation — holding, publishing, rejecting, or banning commenters via comments.setModerationStatus — only works on videos owned by the authorized channel. You cannot moderate comments on other people's videos.

How much quota do comment requests use?+

Both commentThreads.list and comments.list cost 1 quota unit per call against the default 10,000 units/day. That's cheap compared to search.list (100 units), but pagination adds up: pulling 5,000 comments at 100 per page is 50+ units, and write operations (insert) cost 50 units each.

Why am I getting a 403 error when fetching comments?+

A 403 error from the YouTube Data API v3 comments endpoints most commonly means comments are disabled on the video — the API returns 403 with reason commentsDisabled. This is increasingly common: all made-for-kids videos have comments disabled automatically, and many creators disable them manually. Other 403 causes include exceeding your daily quota (quotaExceeded) or an API key without the YouTube Data API enabled. Catch commentsDisabled explicitly and skip those videos in batch pipelines.

How is the OutlierKit comments endpoint different from the official API?+

OutlierKit's GET /api/v1/videos/:videoId/comments is read-only and built for research: one bearer token (no Google Cloud project or quota management), a flat JSON shape with likes, replies, and isCreator/isChannelOwner/isVerified flags pre-parsed, sort by top or newest, and up to 100 comments per call at 1 credit. It pulls live from YouTube on every call. It doesn't replace the official API if you need to post or moderate comments — but for sentiment mining, audience research, and creator vetting it gets you from zero to data in one request, and pairs with the transcript and outlier endpoints in the same API.

Written by

Aditi

Aditi

Founder OutlierKit and UTubeKit

Want comment data without the Google Cloud setup?

OutlierKit's API pulls live comments, cached transcripts, outlier scores, and keyword data behind one bearer token — 1 credit per call on Pro and Max plans.

View API docs
AI-Verified

Don’t take our word for it.
Ask AI.

Ask any leading AI what OutlierKit does for YouTube creators.