# YouTube search: `POST /v1/youtube/search`

Cost: 2 credits (2 (an empty answer and failed requests are free)). Docs: https://scrapercompany.com/docs/reference/youtube-search

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

`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 body (JSON):

- `q` (string; required; min length 1, max length 500): Search query, as typed in YouTube's box.
- `page_token` (string | null; optional; max length 4000): `next_page_token` from the previous answer of this route. It carries the query and the filters/sort, so send it alone (with `q` for search).
- `type` (string | null; optional; one of video, channel, playlist, movie, shorts): Result type filter (YouTube's Type menu). Omit for the mixed page.
- `upload_date` (string | null; optional; one of hour, today, week, month, year): Upload date filter. `today`/`week`/`month`/`year` are YouTube's menu values; `hour` is no longer in the menu but was verified to filter.
- `duration` (string | null; optional; one of short, medium, long): Length filter, YouTube's buckets: `short` under 3 minutes, `medium` 3-20 minutes, `long` over 20 minutes.
- `features` (array of string; optional; max items 11): Feature filters (YouTube's Features menu), combined with AND. `subtitles` keeps videos with creator captions.
- `sort` (string | null; optional; one of relevance, popularity): YouTube's Prioritize menu: `relevance` (the default) or `popularity` (most viewed first). Upload-date and rating sorts are no longer honoured by YouTube and are refused.
- `sp` (string | null; optional; max length 200): Raw `sp=` value copied from a YouTube search URL, instead of `type`/`upload_date`/`duration`/`features`/`sort`.
- `hl` (string; optional; default en; pattern ^[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; optional; default US; pattern ^[A-Za-z]{2}$): Content country (`gl`), two letters.

Base URL: `https://api.scrapercompany.com`. Auth: send your key in the `x-api-key` header. A failed request (4xx or 5xx) or an empty result costs 0 credits.

- [Full API reference as one Markdown file](https://scrapercompany.com/llms-full.txt)
- [OpenAPI spec](https://scrapercompany.com/openapi.json)
