YouTube Video API Documentation

The YouTube Video API offers developers access to YouTube video information. It allows scraping video metadata such as titles, descriptions, view counts, likes, and more, using the /api/v1/videos?engine=youtube_video endpoint.

API Parameters

Search Query

  • Name
    video_id
    Required
    Required
    Description

    Parameter defines the video_id you want to search. You can find these values in JSON responses in YouTube engine or in YouTube page that appears in URL: https://www.youtube.com/watch?v=video_id.

Localization

  • Name
    gl
    Required
    Optional
    Description

    The default parameter us defines the country of the search. Check the full list of supported YouTube gl countries.

  • Name
    hl
    Required
    Optional
    Description

    The default parameter en defines the interface language of the search. Check the full list of supported YouTube hl languages.

Engine

  • Name
    engine
    Required
    Required
    Description

    Parameter defines the engine that will be used to retrieve real-time data. To retrieve YouTube video details, it must be set to youtube_video.

API key

  • Name
    api_key
    Required
    Required
    Description

    The api_key authenticates your requests. Use it as a query parameter (https://www.searchapi.io/api/v1/search?api_key=YOUR_API_KEY) or in the Authorization header (Bearer YOUR_API_KEY).

API Examples

Full Response

Full Response
GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=RcYjXbSJBN8
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "RcYjXbSJBN8"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "search_metadata": {
    "id": "search_ZD40AeqmorqVs15gkyw25lR8",
    "status": "Success",
    "created_at": "2024-02-12T16:24:01Z",
    "request_time_taken": 1.41,
    "parsing_time_taken": 0.02,
    "total_time_taken": 1.43,
    "request_url": "https://www.youtube.com/watch?v=RcYjXbSJBN8",
    "html_url": "https://www.searchapi.io/api/v1/searches/search_ZD40AeqmorqVs15gkyw25lR8.html",
    "json_url": "https://www.searchapi.io/api/v1/searches/search_ZD40AeqmorqVs15gkyw25lR8"
  },
  "search_parameters": {
    "engine": "youtube_video",
    "video_id": "RcYjXbSJBN8"
  },
  "video": {
    "id": "RcYjXbSJBN8",
    "title": "Joe Rogan Experience #1470 - Elon Musk",
    "length_seconds": 7209,
    "views": 33064421,
    "likes": 611000,
    "author": "PowerfulJRE",
    "category": "People & Blogs",
    "published_time": "May 7, 2020",
    "description": "Elon Musk is a business magnet, entrepreneur and engineer.",
    "keywords": [
      "Joe Rogan Experience",
      "JRE",
      "Joe",
      "Rogan",
      "podcast",
      "MMA",
      "comedy",
      "stand",
      "up",
      "funny",
      "Freak",
      "Party",
      "Joe Rogan",
      "Elon Musk",
      "JRE #1470"
    ],
    "is_family_safe": true,
    "thumbnail": "https://i.ytimg.com/vi/RcYjXbSJBN8/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLAMtuVD13MLfs3OQzeLNz7sOKFKmA",
    "formats": [
      {
        "itag": 137,
        "mime_type": "video/mp4; codecs=\"avc1.640028\"",
        "bitrate": 2356878,
        "width": 1920,
        "height": 1080,
        "last_modified_unix": "1698285206906238",
        "last_modified": "2023-10-26 01:53:26 UTC",
        "content_length": "1070488138",
        "quality": "hd1080",
        "fps": 30,
        "quality_label": "1080p",
        "projection_type": "RECTANGULAR"
      },
      ...
    ]
  },
  "channel": {
    "id": "UCzQUP1qoWDoEbmsQxvdjxgQ",
    "name": "PowerfulJRE",
    "link": "http://www.youtube.com/@joerogan",
    "subscribers": 16100000,
    "featured_channel": {
      "id": "UCzQUP1qoWDoEbmsQxvdjxgQ",
      "name": "PowerfulJRE",
      "link": "https://www.youtube.com/channel/UCzQUP1qoWDoEbmsQxvdjxgQ"
    },
    "thumbnail": "https://yt3.ggpht.com/ytc/AIf8zZQeMugPC9V7YtS8-B6j7b0pF4lkgEIHHFJ5yB1W0A=s176-c-k-c0x00ffffff-no-rj"
  },
  "comment": {
    "total": 92000,
    "teaser_avatar": "https://yt3.ggpht.com/ytc/AIf8zZSyOM0tTulbXgCxFv49btxe7m5261fBLWAgrw=s176-c-k-c0x00ffffff-no-rj",
    "teaser_name": "Korbyn Johnson",
    "teaser_text": "Elon Musk CEO of Tesla, SpaceX, and “Yeah, for sure”."
  },
  "key_moments": [
    {
      "title": "Essential Elements of an Ai Neural Net",
      "start_seconds": 250,
      "thumbnail": "https://i.ytimg.com/vi/RcYjXbSJBN8/hqdefault_278066.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLCM_fH9pDF6URipNUwUjqAb1ysouw"
    },
    ...
  ],
  "available_transcripts_languages": [
    {
      "name": "English (auto-generated)",
      "lang": "en"
    }
  ],
  "recommended_videos": {
    "videos": [
      {
        "position": 1,
        "id": "JN3KPFbWCy8",
        "title": "Elon Musk: War, AI, Aliens, Politics, Physics, Video Games, and Humanity | Lex Fridman Podcast #400",
        "link": "https://www.youtube.com/watch?v=JN3KPFbWCy8",
        "views": 8306214,
        "channel": {
          "id": "UCSHZKyawb77ixDdsGog4iWA",
          "title": "Lex Fridman",
          "link": "https://www.youtube.com/@lexfridman",
          "is_verified": true,
          "thumbnail": "https://yt3.ggpht.com/ytc/AIf8zZRPXFF1l1EPjxogHsozet1vHM_hPaiqWCkKI8cJCG0=s68-c-k-c0x00ffffff-no-rj"
        },
        "length": "2:16:47",
        "published_time": "3 months ago",
        "thumbnail": "https://yt3.ggpht.com/ytc/AIf8zZRPXFF1l1EPjxogHsozet1vHM_hPaiqWCkKI8cJCG0=s68-c-k-c0x00ffffff-no-rj"
      },
      ...
    ]
  }
}

