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/search?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 YouTubegl
countries.
-
- Name
-
hl
- Required
- Optional
- Description
-
The default parameter
en
defines the interface language of the search. Check the full list of supported YouTubehl
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
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=RcYjXbSJBN8
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"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",
...
],
"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
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=mBoX_JCKZTE
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"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...",
"keywords": [
"python",
...
],
"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
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=qiMcXzfm9Mg
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"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
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=krsBRQbOPQ4
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"merchant_items": [
{
"title": "Milk Chocolate",
"link": "https://feastables.com/products/milk-chocolate?variant=48735276433568¤cy=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"
},
...
]
}
Chapters
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=rfscVS0vtbw
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"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"
},
...
]
}
Key Moments
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=G2fqAlgmoPo
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"key_moments": [
{
"title": "Hallucinations",
"start_seconds": 854,
"thumbnail": "https://i.ytimg.com/vi/G2fqAlgmoPo/hqdefault_859000.jpg?sqp=-oaymwEjCNACELwBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLB3r_4bANLNZV2sOWZeTw6v78aS2w"
},
...
]
}
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.
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=BEWz4SXfyCQ
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"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 ...",
"thumbnail": "https://www.gstatic.com/youtube/img/information_panels/Area_51-EB.png"
}
}
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.
https://www.searchapi.io/api/v1/search?engine=youtube_video&video_id=tnTPaLOaHz8
- Python
- Node
- Ruby
- Java
- Go
- PHP
- Bash
- R
- Kotlin
- Swift
- C#
- C
- C++
- requests
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)
{
"available_transcripts_languages": [
{
"name": "Arabic",
"lang": "ar"
},
...
]
}