---
title: "YouTube Search API"
method: GET
path: "/v1/youtube/search"
tags: ["YouTube"]
---

# YouTube Search API

`GET /v1/youtube/search`

## Request

- Base URL: `https://api.captapi.com`
- URL: `https://api.captapi.com/v1/youtube/search`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

YouTube search with cursor pagination — typed hits, ids, canonical URLs, filters (2 credits/page, 0 when a page finds nothing).

Search YouTube by keyword and get a cursor-paginated page of clean JSON: results[] with type (video|short|channel|playlist|live), id, canonical url, title, publishedTimeApprox + publishedTimeIsApproximate + publishedTimeText, viewCount + viewCountText + viewCountIsApproximate, durationSeconds, thumbnailUrl, channel{id,title,handle,url,thumbnail}, badges[], and subscriberCount on channel hits. Typed arrays videos[] / shorts[] / channels[] / playlists[] / lives[] / shelves[] are disjoint partitions of results (a live is only in lives[], never also in videos[]) — Σ typed === results.length. Filter with type, sortBy, uploadDate, duration, region. Pass nextCursor as cursor for the next page. Flat 2 credits per page; a page with no results costs 0.

Docs: https://captapi.com/apis/youtube-search

## Query parameters

- `q` string, required
- `limit` integer
- `cursor` string
- `type` 'all' | 'videos' | 'shorts' | 'channels' | 'playlists' | 'video' | 'channel' | 'playlist' | 'short' | 'movie' | 'movies'
- `sortBy` 'relevance' | 'date' | 'views' | 'rating' | 'popular'
- `uploadDate` 'any' | 'today' | 'this_week' | 'this_month' | 'this_year' | 'hour' | 'week' | 'month' | 'year'
- `duration` 'any' | 'under_4' | '4_20' | 'over_20' | 'short' | 'medium' | 'long'
- `region` string
- `cache` boolean

## Response `200`

Success. The data object for this endpoint.

- object
  - `success` unknown, required
  - `data` object, required
    - `query` string: The search query you sent.
    - `totalReturned` integer: Number of items returned in this response.
    - `nextCursor` string: Cursor to pass for the next page of results. May be null when the platform does not expose deep pagination (e.g. some Facebook Ad Library searches).
    - `hasMore` boolean: Whether more results are available beyond this page. When true, pass nextCursor to fetch the next page.
    - `results` object[]
      - `type` string: Content type of the item.
      - `id` string: Id of this results item.
      - `url` string: Canonical URL of the item.
      - `title` string: Title of this results item.
      - `publishedAt` string: Publish time as ISO-8601 when YouTube exposes an absolute timestamp; approximate when derived from a relative label — see publishedTimeText.
      - `viewCount` integer: View count.
      - `durationSeconds` integer: Length in seconds for this item (full media length, or a segment span when the endpoint documents a start/end).
      - `thumbnailUrl` string: Thumbnail image URL.
      - `channelName` string: Name of the channel.
      - `channelId` string: Stable channel id (YouTube UC… when applicable).
      - `channel` object: YouTube channel object for the result when present.
        - `id` string: Id of this results item.
        - `title` string: Title of this results item.
        - `handle` string
        - `url` string: Canonical URL of the item.
        - `thumbnail` unknown
      - `badges` string[]: Platform badges on the result (SoundCloud pro/verified; YouTube 4K/LIVE/New; etc.).
      - `publishedTimeText` string: Original relative publish label from the platform when an exact timestamp was not available (e.g. "1 year ago").
    - `videos` object[]
      - `type` string: Content type of the item.
      - `id` string: Id of this videos item.
      - `url` string: Canonical URL of the item.
      - `title` string: Title of this videos item.
      - `publishedAt` string: Publish time as ISO-8601 when YouTube exposes an absolute timestamp; approximate when derived from a relative label — see publishedTimeText.
      - `viewCount` integer: View count.
      - `durationSeconds` integer: Length in seconds for this item (full media length, or a segment span when the endpoint documents a start/end).
      - `thumbnailUrl` string: Thumbnail image URL.
      - `channelName` string: Name of the channel.
      - `channelId` string: Stable channel id (YouTube UC… when applicable).
      - `channel` object: YouTube channel object for the result when present.
        - `id` string: Id of this results item.
        - `title` string: Title of this results item.
        - `handle` string
        - `url` string: Canonical URL of the item.
        - `thumbnail` unknown
      - `badges` string[]: Platform badges on the result (SoundCloud pro/verified; YouTube 4K/LIVE/New; etc.).
      - `publishedTimeText` string: Original relative publish label from the platform when an exact timestamp was not available (e.g. "1 year ago").
    - `shorts` unknown[]: Shorts (array).
      - unknown
    - `channels` unknown[]: Channels (array).
      - unknown
    - `playlists` unknown[]: Playlists (array).
      - unknown

## Other responses

- `400`: Bad request: wrong platform URL, unknown endpoint, or an invalid parameter value. Not billed.
- `401`: Missing, invalid or revoked API key. Not billed.
- `402`: Not enough credits for this request. Not billed.
- `404`: The resource does not exist or is not public. Not billed.
- `422`: A required parameter is missing or has the wrong type. Not billed.
- `429`: Rate limit reached. Wait for Retry-After seconds. Not billed.
- `502`: The platform could not be reached or returned nothing usable. Retryable, not billed. 503 and 504 use the same envelope.

---

[API](https://skmtc.dev/captapi/apis/captapi-api.md) · [All operations](https://skmtc.dev/captapi/apis/captapi-api/llms.txt) · [OpenAPI document](https://skmtc.dev/captapi/apis/captapi-api/revisions/c9b9ac5ff1bd?raw)