Video & Channel

Video & Channel
GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=mBoX_JCKZTE
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "mBoX_JCKZTE"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "video": {
    "id": "rfscVS0vtbw",
    "title": "Learn Python - Full Course for Beginners [Tutorial]",
    "length_seconds": 16012,
    "views": 43187199,
    "likes": 1000000,
    "author": "freeCodeCamp.org",
    "category": "Education",
    "published_time": "Jul 11, 2018",
    "description": "This course will give you a full introduction into all of the core concepts in python. Follow along with the videos and you'll be a python programmer in no time!\n\nClick the ⚙️ to change to a dub track in Spanish, Arabic, or Portuguese, or Hindi. \n(Hindi dubbed via Melt Labs - https://www.withmelt.com/)\n\nWant more from Mike? He's starting a coding RPG/Bootcamp - https://simulator.dev/\n\n⭐️ Contents ⭐\n⌨️ (0:00) Introduction\n⌨️ (1:45) Installing Python & PyCharm\n⌨️ (6:40) Setup & Hello World\n⌨️ (10:23) Drawing a Shape\n⌨️ (15:06) Variables & Data Types\n⌨️ (27:03) Working With Strings\n⌨️ (38:18) Working With Numbers\n⌨️ (48:26) Getting Input From Users\n⌨️ (52:37) Building a Basic Calculator\n⌨️ (58:27) Mad Libs Game\n⌨️ (1:03:10) Lists\n⌨️ (1:10:44) List Functions\n⌨️ (1:18:57) Tuples\n⌨️ (1:24:15) Functions\n⌨️ (1:34:11) Return Statement\n⌨️ (1:40:06) If Statements\n⌨️ (1:54:07) If Statements & Comparisons\n⌨️ (2:00:37) Building a better Calculator\n⌨️ (2:07:17) Dictionaries\n⌨️ (2:14:13) While Loop\n⌨️ (2:20:21) Building a Guessing Game\n⌨️ (2:32:44) For Loops\n⌨️ (2:41:20) Exponent Function\n⌨️ (2:47:13) 2D Lists & Nested Loops\n⌨️ (2:52:41) Building a Translator\n⌨️ (3:00:18) Comments\n⌨️ (3:04:17) Try / Except\n⌨️ (3:12:41) Reading Files\n⌨️ (3:21:26) Writing to Files\n⌨️ (3:28:13) Modules & Pip\n⌨️ (3:43:56) Classes & Objects\n⌨️ (3:57:37) Building a Multiple Choice Quiz\n⌨️ (4:08:28) Object Functions\n⌨️ (4:12:37) Inheritance\n⌨️ (4:20:43) Python Interpreter\n\nCourse developed by Mike Dane. Check out his YouTube channel for more great programming courses: https://www.youtube.com/channel/UCvmINlrza7JHB1zkIOuXEbw\n\n🐦Follow Mike on Twitter - https://twitter.com/mike_dane\n\n🔗If you liked this video, Mike accepts donations on his website: https://www.mikedane.com/contribute/\n\n⭐️Other full courses by Mike Dane on our channel ⭐️\n💻C: https://youtu.be/KJgsSFOSQv0\n💻C++: https://youtu.be/vLnPwxZdW4Y\n💻SQL: https://youtu.be/HXV3zeQKqGY\n💻Ruby: https://youtu.be/t_ispmWmdjY\n💻PHP: https://youtu.be/OK_JCtrrv-c\n💻C#: https://youtu.be/GhQdlIFylQ8\n\n--\n\nLearn to code for free and get a developer job: https://www.freecodecamp.org\n\nRead hundreds of articles on programming: https://medium.freecodecamp.org",
    "keywords": [
      "python",
      "python tutorial",
      "python language",
      "python full course",
      "python course",
      "learn python",
      "learn python programming",
      "python tutorial for beginners",
      "python tutorial 2018",
      "python programming tutorial",
      "python programming language",
      "software development",
      "programming tutorial",
      "freecodecamp"
    ],
    "is_family_safe": true,
    "thumbnail": "https://i.ytimg.com/vi/rfscVS0vtbw/maxresdefault.jpg",
    "formats": [
      {
        "itag": 136,
        "mime_type": "video/mp4; codecs=\"avc1.4d401f\"",
        "bitrate": 889708,
        "width": 1280,
        "height": 720,
        "last_modified_unix": "1697291303745621",
        "last_modified": "2023-10-14 13:48:23 UTC",
        "content_length": "166424058",
        "quality": "hd720",
        "fps": 30,
        "quality_label": "720p",
        "projection_type": "RECTANGULAR"
      },
      ...
    ]
  },
  "channel": {
    "id": "UC8butISFwT-Wl7EV0hUK0BQ",
    "name": "freeCodeCamp.org",
    "link": "http://www.youtube.com/@freecodecamp",
    "subscribers": 9060000,
    "featured_channel": {
      "id": "UC8butISFwT-Wl7EV0hUK0BQ",
      "name": "freeCodeCamp.org",
      "link": "https://www.youtube.com/channel/UC8butISFwT-Wl7EV0hUK0BQ"
    },
    "thumbnail": "https://yt3.ggpht.com/ytc/AIf8zZTDkajQxPa4sjDOW-c3er1szXkSAO-H9TiF4-8u_Q=s176-c-k-c0x00ffffff-no-rj"
  }
}
Recommended Videos
GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=qiMcXzfm9Mg
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "qiMcXzfm9Mg"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "recommended_videos": {
    "videos": [
      {
        "position": 1,
        "id": "Y8oAFBLaSpc",
        "title": "Mozart | Requiem",
        "link": "https://www.youtube.com/watch?v=Y8oAFBLaSpc",
        "views": 1337464,
        "channel": {
          "id": "UC7blx1NmDfturiNHJtV9cHA",
          "title": "Crying Piano",
          "link": "https://www.youtube.com/@cryingPian0",
          "thumbnail": "https://yt3.ggpht.com/ytc/AIf8zZQtIhLGKhOSJIlmO4uojbqXLMLR6WUccuDp7V6L=s68-c-k-c0x00ffffff-no-rj"
        },
        "length": "52:00",
        "published_time": "1 year ago",
        "thumbnail": "https://yt3.ggpht.com/ytc/AIf8zZQtIhLGKhOSJIlmO4uojbqXLMLR6WUccuDp7V6L=s68-c-k-c0x00ffffff-no-rj"
      },
      ...
    ],
    "playlists": [
      {
        "position": 14,
        "id": "RDqiMcXzfm9Mg",
        "title": "Mix - Mozart- Requiem In D Minor, K 626 - Requiem",
        "link": "https://www.youtube.com/playlist?list=RDqiMcXzfm9Mg",
        "video_count": 50,
        "description": "Antonio Vivaldi, Franz Schubert, Bavarian Radio Symphony Orchestra, and more",
        "thumbnail": "https://i.ytimg.com/vi/qiMcXzfm9Mg/hqdefault.jpg?sqp=-oaymwEwCKgBEF5IWvKriqkDIwgBFQAAiEIYAfABAfgB_gSAAuADigIMCAAQARh_IC8oEzAP&rs=AOn4CLCKP9afD3RYCmLeZhuBslF3qctMmA"
      }
    ]
  }
}

