Media, Social & Knowledge

How do you get YouTube video search data via API?

To get YouTube video data via API, call ReefAPI's YouTube search endpoint with a query and type; it returns video results, channels, identifiers, thumbnails and visible stats in a clean response envelope.

YouTube engineLive JSON4 steps1,000 free credits

This guide demonstrates the real YouTube API engine with a captured response from . The example is only published because the engine passed the SEO snapshot gate.

Use case

Video research, creator analytics, content monitoring and media discovery.

Step by step

Call the live endpoint

  1. 1

    Choose the query and result type

    Set a query and type such as video when you want video results rather than channels.

  2. 2

    Call youtube/v1/search

    POST the params and read data.results from the response.

  3. 3

    Keep stable identifiers

    Persist video_id, channel_id, title, URL, thumbnails and visible stats for later enrichment.

  4. 4

    Enrich selected videos

    Use video_detail or transcript actions when your product needs one video instead of a search result set.

Code

Copy the request

These snippets use the captured request params for youtube/v1/search.

curl -X POST https://api.reefapi.com/youtube/v1/search \
  -H "x-api-key: $REEF_KEY" \
  -H "content-type: application/json" \
  -d '{"query":"lofi hip hop","type":"video","limit":20}'
MCP one-liner
Ask your MCP-connected assistant: call reefapi.youtube.search with {"query":"lofi hip hop","type":"video","limit":20}.
Real response

Captured output from ReefAPI

Captured on UTC. The response below is the committed snapshot, including the API envelope and metadata.

