YouTube comments
One page (~20 threads) of a video's comments.
https://api.scrapercompany.com/v1/youtube/commentsEach comment carries its id, text, the relative published_time verbatim (with "(edited)"), the author (name, channel id, handle, avatar, verified), likes and reply_count as exact integers when YouTube prints them exactly ("14K" stays in likes_text only), is_pinned with YouTube's pinned_text, is_hearted (creator heart) and author_is_creator. replies_page_token reads a thread's replies through this same route. total_comments_text is the header's count. Comments turned off answer comments_disabled: true with YouTube's message and no comments (not charged).
Request
Send POST https://api.scrapercompany.com/v1/youtube/comments authenticated with your API key in the x-api-key header (see Authentication).
Run this request on your own API key from this page, with the values you type. Signed out? Sign in or get an API key.
Body
JSON object. Unknown fields are rejected with 422.
- video_id string | null min length 11, max length 300
The 11-character video id (
8jPQjjsBbIc) or any YouTube video URL:watch?v=,youtu.be/,/shorts/,/embed/,/live/. Ids come fromPOST /v1/youtube/search(videos[].video_id). Required unlesspage_tokenis given. - sort string default
topYouTube's Sort-by menu:
top(YouTube's featured order) ornewest(one extra upstream call on the first page). Apage_tokenkeeps the sort it was issued with.One of
newesttop - page_token string | null max length 4000
next_page_tokenfrom a previous answer, or a comment'sreplies_page_tokento read its replies. It carries the video and the sort. - hl string default
enpattern ^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{2,4})?$Interface language YouTube localizes texts in (
hl): relative dates, view-count wording, caption track names. Counts parse to integers only for English-style numbers. - gl string default
USpattern ^[A-Za-z]{2}$Content country (
gl), two letters.
Example request
curl -X POST "https://api.scrapercompany.com/v1/youtube/comments" \
-H "x-api-key: $SCRAPERCOMPANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'Response
200 — One page of comments with YouTube's labels. Metered responses carry x-credits-charged and x-credits-remaining headers (see credit headers).
{
"search_parameters": {
"engine": "youtube_comments",
"video_id": "ix9cRaBkVe0",
"sort": "top",
"hl": "en",
"gl": "US"
},
"comments": [
{
"comment_id": "UgytxzyUgymSYxND1FZ4AaABAg",
"text": "Learn Python in 1 HOUR ⏱(2024): https://www.youtube.com/watch?v=8KCuHHeC_M0",
"published_time": "2 years ago (edited)",
"author": {
"name": "@BroCodez",
"channel_id": "UC4SVo0Ue36XCfOyb5Lh1viQ",
"handle": "@BroCodez",
"link": "https://www.youtube.com/@BroCodez",
"avatar": "https://yt3.ggpht.com/ytc/AIdro_mPFVsxROj1dOtTWc9iNBwDYV4z42Q8LPokBSewiW9pCSg=s88-c-k-c0x00ffffff-no-rj",
"is_verified": true,
"is_artist": false
},
"likes_text": "2.6K",
"reply_count": 150,
"reply_count_text": "150",
"reply_level": 0,
"is_pinned": true,
"pinned_text": "Pinned by @BroCodez",
"is_hearted": false,
"author_is_creator": true,
"replies_page_token": "Eg0SC2l4OWNSYUJrVmUwGAYygwEaUBIaVWd5dHh6eVVn…"
},
{
"comment_id": "UgyASNv3DYG4444sMM54AaABAg",
"text": "8th sep 2026 anytime anyone likes it reminds me of the day i started",
"published_time": "4 weeks ago",
"author": {
"name": "@NosashiExplain",
"channel_id": "UCJ7JasOncmoE4lTqJ0pzVJA",
"handle": "@NosashiExplain",
"link": "https://www.youtube.com/@NosashiExplain",
"avatar": "https://yt3.ggpht.com/1Rtltipv3LkA7YbKgfonS3NDSFNsKKK3iQykkCn3ZH7Q3W-qacqBqoiVU9SwpTepvGhuNICXDPc=s88-c-k-c0x00ffffff-no-rj",
"is_verified": false,
"is_artist": false
},
"likes": 907,
"likes_text": "907",
"reply_count": 18,
"reply_count_text": "18",
"reply_level": 0,
"is_pinned": false,
"is_hearted": false,
"author_is_creator": false,
"replies_page_token": "Eg0SC2l4OWNSYUJrVmUwGAYygwEaUBIaVWd5QVNOdjNE…"
}
],
"total_comments": 22676,
"total_comments_text": "22,676 Comments",
"comments_disabled": false,
"next_page_token": "Eg0SC2l4OWNSYUJrVmUwGAYyggMK2AJnZXRfcmFua2Vk…",
"meta": {
"source": "youtube",
"elapsed_s": 0.96
}
}Errors
Errors return a JSON body with a detail field. Failed requests are not charged. See Errors for the full list and retry advice.
| Status | Meaning | Retry? |
|---|---|---|
401 Unauthorized | Missing or invalid API key. {"detail":"missing or invalid API key"} | No, fix the request |
402 Payment Required | Not enough credits for this request: the account's credits mode is {"detail":"insufficient credits: this request costs 5, 0 available. Credits renew 2026-11-01."} | No, fix the request |
404 Not Found | The property, stay, job or record was not found. {"detail":"job not found"} | No, fix the request |
422 Unprocessable Content | Request validation failed. {"detail":[{"loc":["body","name"],"msg":"Field required","type":"missing"}]} | No, fix the request |
429 Too Many Requests | Too many requests: the key's requests-per-minute limit was exceeded, or (in {"detail":"rate limit 60/min exceeded"} | Yes, with backoff |
502 Bad Gateway | The upstream source failed, blocked the request or returned an unusable answer. Safe to retry later; failed requests are not charged. {"detail":"RuntimeError"} | Yes, with backoff |
503 Service Unavailable | Temporarily unavailable: a dependency of this endpoint is down, or the upstream source changed its contract. Retry later. {"detail":"database unavailable: OperationalError"} | Yes, with backoff |
Try it
Press Try it above to run this request on your own key, with the values you type (sign in first). For a no-code walkthrough, use the workspace’s guided Try it.
- Export your key:
export SCRAPERCOMPANY_API_KEY=sk_...(no key yet? start a free trial). - Copy the cURL example above and run it in a terminal.
Credits
2 credits per successful call (2 (an empty answer, an unknown or private video, and failed requests are free)). Failed, blocked and empty results are free.