Merchant Items

Merchant Items
GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=krsBRQbOPQ4
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "krsBRQbOPQ4"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "merchant_items": [
    {
      "title": "Milk Chocolate",
      "link": "https://feastables.com/products/milk-chocolate?variant=48735276433568&currency=USD&utm_campaign=sag_organic&srsltid=AfmBOopcpXHMDE5F6IzhpCh6Giy6tRMaSfGDbnwcq1DyNS9a_v5HAgISGxo&utm_term=UCX6OQ3DkcsbYNE6H8uQQuVA&utm_medium=product_shelf&utm_source=youtube&utm_content=YT-APM2gMCDdXQUgS4S3sJbCOvqPPjv8F6Znl_Rpnexn3o5ty1BbztbSQwy9IxzZR3CJe2UXKOEqRTRvrDwe-3GOCL59erHJExqbzW8MM9ugBj3t59_Sik3Eh854hY54_DbAVA2K1iGannoYPZeIgKLHiFhcs8PKDHeadVttQxcfMNYs96DJFDI",
      "description": "Tastes like a glass of chocolate milk A burst of velvety chocolate texture Deliciously creamy Simple ingredients! Perfect ratio of sweetness and cocoa",
      "price": "$29.99",
      "extracted_price": 29.99,
      "seller": "Feastables",
      "availability": "Out of stock",
      "thumbnail": "https://encrypted-tbn2.gstatic.com/shopping?q=tbn:ANd9GcQn76pJa2nmqheo23Zpffz9MyWsNAEs26rfFVk_S6P5PMGRiVZFuVmJE01T61HhskVxX-co6twF"
    },
    {
      "title": "MRBEAST FOOTBALL - NOLAN EDITION",
      "link": "https://mrbeast.store/products/mrbeast-football-blue?variant=44559847260287&currency=USD&utm_campaign=sag_organic&srsltid=AfmBOorbP2xtk38CptZzw4or-gUn5X9XHvBscFf2orSV27UuBsbVGIoNNoY&utm_term=UCX6OQ3DkcsbYNE6H8uQQuVA&utm_medium=product_shelf&utm_source=youtube&utm_content=YT-APM2gMAn9tBL41DG1r52G3EGyd-4rcDVkF2VmzN9sI14uvFTdCPvn7SiC33KIg03oxOSvPvXDJzP9CfIB1xCOmflqrgslzJZQAXLs1z7WbkV9087sZOeHIhBQuzrmvXQ8sA1O1Ipuojs5YCOSWBPctTmPbhpdtZqjNWBtVuNc0a2nB_mIqbZ",
      "description": "Premium composite football with custom MrBeast branding and colors. Available in Blue to vote for Nolan and Pink to vote for Karl, whoever's football sells the most by 12:00pm (EST) Sun, Feb 11 2024, gets to go to the Super Bowl with Jimmy. The loser gets buried alive. Get it for $10 from 12:00pm (EST) Sat, Feb 10 2024 - 12:00pm (EST) Sun, Feb 11 2024, only!NOTE: Starts shipping Mon, Feb 19 2024 Details Size 7 Authentic MrBeast merchandise from MrBeast.Store High Quality Composite Material Double Lacing System Debossed MrBeast Branding Ships Deflated (Pump Included) Imported Make The World A Better Place",
      "price": "$25.00",
      "extracted_price": 25,
      "seller": "MrBeast.store",
      "thumbnail": "https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcQ0__1gDWU7FL3upJC3GNNYvxzni_UebrnlH3GRjqm0BW3JYEsmaHfXYSHsXRJPVy2-__TmyqcX"
    },
    ...
  ]
}

