API reference · Social media
YouTube Search
Search YouTube videos, Shorts, and creator channels with query and region parameters.
Example
curl -X POST 'https://api.serpbase.dev/youtube/search' \
-H "Content-Type: application/json" \
-H 'X-API-Key: YOUR_API_KEY' \
--max-time 60 \
-d '{"gl":"us","q":"nextjs tutorial"}'{
"status": 0,
"credits_charged": 1,
"request_id": "r-4b27fe8a36d9ac303a5da7dd",
"product_id": "youtube_search",
"query": "nextjs tutorial",
"action": "search",
"pagination": {
"has_more": true,
"next_cursor": "EpkEEg9uZXh0anMgdHV0b3JpYWwaggRTQlNDQVF0NGJrOTNUMEpaWVVFemQ0SUJDMU5yYkdOZlpsRkNiV056Z2dFTFdsWnVhazlR…"
},
"source": "youtube",
"url": "https://www.youtube.com/results?gl=US&search_query=nextjs+tutorial",
"videos": [
{
"badges": [
"4K"
],
"channel": {
"id": "UC8S4rDRZn6Z_StJ-hh7ph8g",
"image_url": "https://yt3.ggpht.com/Qizn_VAgeCADuMk0RhVQ11j_9TWKrtQ1ifDGo5Yomj4Kjx29OgnHuZc6dQds5jztNlk3LAt6NA=s68…",
"link": "https://www.youtube.com/channel/UC8S4rDRZn6Z_StJ-hh7ph8g",
"title": "PedroTech",
"url": "https://www.youtube.com/channel/UC8S4rDRZn6Z_StJ-hh7ph8g",
"verified": true
},
"description": "If you know react, but don't know what NextJS is, this is the video for you. NextJS offers a variety…",
"duration": "7:35",
"id": "xnOwOBYaA3w",
"link": "https://www.youtube.com/watch?v=xnOwOBYaA3w",
"media": [
{
"type": "thumbnail",
"url": "https://i.ytimg.com/vi/xnOwOBYaA3w/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs…"
}
],
"published_at": "1y ago",
"title": "Learn NextJS in 7 Minutes",
"url": "https://www.youtube.com/watch?v=xnOwOBYaA3w",
"views_count": "301453"
},
{
"badges": [
"4K"
],
"channel": {
"id": "UCsBjURrPoezykLs9EqgamOA",
"image_url": "https://yt3.ggpht.com/3fPNbkf_xPyCleq77ZhcxyeorY97NtMHVNUbaAON_RBDH9ydL4hJkjxC8x_4mpuopkB8oI7Ct6Y=s6…",
"link": "https://www.youtube.com/channel/UCsBjURrPoezykLs9EqgamOA",
"title": "Fireship",
"url": "https://www.youtube.com/channel/UCsBjURrPoezykLs9EqgamOA",
"verified": true
},
"description": "Learn the basics of Next.js in 100 Seconds! Then build your first server-rendered react app with a f…",
"duration": "11:52",
"id": "Sklc_fQBmcs",
"link": "https://www.youtube.com/watch?v=Sklc_fQBmcs",
"media": [
{
"type": "thumbnail",
"url": "https://i.ytimg.com/vi/Sklc_fQBmcs/hq720.jpg?sqp=-oaymwEcCNAFEJQDSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs…"
}
],
"published_at": "5y ago",
"title": "Next.js in 100 Seconds // Plus Full Beginner's Tutorial",
"url": "https://www.youtube.com/watch?v=Sklc_fQBmcs",
"views_count": "1541058"
}
]
}Parameters
formatMore
markdown returns the same result as Markdown text (text/markdown) for language models: no envelope, no duplicate alias fields, no inline images. Same credits; failures keep the JSON envelope.
glqcountryMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
cursorMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
deviceMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
hlMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
htmlMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
languageMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
limitMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
markdownMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
mobileMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
numMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
pageMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
search_queryMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
spMore
Use one spelling at a time; the API validates the parameters and values supported by this product.
The sample shows example parameters, not the complete request contract. Known fields are validated by the API; additional parameters are allowed.
What comes back
The fields are those in the response above; every endpoint also carries status, credits_charged and request_id.
If it fails
A failed request has a non-zero status and an error, and is not charged. The ones you will see here:
1000A parameter is missing or wrongFix the request1020No credits leftTop up1029Over your requests per secondWait Retry-After seconds1502 · 1504The source could not be read this timeRetry