ScraperCompany · APIs · Pricing · Docs · llms.txt · Get an API key

YouTube

YouTube search

One page (~20 rows) of YouTube search results, split by kind.

POST https://api.scrapercompany.com/v1/youtube/search
2 credits Try it YouTube API overview →2 (an empty answer and failed requests are free)

videos 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.

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

200 response
{
  "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.

StatusMeaningRetry?
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 enforce (mode in GET /v1/billing) and the request costs more than the available credits. Nothing is run or charged.

{"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 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
429 Too Many Requests

Too many requests: the key's requests-per-minute limit was exceeded, or (in enforce credits mode) 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
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.

  1. Export your key: export SCRAPERCOMPANY_API_KEY=sk_... (no key yet? start a free trial).
  2. 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.