> Documentation index: https://docs.scrapier.io/llms.txt
> Auth: header `X-API-Key: <key>` · Base: https://api.scrapier.io/api/v2 · Synchronous; paginate with `cursor` ← `data.next_cursor`.

# YouTube Search

Structured YouTube data: send `queries`. Cursor-paginated, 2 credits per successful call.

`GET|POST https://api.scrapier.io/api/v2/youtube-search-full/` · 2 credits per successful call · Cursor-paginated

## Overview

Call `GET /api/v2/youtube-search-full/` with `queries`. The results are in `data.items`; send `data.next_cursor` back as `cursor` to get the next page. 18 optional parameters refine the call (see Parameters).

## Request

```bash
curl -G "https://api.scrapier.io/api/v2/youtube-search-full/" \
  -H "X-API-Key: YOUR_API_KEY" \
  --data-urlencode "queries=fitness" \
  --max-time 210
```

```python
import requests

resp = requests.get(
    "https://api.scrapier.io/api/v2/youtube-search-full/",
    headers={"X-API-Key": "YOUR_API_KEY"},
    params={"queries": "fitness"},
    timeout=210,
)
body = resp.json()
if not resp.ok:
    raise RuntimeError(body.get("error") or body.get("detail"))

print(body["data"]["items"])
```

POST with a JSON body works too (same parameters; the body is merged over the query string).

## Parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `X-API-Key` (header) | string | yes | — | Your API key. |
| `queries` | string | yes | e.g. `fitness` | Search term. Required on first call; ignored when `cursor` is supplied. |
| `cursor` | string | no | — | Pagination cursor returned in the previous response's `next_cursor`. Pass it back unchanged to fetch the next page. When `next_cursor` is null, you have reached the last page. |
| `max_results_video` | integer | no | `20` | Max regular videos returned per page (0 = exclude). One page = one native YouTube search page (~20 videos). Locked into the cursor. |
| `max_results_shorts` | integer | no | `10` | Max shorts returned per page (0 = exclude; videos=0 + shorts>0 switches to YouTube's Shorts-only search). Locked into the cursor. |
| `max_results_streams` | integer | no | `0` | Max currently-live streams per page (0 = exclude). Locked into the cursor. |
| `sort_by` | string | no | `relevance` | Sort order: relevance \| upload_date \| view_count \| rating (applied server-side by YouTube) |
| `upload_date` | string | no | — | Upload-date filter: hour \| today \| week \| month \| year (empty = any time) |
| `duration` | string | no | — | Duration filter: short (<4 min) \| medium (4-20 min) \| long (>20 min) (empty = any) |
| `country` | string | no | `US` | Result region (2-letter country code, YouTube `gl`) |
| `language` | string | no | `en` | Interface language for result texts (YouTube `hl`, e.g. en, es, de) |
| `download_subtitles` | boolean | no | `false` | Fetch the transcript + caption language list for each video (true/false). Best-effort within the per-call time budget; rows always carry details first |
| `subtitles_language` | string | no | `en` | Preferred transcript language code (e.g. "en", "es", "fr"); falls back to an auto-translation or the original track |
| `subtitles_format` | string | no | `srt` | Transcript format: srt \| text \| timestamp (JSON list of {start, duration, text}) |
| `fetch_metadata` | boolean | no | `true` | Enrich each video with exact likes, full description, tags, category, publish date, subscribers and comment count (true/false) |
| `fetch_shorts_stats` | boolean | no | `false` | Fetch subscribers + comment count for shorts too (default false: skips an extra ~22KB upstream request per short; set true to include them; videos always get them when fetch_metadata is true) |
| `isHD` | boolean | no | `false` | Filter: HD only (server-side YouTube filter) |
| `is4K` | boolean | no | `false` | Filter: 4K only (server-side YouTube filter) |
| `isLive` | boolean | no | `false` | Filter: live streams only (server-side; enables streams automatically) |
| `hasSubtitles` | boolean | no | `false` | Filter: videos with subtitles/CC only (server-side YouTube filter) |
| `use_proxy` | boolean | no | `true` | Route the request through Scrapier's residential proxy pool. Default: `true`. Leave as is unless support tells you otherwise. |
| `raw_data` | boolean | no | `false` | When true, the response carries the full raw upstream payload(s) the scraper received (GraphQL / JSON API bodies, HTML, embedded JSON-LD -- exactly as the platform returned them) under `raw_responses`, in place of the formatted items. When false (default) you get the formatted output. Pagination (`cursor` / `next_cursor`) works the same in both modes. |

## Response

HTTP 200. Results are in `data.items`. Sample from the live catalog, arrays trimmed to 3 items.

```json
{
  "success": true,
  "data": {
    "queries": "fitness",
    "page": 1,
    "page_size": 1,
    "items": [
      {
        "title": "30-minute fitness workout",
        "translatedTitle": null,
        "type": "video",
        "id": "dQw4w9WgXcQ",
        "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
        "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hq720.jpg",
        "viewCount": 1240000,
        "date": "2026-11-10T08:00:00.000Z",
        "likes": 38018,
        "location": null,
        "channelName": "Example Fitness",
        "channelUrl": "https://www.youtube.com/@examplefitness",
        "channelUsername": "examplefitness",
        "collaborators": null,
        "channelId": "UCuudpdbKmQWq2PPzYgVCWlA",
        "numberOfSubscribers": 367000,
        "duration": "00:30:20",
        "commentsCount": 968,
        "text": "Full 30-minute session, no equipment needed. #fitness",
        "translatedText": null,
        "descriptionLinks": [
          {
            "url": "https://www.youtube.com/hashtag/fitness",
            "text": "#fitness"
          }
        ],
        "subtitles": [
          "en"
        ],
        "transcript": "1\n00:00:00,240 --> 00:00:03,840\nWelcome to today's workout\n",
        "transcriptLanguage": "en",
        "transcriptFormat": "srt",
        "order": 1,
        "commentsTurnedOff": false,
        "fromYTUrl": "https://www.youtube.com/results?search_query=fitness",
        "isMonetized": null,
        "hashtags": [
          "#fitness"
        ],
        "isLive": false,
        "isLiveContent": false,
        "isFamilySafe": true,
        "tags": [
          "workout",
          "home workout"
        ],
        "videoCategory": "Sports",
        "details_fetched": true,
        "keyword": "fitness",
        "scraped_at": "2026-12-01T12:00:00.000Z",
        "video_id": "dQw4w9WgXcQ",
        "category": "video",
        "channel_name": "Example Fitness",
        "view_count": 1240000,
        "duration_seconds": 1820,
        "published_at": "2026-11-10T08:00:00.000Z",
        "input_query": "fitness"
      }
    ],
    "next_cursor": "eNo1jt1qwzAMhd9F11k3SNlF7_YAexEhjOXETvwT2VaSjb77lMHgcD7O0eHA_QWeoxYxH8Twnf..."
  }
}
```

## Response fields

| Field | Type | Example | Description |
|---|---|---|---|
| `queries` | string | `fitness` |  |
| `page` | integer | `1` |  |
| `page_size` | integer | `1` |  |
| `items` | array | `[1 item]` | The results. |
| `next_cursor` | string | `eNo1jt1qwzAMhd9F11k3SNlF7_YAexEhjOXETvwT2VaSj…` | Pass back as `cursor` for the next page. `null` on the last page. |
| `items[].title` | string | `30-minute fitness workout` |  |
| `items[].translatedTitle` | null | `null` |  |
| `items[].type` | string | `video` |  |
| `items[].id` | string | `dQw4w9WgXcQ` |  |
| `items[].url` | string | `https://www.youtube.com/watch?v=dQw4w9WgXcQ` |  |
| `items[].thumbnailUrl` | string | `https://i.ytimg.com/vi/dQw4w9WgXcQ/hq720.jpg` |  |
| `items[].viewCount` | integer | `1240000` |  |
| `items[].date` | string | `2026-11-10T08:00:00.000Z` |  |
| `items[].likes` | integer | `38018` |  |
| `items[].location` | null | `null` |  |
| `items[].channelName` | string | `Example Fitness` |  |
| `items[].channelUrl` | string | `https://www.youtube.com/@examplefitness` |  |
| `items[].channelUsername` | string | `examplefitness` |  |
| `items[].collaborators` | null | `null` |  |
| `items[].channelId` | string | `UCuudpdbKmQWq2PPzYgVCWlA` |  |
| `items[].numberOfSubscribers` | integer | `367000` |  |
| `items[].duration` | string | `00:30:20` |  |
| `items[].commentsCount` | integer | `968` |  |
| `items[].text` | string | `Full 30-minute session, no equipment needed. …` |  |
| `items[].translatedText` | null | `null` |  |
| `items[].descriptionLinks` | array | `[1 item]` |  |
| `items[].subtitles` | array | `[1 item]` |  |
| `items[].transcript` | string | `1 00:00:00,240 --> 00:00:03,840 Welcome to to…` |  |
| `items[].transcriptLanguage` | string | `en` |  |
| `items[].transcriptFormat` | string | `srt` |  |
| `items[].order` | integer | `1` |  |
| `items[].commentsTurnedOff` | boolean | `false` |  |
| `items[].fromYTUrl` | string | `https://www.youtube.com/results?search_query=…` |  |
| `items[].isMonetized` | null | `null` |  |
| `items[].hashtags` | array | `[1 item]` |  |
| `items[].isLive` | boolean | `false` |  |
| `items[].isLiveContent` | boolean | `false` |  |
| `items[].isFamilySafe` | boolean | `true` |  |
| `items[].tags` | array | `[2 items]` |  |
| `items[].videoCategory` | string | `Sports` |  |
| `items[].details_fetched` | boolean | `true` |  |
| `items[].keyword` | string | `fitness` |  |
| `items[].scraped_at` | string | `2026-12-01T12:00:00.000Z` |  |
| `items[].video_id` | string | `dQw4w9WgXcQ` |  |
| `items[].category` | string | `video` |  |
| `items[].channel_name` | string | `Example Fitness` |  |
| `items[].view_count` | integer | `1240000` |  |
| `items[].duration_seconds` | integer | `1820` |  |
| `items[].published_at` | string | `2026-11-10T08:00:00.000Z` |  |
| `items[].input_query` | string | `fitness` |  |

## Pagination

Pass `data.next_cursor` back as `cursor` until it is `null`. Required inputs are ignored once a cursor is sent. Each page is one billed call.

```python
import requests

URL = "https://api.scrapier.io/api/v2/youtube-search-full/"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
params = {"queries": "fitness"}
items = []

for _ in range(10):  # each page is one billed call
    resp = requests.get(URL, headers=HEADERS, params=params, timeout=210)
    resp.raise_for_status()
    data = resp.json()["data"]
    items.extend(data.get("items") or [])
    if not data.get("next_cursor"):  # None = last page
        break
    params = {"cursor": data["next_cursor"]}
```

## Errors

Failed calls are free. Branch on HTTP status; the message is in `error` (or `detail`). See https://docs.scrapier.io/errors.md

- **400** Bad input. The exact message varies by endpoint. `{"success":false,"error":"…"}`
- **402** Balance below the endpoint's price. `{"error":"Insufficient credits. Buy more to scrape more.","balance":1,"required":2}`
- **403** Invalid or unknown API key. `{"detail":"Authentication service unavailable or invalid API key."}`
- **429** Throttled — wait for Retry-After. `{"detail":"Request was throttled. Expected available in N seconds."}`
- **404** unknown slug · **503** busy (retry after `Retry-After`) · **5xx** upstream failure or timeout (retry with backoff).

## Notes

- Nothing special: send the inputs, read the result.

## Related

- [YouTube Channel Info](https://docs.scrapier.io/api-reference/youtube/youtube-channel-info.md): Structured YouTube data: send `urls`. Single lookup, 1 credit per successful call.
- [YouTube Channel Live/Streams](https://docs.scrapier.io/api-reference/youtube/youtube-channel-live.md): Structured YouTube data: send `channels`. Cursor-paginated, 1 credit per successful call.
- [YouTube Channel Video Scraper](https://docs.scrapier.io/api-reference/youtube/youtube-channel-video-scraper.md): Structured YouTube data: send `youtube_channels`. Cursor-paginated, 1 credit per successful call.
- [YouTube Comment Replies](https://docs.scrapier.io/api-reference/youtube/youtube-comment-replies.md): Structured YouTube data: send `continuation_tokens`. Cursor-paginated, 1 credit per successful call.
