YouTube API & Scraper
The YouTube API returns videos, channels, playlists, comments and transcripts as clean JSON.
🤖 Using an AI assistant? Copy this link into ChatGPT / Claude / Cursor — it reads every endpoint and parameter instantly and tells you if this API fits your use case.
The primary search endpoint returns type-tagged results (video, shorts, channel, playlist) with a continuation token for paging, and you can pull a video_detail, comments, a channel and its videos and shorts, a playlist, related videos, and a video's transcript. It is built for content research, competitor monitoring and AI pipelines that need YouTube data without OAuth quotas or a scraper. One ReefAPI key, one shared credit pool, the standard envelope.
YouTube id formats: video, channel, handle, playlist and comment
Every action here takes an id, and each id has its own fixed shape. Most id parameters also accept a full URL, which the engine resolves for you. The shapes below were read off live responses on 2026-08-27 rather than from documentation.
| Id | Shape (measured) | Example | Accepted by |
|---|---|---|---|
| video_id | 11 characters, case sensitive | dQw4w9WgXcQ | video_detail, comments, transcript, related; also any watch, youtu.be, shorts or embed URL |
| channel_id | UC + 22 characters, 24 in total | UCuAXFkgsw1L7xaCfnd5JJOw | channel, channel_about, channel_videos, channel_shorts |
| handle | @ plus the channel handle | @RickAstleyYT | the same channel_id parameter, which resolves it to the UC id |
| playlist_id | PL + 16 or PL + 32 characters | PL15B1E77BB5708555 | playlist; UU, OLAK and VL browse ids are accepted too |
| comment_id | Ugz-prefixed, 26 characters | Ugzge340dBgB75hWBm54AaABAg | returned by comments; not an input |
| continuation | opaque token, around 860 characters | too long to print | the continuation parameter on search, comments, playlist, channel_videos, channel_shorts |
Looking a channel up by @handle returns the UC id in the response, so one call converts a handle you scraped out of a URL into the stable id you should be storing.
Real request and response JSON
Captured from the indexed primary action, search, on .
{
"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
}
}{
"ok": true,
"meta": {
"api": "youtube",
"endpoint": "search",
"mode": "live",
"latency_ms": 2579.7,
"record_count": 20,
"bytes": 714589,
"cache_hit": false,
"completeness_pct": 100,
"stop_reason": "limit_reached",
"type": "video",
"estimated_results": 811289
},
"data": {
"results": [
{
"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,992,199 views",
"views_int": 55992199,
"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": "X4VbdwhkE10",
"title": "lofi hip hop radio 📚 beats to relax/study to",
"channel": "Lofi Girl",
"channel_id": "UCSJ4gkVC6NrvII8umztf0Ow",
"views": "9,409 watching",
"views_int": 9409,
"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": "rPjez8z61rI",
"title": "lofi hip hop radio – beats to sleep/study/relax to ☕",
"channel": "STEEZYASFUCK",
"channel_id": "UCsIg9WMfxjZZvwROleiVsQg",
"views": "363 watching",
"views_int": 363,
"published": null,
"length": null,
"description": "Lofi Hip-Hop Beats on Spotify: → https://fanlink.to/LofiHipHop Welcome to our 24/7 lofi hip-hop live stream. Good for relaxing ...",
"thumbnails": [
{
"url": "[trimmed-depth]",
"width": "[trimmed-depth]",
"height": "[trimmed-depth]"
}
],
"url": "https://www.youtube.com/watch?v=rPjez8z61rI"
}
],
"count": 20,
"estimated_results": 811289,
"continuation": "EvAEEgxsb2ZpIGhpcCBob3Aa3ARFcnNEa2dHM0F6b3JFaWQ1YjNWMGRXSmxYMnhwZG1WZlluSnZZV1JqWVhOMFgzTjBZWFIxY3owd0lEcDBlWEJsT25KZ0JFcUhBd29jQ2d4c2IyWnBJR2hwY0NCb2IzRHlBUVVLQTBGc2JOZ0NBYmdEWVFxbEFmSUJDQW9HVTJodmNuUnp3Z0tRQVNoaElIbHZkWFIxWW1WZmMyaHZjblJ6WDJSbFptbHVhWFJwYjI0Z09uUjVjR1U2Y2lBb2JpQjViM1YwZFdKbFgyWnNZV2RmYUdGelgzQnlaVzFwWlhKbFgzWnBaR1Z2WDIxbGRHRmtZWFJoUFRFZ09uUjVjR1U2Y2lrZ0tHNGdlVzkxZEhWaVpWOW1iR0ZuWDJoaGMxOXNhWFpsWDNOMGNtVmhiVjl0WlhSaFpHRjBZVDB4SURwMGVYQmxPbklwS2ZnQ0FiZ0RHZ29XOGdFTENnbFZibmRoZEdOb1pXVEtBZ0lZQWJnREhBb1U4Z0VKQ2dkWFlYUmphR1ZreWdJQ0dBSzRBMG9LT3ZJQkNBb0dWbWxrWlc5endnSWFlVzkxZEhWaVpW",
"query": "lofi hip hop",
"type": "video"
}
}What the YouTube API does
| Action | Description | Concrete use case | Key params |
|---|---|---|---|
| search | search videos/channels/playlists/shorts with filters (upload date, duration, sort order, features) | Content platforms call search to search videos/channels/playlists/shorts with filters (upload date, duration, sort order, feat…. | query, type, limit, continuation, upload_date, ... |
| video_detail | video metadata: title/views/likes/date/channel/description (+ duration/keywords/thumbnails/caption-langs best-effort) | Research tools call video_detail to get video metadata. | video_id |
| video_details | BATCH engagement enrichment — pass up to 50 video_ids in ONE call, get likes + description (+ optional comment_count) per video. Built to enrich channel_videos/channel_shorts lists (which don't carry likes) without one call per video. | Community analysts call video_details to get bATCH engagement enrichment. | video_ids, include_comment_count |
| comments | video comments (text/author/likes/replies), paginated, sortable by top or newest | Media monitors call comments to get video comments (text/author/likes/replies), paginated, sortable by top or newest. | video_id, limit, continuation, sort |
| channel | channel detail: subs/videoCount/description/links | Content platforms call channel to get channel detail. | channel_id, handle, url |
| transcript | video transcript/captions (timed segments + full text) select any language the video has via 'lang'; format=text|segments | Research tools call transcript to get video transcript/captions (timed segments + full text) select any language the video has via…. | video_id, lang, format |
| playlist | list a playlist's videos (id/title/channel/duration/position), paginated | Community analysts call playlist to list a playlist's videos (id/title/channel/duration/position), paginated. | playlist_id, limit, continuation |
| channel_videos | a channel's uploads (Videos tab): video_id/title/views/duration, paginated | Media monitors call channel_videos to get a channel's uploads (Videos tab). | channel_id, handle, url, limit, continuation |
| channel_shorts | a channel's Shorts tab (video_id/title/views/views_int/thumbnails), paginated — the Shorts that the Videos tab (channel_videos) omits; works for shorts-only channels | Content platforms call channel_shorts to get a channel's Shorts tab (video_id/title/views/views_int/thumbnails), paginated. | channel_id, handle, url, limit, continuation |
| related | recommended/related videos for a video_id (from the watch page) | Research tools call related to get recommended/related videos for a video_id (from the watch page). | video_id, limit |
| channel_about | full channel About panel: total views, joined date, country, links, description | Community analysts call channel_about to get full channel About panel. | channel_id, handle, url |
Call search from your stack
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}'import requests
r = requests.post(
"https://api.reefapi.com/youtube/v1/search",
headers={"x-api-key": REEF_KEY},
json={
"query": "lofi hip hop",
"type": "video",
"limit": 20
},
)
print(r.json()["data"])const res = await fetch("https://api.reefapi.com/youtube/v1/search", {
method: "POST",
headers: {
"x-api-key": process.env.REEF_KEY,
"content-type": "application/json",
},
body: JSON.stringify({
"query": "lofi hip hop",
"type": "video",
"limit": 20
}),
});
const { ok, data, meta, error } = await res.json();Ask your MCP-connected assistant: call reefapi.youtube.search with {"query":"lofi hip hop","type":"video","limit":20}.Who uses this API and why
- Content teams call search and channel_videos to track a competitor's uploads and performance.
- AI and research pipelines pull transcript to summarize or search the spoken content of a video.
- Comment-analysis tools use comments to measure audience sentiment on a video at scale.
Questions developers ask before integrating
Are YouTube view and like counts integers or strings?
video_detail returns both. A measured call for dQw4w9WgXcQ on 2026-08-27 returned views 1808420510 as an integer alongside views_text '1,808,420,510 views' as the display string. likes is an integer too, but it is YouTube's own rounded figure: the same video returned 19000000, which is the '19M' the watch page shows rather than an exact count. Nobody can read an exact like count off YouTube, so treat likes as an order of magnitude.
Why do the view counts on channel_videos and playlist look far too small?
Those list surfaces publish an abbreviated label instead of a number. Measured on 2026-08-27, a MrBeast upload came back with views '59M views' and views_int 59, and a playlist row came back with views '9.1B views' and views_int 91. The label in views is correct, the integer derived from it on those list actions is not. For exact figures collect the ids and call video_details, which returned 59748410 for that same video.
What format is the video duration in?
Not ISO-8601. video_detail returns length_seconds as a plain integer, measured at 213 for a three and a half minute video. The list actions instead return a display string in duration or length, such as '20:29' or '6:10:58'. If you need seconds from a list row you have to parse the colon-separated string yourself, or call video_detail for that id.
What format is the publish date?
A US-style display date, not a timestamp. video_detail returned published_date 'Oct 24, 2009' plus published_relative '16 years ago', and the video_details batch returned 'Aug 22, 2026' for a recent upload. The list actions carry only the relative form in published, for example '4 days ago' or '4 years ago'. There is no ISO date anywhere in the video responses, so parse the display string if you need one.
Which action gives the right subscriber count?
channel_about. Measured on 2026-08-27 for UCuAXFkgsw1L7xaCfnd5JJOw it returned subscribers 4540000, matching the 4.54M that video_detail reports inside its channel block, plus view_count 2536701615, video_count 435, country 'United Kingdom' and joined_date 'Joined Feb 1, 2015'. The channel action reads the channel header instead, and on a channel whose header carries a featured link it picked up the wrong element and reported 105000 for the same channel. Use channel_about for counts and channel for the profile fields.
How do I page past the limit on a YouTube search?
Every paginated action caps limit at 200 items per call and returns a continuation token, measured at around 860 characters. Send that token back in the continuation parameter instead of the query or id to get the next page. search also returns estimated_results, which was 798512 for 'lofi hip hop', and meta.stop_reason tells you why the engine stopped, for example 'limit_reached'.
What does the transcript action return, and can I choose a language?
It returns language, language_code, an is_generated flag, segment_count, duration_ms, the full text, and segments[] with start_ms, dur_ms and text per cue. A measured call for dQw4w9WgXcQ returned 61 segments over 211320 ms of a 213-second video with is_generated false, meaning a human-authored track. available_languages lists every track with its own is_generated and translatable flags; that video carried English, English auto-generated, German, Japanese, Brazilian Portuguese and Latin American Spanish among others. Pass lang to pick one.
Why does channel_videos not include a channel's Shorts?
YouTube splits them into separate tabs and so does this API. channel_videos reads the Videos tab, channel_shorts reads the Shorts tab, and a shorts-only channel returns nothing from the first and everything from the second. Neither list carries likes, so if you need engagement for a whole channel, collect the video_ids and pass up to 50 at a time to video_details, which returns likes and description per video in one call.
What is the YouTube API?
YouTube API is a ReefAPI endpoint group for video details, search, comments and transcripts. It returns live JSON through POST requests under /youtube/v1.
Is the YouTube API free to try?
Yes. ReefAPI starts with 1,000 free credits, no card required. YouTube calls use the same shared credit balance as every other ReefAPI engine.
Do I need a YouTube login or account?
No login to YouTube is needed for the API response. You call ReefAPI with your x-api-key header, and the playground can run live examples before you create a production key.
How fresh is the YouTube data?
The page example is captured from a live search call, and production requests fetch live data through ReefAPI rather than a static sample.
How many credits does the YouTube API use?
YouTube actions currently cost 1-2 credits per successful call. Failed or blocked calls are free, and all APIs draw from one credit pool.
Can I call YouTube from an AI assistant or MCP client?
Yes. Connect ReefAPI once through MCP and your assistant can call youtube actions with the same key, credit pool and JSON envelope used by normal REST requests.