Chapters

Chapters
GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=rfscVS0vtbw
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "rfscVS0vtbw"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "chapters": [
    {
      "title": "Part 1 - Scrapy & Course Introduction",
      "timestamp": "0:00",
      "thumbnail": "https://i.ytimg.com/vi/mBoX_JCKZTE/hqdefault_13266.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLBJJYMzzidudIoYqa3zewb6w3WUng"
    },
    {
      "title": "Part 2 - Setup Virtual Env & Scrapy",
      "timestamp": "8:22",
      "thumbnail": "https://i.ytimg.com/vi/mBoX_JCKZTE/hqdefault_502333.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLCxMaRDdwL6LWVFt52DFuoRhcMmbw"
    },
    ...
  ]
}

Key Moments

Key Moments
GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=G2fqAlgmoPo
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "G2fqAlgmoPo"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "key_moments": [
    {
      "title": "Hallucinations",
      "start_seconds": 854,
      "thumbnail": "https://i.ytimg.com/vi/G2fqAlgmoPo/hqdefault_859000.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLB3r_4bANLNZV2sOWZeTw6v78aS2w"
    },
    {
      "title": "Model Types",
      "start_seconds": 928,
      "thumbnail": "https://i.ytimg.com/vi/G2fqAlgmoPo/hqdefault_945000.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLCQS1z1Bl_r3CSBoYaxM_h6j88f4A"
    },
    {
      "title": "Bard code generation",
      "start_seconds": 1115,
      "thumbnail": "https://i.ytimg.com/vi/G2fqAlgmoPo/hqdefault_1123000.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLBIbdg2q_nXmCFETQtBNMj2WOzRKA"
    }
  ]
}

