Skip to content
Docs
YouTube

YouTube video

One video's metadata from two InnerTube calls (player, ~12 KB, then next, ~450 KB).

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

Exact views and length_seconds come from the player's videoDetails; likes (exact) from its microformat, falling back to the like button's accessibility text; 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

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

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

Body

JSON object. Unknown fields are rejected with 422.

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

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

200 response
{
  "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",
    "wire_bytes": 488937,
    "elapsed_s": 0.81
  }
}
Arrays are shortened to their first items.

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