Captured request
{
  "method": "POST",
  "url": "https://api.reefapi.com/youtube/v1/search",
  "headers": {
    "x-api-key": "$REEF_KEY",
    "content-type": "application/json"
  },
  "body": {
    "query": "lofi hip hop",
    "type": "video",
    "limit": 20
  }
}
Captured response
{
  "ok": true,
  "meta": {
    "api": "youtube",
    "endpoint": "search",
    "mode": "live",
    "latency_ms": 2418,
    "record_count": 20,
    "bytes": 694166,
    "cache_hit": false,
    "completeness_pct": 100,
    "stop_reason": "limit_reached",
    "type": "video",
    "estimated_results": 854413,
    "attempts": 1
  },
  "data": {
    "results": [
      {
        "type": "video",
        "video_id": "X4VbdwhkE10",
        "title": "lofi hip hop radio 📚 beats to relax/study to",
        "channel": "Lofi Girl",
        "channel_id": "UCSJ4gkVC6NrvII8umztf0Ow",
        "views": "18,004 watching",
        "views_int": 18004,
        "published": null,
        "length": null,
        "description": "Listen on Spotify, Apple music and more → https://lnk.to/lofi-hiphop-beats-to-relax-study-to02 | Lofi Girl on all social media ...",
        "thumbnails": [
          {
            "url": "[trimmed-depth]",
            "width": "[trimmed-depth]",
            "height": "[trimmed-depth]"
          },
          {
            "url": "[trimmed-depth]",
            "width": "[trimmed-depth]",
            "height": "[trimmed-depth]"
          }
        ],
        "url": "https://www.youtube.com/watch?v=X4VbdwhkE10"
      },
      {
        "type": "video",
        "video_id": "n61ULEU7CO0",
        "title": "Best of lofi hip hop 2021 ✨ [beats to relax/study to]",
        "channel": "Lofi Girl",
        "channel_id": "UCSJ4gkVC6NrvII8umztf0Ow",
        "views": "55,535,368 views",
        "views_int": 55535368,
        "published": "4 years ago",
        "length": "6:10:58",
        "description": "Listen on Spotify, Apple music and more → https://fanlink.tv/BestofLofi2021 The new Lofi Girl compilation “Best of 2021” is out now ...",
        "thumbnails": [
          {
            "url": "[trimmed-depth]",
            "width": "[trimmed-depth]",
            "height": "[trimmed-depth]"
          },
          {
            "url": "[trimmed-depth]",
            "width": "[trimmed-depth]",
            "height": "[trimmed-depth]"
          }
        ],
        "url": "https://www.youtube.com/watch?v=n61ULEU7CO0"
      },
      {
        "type": "video",
        "video_id": "blAFxjhg62k",
        "title": "Coffee Shop Radio  - 24/7 Chill Lo-Fi & Jazzy Beats",
        "channel": "STEEZYASFUCK",
        "channel_id": "UCsIg9WMfxjZZvwROleiVsQg",
        "views": "336 watching",
        "views_int": 336,
        "published": null,
        "length": null,
        "description": "... Website: https://stzzzy.com/ Submission: https://stzzzy.com/submissions #coffeeshop #lofi #lofihiphop.",
        "thumbnails": [
          {
            "url": "[trimmed-depth]",
            "width": "[trimmed-depth]",
            "height": "[trimmed-depth]"
          },
          {
            "url": "[trimmed-depth]",
            "width": "[trimmed-depth]",
            "height": "[trimmed-depth]"
          }
        ],
        "url": "https://www.youtube.com/watch?v=blAFxjhg62k"
      }
    ],
    "count": 20,
    "estimated_results": 854413,
    "continuation": "EvAEEgxsb2ZpIGhpcCBob3Aa3ARFcnNEa2dHM0F6b3JFaWQ1YjNWMGRXSmxYMnhwZG1WZlluSnZZV1JqWVhOMFgzTjBZWFIxY3owd0lEcDBlWEJsT25KZ0JFcUhBd29jQ2d4c2IyWnBJR2hwY0NCb2IzRHlBUVVLQTBGc2JOZ0NBYmdEWVFxbEFmSUJDQW9HVTJodmNuUnp3Z0tRQVNoaElIbHZkWFIxWW1WZmMyaHZjblJ6WDJSbFptbHVhWFJwYjI0Z09uUjVjR1U2Y2lBb2JpQjViM1YwZFdKbFgyWnNZV2RmYUdGelgzQnlaVzFwWlhKbFgzWnBaR1Z2WDIxbGRHRmtZWFJoUFRFZ09uUjVjR1U2Y2lrZ0tHNGdlVzkxZEhWaVpWOW1iR0ZuWDJoaGMxOXNhWFpsWDNOMGNtVmhiVjl0WlhSaFpHRjBZVDB4SURwMGVYQmxPbklwS2ZnQ0FiZ0RHZ29XOGdFTENnbFZibmRoZEdOb1pXVEtBZ0lZQWJnREhBb1U4Z0VKQ2dkWFlYUmphR1ZreWdJQ0dBSzRBMG9LT3ZJQkNBb0dWbWxrWlc5endnSWFlVzkxZEhWaVpW",
    "query": "lofi hip hop",
    "type": "video"
  }
}
Manual way

Why this is hard manually

YouTube pages mix public metadata, client-rendered payloads, experiments and infinite scrolling. A simple HTML parser usually misses thumbnails, channel ids, live counters or continuation state.

Even if you only need search results, production code needs to separate videos from channels, handle large result counts and avoid breaking when the layout or text labels change.

ReefAPI way

Why ReefAPI solves it

The snapshot used here searches for lofi hip hop videos and returns 20 live results with video ids, titles, channel data, visible view text, descriptions and thumbnails. That response is rendered directly on the guide page.

For deeper workflows, use the same engine's video_detail or transcript actions after selecting a video_id from search.

FAQ

Questions developers ask

Does this guide require OAuth?

No. It demonstrates ReefAPI's YouTube engine with a ReefAPI key, not user OAuth.

Can I fetch transcripts?

Yes. The YouTube engine includes a transcript action for video ids when transcripts are available.

Does search include channel data?

The captured response includes channel names and channel ids for returned video results.

Can I use this for monitoring?

Yes. Schedule repeated searches, store video ids you have seen, and alert on new matching videos.