Context

Context

Context panels are a feature implemented to provide users with reliable background information on topics susceptible to misinformation, such as the moon landing. These panels appear at the top of search results or beneath videos related to such topics.

They offer basic facts sourced from independent, third-party partners, improving the context around the subject matter. Additionally, these panels include links to the websites of the third-party partners for users seeking further details.

It's important to note that information panels are displayed irrespective of the opinions or viewpoints presented in a video. However, their availability may vary across different countries, regions, and languages.

GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=BEWz4SXfyCQ
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "BEWz4SXfyCQ"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "context": {
    "title": "Area 51",
    "link": "https://www.britannica.com/place/Area-51",
    "source": "Encyclopedia Britannica",
    "snippet": "Area 51, secret U.S. Air Force military installation located at Groom Lake in southern Nevada. It is administered by Edwards Air Force Base in southern California. The installation has been the focus of numerous conspiracies involving extraterrestrial life, though its only confirmed use is as a flight testing facility. For years there was speculation about the installation, especially amid growing reports of UFO sightings in the vicinity. The site became known as Area 51, which was its designation on maps of the Atomic Energy Commission. Conspiracy theories gained support in the late 1980s, when a man alleging to have worked at the installation claimed that the government was examining recovered alien spacecraft.",
    "thumbnail": "https://www.gstatic.com/youtube/img/information_panels/Area_51-EB.png"
  }
}

Available Transcripts Languages

Available Transcripts Languages

The available_transcripts_languages key provides lang values, which are used in the YouTube Transcripts API to retrieve video transcripts in the chosen language.

GET
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=tnTPaLOaHz8
Request
import requests

url = "https://www.searchapi.io/api/v1/search"
params = {
  "engine": "youtube_video",
  "video_id": "tnTPaLOaHz8"
}

response = requests.get(url, params = params)
print(response.text)
Response
{
  "available_transcripts_languages": [
    {
      "name": "Arabic",
      "lang": "ar"
    },
    {
      "name": "Bangla",
      "lang": "bn"
    },
    {
      "name": "Chinese (Traditional)",
      "lang": "zh-Hant"
    },
    {
      "name": "English",
      "lang": "en"
    },
    {
      "name": "English (auto-generated)",
      "lang": "en"
    },
    {
      "name": "French",
      "lang": "fr"
    },
    ...
  ]
}