Skip to content
Docs
YouTube

YouTube comments

One page (~20 threads) of comments from InnerTube next continuations: the watch page (for the comments token), then the comments page — a third call for sort=newest; one call with a page_token.

POST/v1/youtube/comments
2 creditsTry it2 (an empty answer, an unknown or private video, and failed requests are free)

Each 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

POSThttps://api.scrapercompany.com/v1/youtube/comments

Authenticate with your API key in the x-api-key header (see Authentication).

Body

JSON object. Unknown fields are rejected with 422.

  • video_idstring | nullmin 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 from POST /v1/youtube/search (videos[].video_id). Required unless page_token is given.

  • sortstringdefault top

    YouTube's Sort-by menu: top (YouTube's featured order) or newest (one extra upstream call on the first page). A page_token keeps the sort it was issued with.

    One ofnewesttop

  • page_tokenstring | nullmax length 4000

    next_page_token from a previous answer, or a comment's replies_page_token to read its replies. It carries the video and the sort.

  • hlstringdefault 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.

  • glstringdefault 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).

200 response
{
  "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",
    "wire_bytes": 1700470,
    "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.

StatusMeaningRetry?
401Unauthorized

Missing or invalid API key.

{"detail":"missing or invalid API key"}
No, fix the request
402Payment Required

Not enough credits for this request. Only returned once credit enforcement is switched on; during the beta metering runs in shadow mode and never blocks.

{"detail":"insufficient credits: this request costs 5, 0 available. Credits renew 2026-11-01."}
No, fix the request
404Not Found

The property, stay, job or record was not found.

{"detail":"job not found"}
No, fix the request
422Unprocessable Content

Request validation failed. detail is a list of problems for schema errors, or a string for semantic checks performed by the endpoint.

{"detail":[{"loc":["body","name"],"msg":"Field required","type":"missing"}]}
No, fix the request
429Too Many Requests

Too many requests: the key's requests-per-minute limit was exceeded, or (once credit enforcement is on) the plan's concurrent-request limit. No rate-limit or Retry-After headers are sent; back off and retry.

{"detail":"rate limit 60/min exceeded"}
Yes, with backoff
502Bad 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
503Service 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

The quickest way: open this endpoint in Try it. It runs on your account with the example request filled in, shows the cost before you run, and shows the answer as a readable table next to the JSON and the code. Signed out? You sign in first and come straight back.

  1. Export your key: export SCRAPERCOMPANY_API_KEY=sk_... (no key yet? request access).
  2. Copy the cURL example above and run it in a terminal.
  3. Or open the interactive playground on api.scrapercompany.com, paste your key and pick this endpoint.

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. Credit metering is in beta and does not block requests yet.

Questions about this page?

Send the page link and your question, and the team will answer.

Email support