YouTube search
One page (~20 rows) of YouTube search results, split by kind.
https://api.scrapercompany.com/v1/youtube/searchvideos carry the id, title, channel (id, handle, verified badge), exact views when YouTube prints them exactly (views_text always, verbatim), the relative published_time verbatim, length and length_seconds, the description snippet and YouTube's badges ("4K", "CC", "LIVE", "New") verbatim; live rows carry watching. shorts, channels and playlists (incl. courses) come in their own arrays. Anything else on the page — ads, shelves, promos — is counted in skipped_items by kind, never mixed in. Filters are encoded as YouTube's own sp; next_page_token pages on (send it with q only). An empty page is not charged.
Request
Send POST https://api.scrapercompany.com/v1/youtube/search 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.
- q string required min length 1, max length 500
Search query, as typed in YouTube's box.
- page_token string | null max length 4000
next_page_tokenfrom the previous answer of this route. It carries the query and the filters/sort, so send it alone (withqfor search). - type string | null
Result type filter (YouTube's Type menu). Omit for the mixed page.
One of
videochannelplaylistmovieshorts - upload_date string | null
Upload date filter.
today/week/month/yearare YouTube's menu values;houris no longer in the menu but was verified to filter.One of
hourtodayweekmonthyear - duration string | null
Length filter, YouTube's buckets:
shortunder 3 minutes,medium3-20 minutes,longover 20 minutes.One of
shortmediumlong - features array of string max items 11
Feature filters (YouTube's Features menu), combined with AND.
subtitleskeeps videos with creator captions. - sort string | null
YouTube's Prioritize menu:
relevance(the default) orpopularity(most viewed first). Upload-date and rating sorts are no longer honoured by YouTube and are refused.One of
relevancepopularity - sp string | null max length 200
Raw
sp=value copied from a YouTube search URL, instead oftype/upload_date/duration/features/sort. - 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/search" \
-H "x-api-key: $SCRAPERCOMPANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"q": "python tutorial"
}'Response
200 — One page of YouTube results, split by kind. Metered responses carry x-credits-charged and x-credits-remaining headers (see credit headers).
{
"search_parameters": {
"engine": "youtube",
"q": "python tutorial",
"hl": "en",
"gl": "US"
},
"search_information": {
"estimated_results": 11103091,
"total": 4
},
"videos": [
{
"position": 1,
"video_id": "ix9cRaBkVe0",
"title": "Python Full Course for free 🐍",
"link": "https://www.youtube.com/watch?v=ix9cRaBkVe0",
"channel": {
"name": "Bro Code",
"id": "UC4SVo0Ue36XCfOyb5Lh1viQ",
"handle": "@BroCodez",
"link": "https://www.youtube.com/@BroCodez",
"verified": true,
"thumbnail": "https://yt3.ggpht.com/ytc/AIdro_mPFVsxROj1dOtTWc9iNBwDYV4z42Q8LPokBSewiW9pCSg=s68-c-k-c0x00ffffff-no-rj"
},
"views": 12753881,
"views_text": "12,753,881 views",
"published_time": "2 years ago",
"length": "12:00:00",
"length_seconds": 43200,
"description": "python #tutorial #beginners Python tutorial for beginners' full course 2024 *Learn Python in 1 HOUR* ...",
"badges": [
"Fundraiser"
],
"is_live": false,
"thumbnail": "https://i.ytimg.com/vi/ix9cRaBkVe0/hq720.jpg?sqp=-oaymwEnCNAFEJQDSFryq4qpAxkIARUAAIhCGAHYAQHiAQoIGBACGAY4AUAB&rs=AOn4CLDsLPZCX5PFS2a-Wng9IwGAduPqOQ"
}
],
"shorts": [
{
"position": 1,
"video_id": "nluUYtejoIE",
"title": "Python Basics: Your FIRST Program in Under a Minute! 🚀",
"link": "https://www.youtube.com/shorts/nluUYtejoIE",
"views_text": "1.7M views",
"thumbnail": "https://i.ytimg.com/vi/nluUYtejoIE/oar2.jpg?sqp=-oaymwEoCJUDENAFSFqQAgHyq4qpAxcIARUAAIhC2AEB4gEKCBgQAhgGOAFAAQ==&rs=AOn4CLCuNV89Mvv4RG_YBfH0wDDrB1zpPg&usqp=CCk"
}
],
"channels": [
{
"position": 1,
"channel_id": "UCKQdc0-Targ4nDIAUrlfKiA",
"title": "Python Simplified",
"handle": "@PythonSimplified",
"link": "https://www.youtube.com/@PythonSimplified",
"subscribers_text": "286K subscribers",
"description": "Hi everyone! My name is Mariya and I'm a software developer recently moved to Sofia, Bulgaria. I film programming tutorials about ...",
"verified": true,
"thumbnail": "https://yt3.googleusercontent.com/ytc/AIdro_ngt_N86CG1gQ576UmAbpFyxnCZddjPWzzKXzTfxljsZkM=s176-c-k-c0x00ffffff-no-rj-mo"
}
],
"playlists": [
{
"position": 1,
"playlist_id": "PLGjplNEQ1it8-0CmoljS5yeV-GlKSUEt0",
"title": "Python Language Full Course (2026)",
"link": "https://www.youtube.com/playlist?list=PLGjplNEQ1it8-0CmoljS5yeV-GlKSUEt0",
"kind": "course",
"label": "Course",
"channel": {
"name": "Shradha Khapra",
"id": "UC1XBh-m27kkgwLAwu_SRJBg",
"handle": "@shradhaKD",
"link": "https://www.youtube.com/@shradhaKD",
"verified": false
},
"video_count_text": "9 lessons",
"first_video_id": "t2_Q2BRzeEE",
"thumbnail": "https://i.ytimg.com/vi/t2_Q2BRzeEE/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBm5_nQyrAnm5zyJ2FBA9l3BKyzMA"
}
],
"skipped_items": {},
"next_page_token": "EroDEg9weXRob24gdHV0b3JpYWwapgNTQlNDQVF0cGVE…",
"meta": {
"source": "youtube",
"elapsed_s": 0.77
}
}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 |
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 and failed requests are free)). Failed, blocked and empty results are free.