YouTube API: search videos by keyword and read comments

To go from a keyword to the conversation under a YouTube video, use three calls: search videos by keyword and take a video_id, read that video's detail, then read its first-level comments. Every step below is a real endpoint with real parameters.

A new account gets 50 trial calls; after that, successful calls are billed from a prepaid balance. See pricing.

From a keyword search to the comments in three calls

Replace nike in the examples with your search keyword. EXAMPLE_v01 in steps 2 and 3 is a placeholder: use a video_id from the step 1 results (the 11 characters after youtube.com/watch?v=, or a record's extra.source_id). You need an API key, and a new account has 50 trial calls; once the trial calls are used, the YouTube endpoints are billed from your balance.

  1. Search videos by keyword

    keyword is the search term. Optional upload_date filters by upload-date window: hour, today, week, month (the default) or year — an upload-date range, not a sort order. About 20 a page; each record's video_id (extra.source_id) and link feed the later steps. Pass back the previous page's cursor to continue and stop when has_more is false. No match answers empty.

    YouTube video searchGET /v1/raw/youtube/search

    cURL
    curl 'https://api.qovia.ai/v1/raw/youtube/search?keyword=nike' \
      -H "Authorization: Bearer $QOVIA_KEY"
    Python
    import os
    import requests
    
    resp = requests.get(
        "https://api.qovia.ai/v1/raw/youtube/search",
        params={"keyword": "nike"},
        headers={"Authorization": f"Bearer {os.environ['QOVIA_KEY']}"},
        timeout=30,
    )
    resp.raise_for_status()
    body = resp.json()
    print(body["meta"]["charged_usd"], body["data"])

    The data in the response. The sample comes from the endpoint catalog, not live data; lists are cut to their first two entries and picture links are left out:

    200 OK
    {
      "data": {
        "items": [
          {
            "id": "soc_you_7c265a093c9a",
            "src": "social",
            "platform": "youtube",
            "lang": null,
            "text": "Nike’s Worsening Slump Forces CEO to Rethink Turnaround\nNike Inc. is cutting jobs and embarking on a sweeping overhaul of the business as results deteriorate and test Wall Street's ...",
            "author": {
              "uid_hash": "6586b6e1f98e",
              "followers": null,
              "nickname": "Bloomberg Television",
              "uid": "UCIALMKvObZNtJ6AmdCLP7Lg",
              "unique_id": null
            },
            "metrics": {
              "plays": 89001
            },
            "extra": {
              "source_id": "RTZP4M8gN0U",
              "title": "Nike’s Worsening Slump Forces CEO to Rethink Turnaround",
              "published_at": "2026-10-07T00:00:00+00:00",
              "video_dur_s": 358,
              "content_type": "video",
              "url": "https://www.youtube.com/watch?v=RTZP4M8gN0U"
            },
            "prov": {
              "hash": "0xb3d4cc9aa6b75e13",
              "ts": "2026-10-22T03:30:00+08:00",
              "source": "live"
            }
          },
          {
            "id": "soc_you_8ec9fc0734c3",
            "src": "social",
            "platform": "youtube",
            "lang": null,
            "text": "Rapid Recap: Nike's stock has struggled as it faces stiff competition - here’s what experts say\nCNBC's Jim Cramer, BTIG's Bob Drbul, Evercore ISI's Michael Binetti, and Permanent Portfolio's Michael Cuggino weigh in on ...",
            "author": {
              "uid_hash": "d567d3852b43",
              "followers": null,
              "nickname": "CNBC Television",
              "uid": "UCrp_UI8XtuYfpiqluWLD7Lw",
              "unique_id": null
            },
            "metrics": {
              "plays": 55577
            },
            "extra": {
              "source_id": "tjeur2Hdh8w",
              "title": "Rapid Recap: Nike's stock has struggled as it faces stiff competition - here’s what experts say",
              "published_at": "2026-10-07T00:00:00+00:00",
              "video_dur_s": 167,
              "content_type": "video",
              "url": "https://www.youtube.com/watch?v=tjeur2Hdh8w"
            },
            "prov": {
              "hash": "0x97a713ff74381ed4",
              "ts": "2026-10-22T03:30:00+08:00",
              "source": "live"
            }
          }
        ],
        "cursor": "EpEFEgRuaWtlGowDRWdRSUJCQUJTQlNDQVF0SFYxOWpSMTg0UXpkd1VZSUJDMmxxUzBNeE4w",
        "has_more": true,
        "prov": {
          "hash": "0x5bee0e0b8c810cc0",
          "ts": "2026-10-22T03:30:00+08:00",
          "source": "live"
        }
      }
    }
  2. Read the video detail

    video_id is the 11 characters after youtube.com/watch?v=, which you can take from the previous step (extra.source_id). You get title, description, channel (name, @handle, subscribers), like / comment / view counts, duration, publish time and more. EXAMPLE_v01 in the example is only a placeholder; a video that does not exist answers 404.

    YouTube video detailGET /v1/raw/youtube/video

    cURL
    curl 'https://api.qovia.ai/v1/raw/youtube/video?video_id=EXAMPLE_v01' \
      -H "Authorization: Bearer $QOVIA_KEY"
  3. Read the video's first-level comments

    It takes the same video_id; the value in the example is still a placeholder. Optional sort is top (the default) or newest. About 20 a page; pass back the previous page's cursor to continue and stop when has_more is false. A video without comments, or one that does not exist, answers empty. Replies under one comment come from raw.youtube.comment_replies with that comment's reply_cursor.

    YouTube video commentsGET /v1/raw/youtube/comments

    cURL
    curl 'https://api.qovia.ai/v1/raw/youtube/comments?video_id=EXAMPLE_v01' \
      -H "Authorization: Bearer $QOVIA_KEY"

More endpoints for this

FAQ

Where does video_id come from?

From extra.source_id in the search results (raw.youtube.search); it is the 11 characters in youtube.com/watch?v=<ID>. A video record's author.uid is the channel ID — do not confuse it with video_id.

How do I read the replies under a comment?

The comments endpoint returns first-level comments only. Pass a comment's reply_cursor as cursor to raw.youtube.comment_replies (about 10 on the first page, about 50 later); then page with the returned cursor and stop when has_more is false.

Can I start from a channel instead?

Yes. raw.youtube.channel reads a channel by channel_id (24 characters starting with UC, from a video record's author.uid or youtube.com/channel/<ID>); raw.youtube.channel_videos lists that channel's videos. Take a video_id from there, then read the detail and comments.

How is it billed?

A new account gets 50 trial calls; after that, calls are billed from a prepaid balance, and only successful calls that return data are charged. Empty results and errors are not, and meta.charged_usd in each response says what the call cost. Each endpoint's price is in the API reference, and the plans are on the pricing page.

Your agent only knows what you give it

Give it Douyin, Xiaohongshu (RedNote), WeChat and product reviews: structured, per call, nothing charged for failures.