YouTube video
One video's metadata, counts and chapters.
https://api.scrapercompany.com/v1/youtube/videoExact views, length_seconds and likes (falling back to the like button's own text when YouTube hides the exact count); published_date/upload_date are YouTube's ISO timestamps; date_text and relative_date_text the watch page's own wording. The full description, keywords, category, hashtags, live flags (is_live, live_broadcast), is_family_safe, thumbnails and chapters (source says whether the creator or YouTube made them) complete it. Accepts an id or any video URL. A removed, private or never-existing video is a 404; an age-gated video answers its metadata with age_restricted: true.
Request
Send POST https://api.scrapercompany.com/v1/youtube/video 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 required 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). - 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/video" \
-H "x-api-key: $SCRAPERCOMPANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"video_id": "8jPQjjsBbIc"
}'Response
200 — One video's metadata, counts and chapters. Metered responses carry x-credits-charged and x-credits-remaining headers (see credit headers).
{
"search_parameters": {
"engine": "youtube_video",
"video_id": "8jPQjjsBbIc",
"hl": "en",
"gl": "US"
},
"video": {
"video_id": "8jPQjjsBbIc",
"title": "How to stay calm when you know you'll be stressed | Daniel Levitin | TED",
"link": "https://www.youtube.com/watch?v=8jPQjjsBbIc",
"description": "Visit http://TED.com to get our entire library of TED Talks, transcripts, translations, personalized talk recommendations and more.",
"channel": {
"name": "TED",
"id": "UCAuUUnT6oDeKwE6v1NGQxug",
"handle": "@TED",
"link": "https://www.youtube.com/@TED",
"verified": true,
"thumbnail": "https://yt3.ggpht.com/ytc/AIdro_koIFcCOrvh0KThLNOiazAIDu6hcs8bjkGNwe1f6A_OYm8=s176-c-k-c0x00ffffff-no-rj",
"subscribers_text": "27.9M subscribers"
},
"views": 20045814,
"views_text": "20,045,814 views",
"likes": 268948,
"likes_text": "268K",
"published_date": "2015-11-23T08:58:55-08:00",
"upload_date": "2015-11-23T08:58:55-08:00",
"date_text": "Nov 23, 2015",
"relative_date_text": "10 years ago",
"length_seconds": 740,
"category": "Science & Technology",
"keywords": [
"TED Talk",
"TED Talks"
],
"hashtags": [],
"is_live": false,
"is_live_content": false,
"is_family_safe": true,
"is_unlisted": false,
"is_private": false,
"age_restricted": false,
"thumbnails": [
{
"url": "https://i.ytimg.com/vi_webp/8jPQjjsBbIc/maxresdefault.webp",
"width": 1920,
"height": 1080
}
],
"chapters": [
{
"title": "The personal crisis",
"start_s": 0,
"source": "AUTO_CHAPTERS"
},
{
"title": "Brain function under stress",
"start_s": 96.08,
"source": "AUTO_CHAPTERS"
}
],
"comment_count_text": "4K"
},
"meta": {
"source": "youtube",
"elapsed_s": 0.81
}
}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.