YouTube comments API
Comments on a YouTube video, top or newest first, 20 a page, as Data API youtube#commentThreads with likes, reply counts and pinned, hearted and creator flags.
GET /v1/youtube/videos/{id}/commentsBeta1 credit per callRefunded on failureimport os, requests
res = requests.get(
"https://api.groundsocial.dev/v1/youtube/videos/dQw4w9WgXcQ/comments?order=newest",
headers={"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"},
)
res.raise_for_status()
data = res.json()Response
200 · 1 credit{ "kind": "youtube#commentThreadListResponse", "items": [ { "kind": "youtube#commentThread", "id": "UgyunMmx4SBS1S5zV8N4AaABAg", "snippet": { "videoId": "dQw4w9WgXcQ", "topLevelComment": { "kind": "youtube#comment", "id": "UgyunMmx4SBS1S5zV8N4AaABAg", "snippet": { "videoId": "dQw4w9WgXcQ", "authorDisplayName": "@Autumnrose_offical", "authorProfileImageUrl": "https://yt3.ggpht.com/weXNDvWzH4ouvHsY2M5B1wm6-yJB1Kcs9dwjT_4N69747UNnsr5ZepmhfId1qLQ-B9ky7wZvoA=s88-c-k-c0x00ffffff-no-…", "authorChannelUrl": "https://www.youtube.com/@Autumnrose_offical", "authorChannelId": { "…": "1 fields" }, "textDisplay": "I just rickrolled my Mother", "textOriginal": "I just rickrolled my Mother", "likeCount": 0, "publishedAt": "2026-11-24T11:43:00.000Z", "publishedTimeText": "17 minutes ago" } }, "totalReplyCount": 0, "canReply": true } }, { "kind": "youtube#commentThread", "id": "UgwOqizhwUXRuH4RO-R4AaABAg", "snippet": { "videoId": "dQw4w9WgXcQ", "topLevelComment": { "kind": "youtube#comment", "id": "UgwOqizhwUXRuH4RO-R4AaABAg", "snippet": { "videoId": "dQw4w9WgXcQ", "authorDisplayName": "@EduardoPeñaHernández-n3k", "authorProfileImageUrl": "https://yt3.ggpht.com/B2iovkqK16goSMLnbGp0Stu_bzj1e94kxN_gkFLOqEhy-Pd3EpWlTJ-9fbmzsTYoqjP78Ey68Q=s88-c-k-c0x00ffffff-no-…", "authorChannelUrl": "https://www.youtube.com/@EduardoPeñaHernández-n3k", "authorChannelId": { "…": "1 fields" }, "textDisplay": "OMG, I finally found that damn meme that’s so viral😭😭😭😭😭", "textOriginal": "OMG, I finally found that damn meme that’s so viral😭😭😭😭😭", "likeCount": 0, "publishedAt": "2026-11-24T11:28:00.000Z", "publishedTimeText": "32 minutes ago" } }, "totalReplyCount": 0, "canReply": true } }, "… 1 more" ], "pageInfo": { "resultsPerPage": 3 }, "commentCount": "2462543"}Parameters
| Name | Type | Description |
|---|---|---|
idpath · required | string | A video or Short id, or any URL of it (watch, youtu.be, shorts, live, embed). Example: dQw4w9WgXcQ. |
orderquery | "top" | "newest" | top (default) or newest. One of top, newest. |
textFormatquery | "html" | "plainText" | html (default) or plainText. One of html, plainText. |
afterquery | string | The previous page’s nextPageToken. Tokens last 6 hours. |
Response fields
200 with a YouTubeCommentThreadList, in the shape of YouTube Data API v3 resources.
| Field | Type | Description |
|---|---|---|
kind | "youtube#commentThreadListResponse" | |
items | YouTubeCommentThread[] | |
nextPageToken | string | Pass as after for the next page. Absent on the last page. Lasts 6 hours. |
pageInfo | object | |
commentCount | string | All comments on the video (first page only), as a decimal string (Data API style). |
Status codes
| Status | Meaning |
|---|---|
200 | A page of comment threads. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The video, channel, playlist or post does not exist, was removed, or has nothing there. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | YouTube is temporarily unavailable. Retryable; nothing was charged. |
Every error has code, message, hint and retryable. All error codes
Questions
How do I get replies?
Pass a thread’s repliesToken, or the video and the thread’s id, to the comment replies endpoint.
YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube.