> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bridgly.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Search YouTube videos, Shorts, channels and playlists

> Search YouTube by keyword and get videos, Shorts, channels and playlists in YouTube's order, each tagged with its `type`. Narrow the results to one kind, sort by relevance or view count, and filter videos by upload date, length and features such as 4K, live or Creative Commons. Page through results with the `cursor` from the previous response's `nextCursor`. Costs 1 credit per request.



## OpenAPI

````yaml /openapi.json post /youtube/search
openapi: 3.1.0
info:
  title: Bridgly API
  description: >-
    Web scraping API for LinkedIn, X (Twitter), Reddit, GitHub, Instagram and
    TikTok. Authenticated endpoints accept a Bridgly API key (`bgly_…`) via
    `Authorization: Bearer <token>`.
  version: 1.0.0
servers:
  - url: https://api.bridgly.app
    description: Production
security: []
tags:
  - name: LinkedIn
    description: Scrape LinkedIn profiles, companies, posts, and search.
  - name: Reddit
    description: Scrape Reddit posts, subreddits, users, and search.
  - name: X (Twitter)
    description: Scrape tweets and search X.
  - name: GitHub
    description: >-
      Fetch GitHub profiles, pinned repos, contributions, repositories, stars,
      and projects via GitHub's GraphQL API.
  - name: Instagram
    description: Scrape Instagram profiles, posts, followers, and search.
  - name: TikTok
    description: Fetch TikTok profiles.
  - name: Meta Ads
    description: >-
      Search the Meta Ad Library: ads, ad details, and advertisers on Facebook
      and Instagram.
  - name: Facebook
    description: >-
      Scrape Facebook profiles, Pages, posts, comments, groups, Marketplace, and
      search.
paths:
  /youtube/search:
    post:
      tags:
        - YouTube
      summary: Search YouTube videos, Shorts, channels and playlists
      description: >-
        Search YouTube by keyword and get videos, Shorts, channels and playlists
        in YouTube's order, each tagged with its `type`. Narrow the results to
        one kind, sort by relevance or view count, and filter videos by upload
        date, length and features such as 4K, live or Creative Commons. Page
        through results with the `cursor` from the previous response's
        `nextCursor`. Costs 1 credit per request.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                cursor:
                  description: >-
                    The previous response's `nextCursor`, to fetch the next
                    page. Omit it for the first page.
                  type: string
                query:
                  type: string
                  minLength: 1
                  description: Search keywords, e.g. "lofi hip hop".
                type:
                  description: >-
                    Which kind of result to return: "all" (the mixed results
                    YouTube shows by default), "video", "short", "channel" or
                    "playlist". Defaults to "all".
                  type: string
                  enum:
                    - all
                    - video
                    - short
                    - channel
                    - playlist
                sortBy:
                  description: >-
                    Result order: "relevance" (YouTube's default) or "viewCount"
                    (most viewed first). Defaults to "relevance".
                  type: string
                  enum:
                    - relevance
                    - viewCount
                uploadDate:
                  description: >-
                    Only return videos uploaded in the last day, week, month or
                    year. Applies to videos and Shorts, so channels and
                    playlists are left out when it is set.
                  type: string
                  enum:
                    - today
                    - week
                    - month
                    - year
                duration:
                  description: >-
                    Only return videos of this length: under 3 minutes, 3 to 20
                    minutes, or over 20 minutes. Applies to videos and Shorts,
                    so channels and playlists are left out when it is set.
                  type: string
                  enum:
                    - under3Minutes
                    - 3to20Minutes
                    - over20Minutes
                features:
                  description: >-
                    Only return videos that have all of these features, as in
                    YouTube's search filters: "live" (live now), "4k", "hd",
                    "subtitles" (subtitles or closed captions),
                    "creativeCommons" (Creative Commons license), "360" (360°),
                    "vr180", "3d", "hdr", "location" (tagged with a place) or
                    "purchased" (bought by the viewer, which signed-out searches
                    never match). Applies to videos and Shorts, so channels and
                    playlists are left out when it is set.
                  maxItems: 11
                  type: array
                  items:
                    type: string
                    enum:
                      - '360'
                      - live
                      - 4k
                      - hd
                      - subtitles
                      - creativeCommons
                      - vr180
                      - 3d
                      - hdr
                      - location
                      - purchased
                count:
                  default: 20
                  description: Number of results to return (1–20). Defaults to 20.
                  type: integer
                  minimum: 1
                  maximum: 20
                cacheMaxAgeHours:
                  description: >-
                    Accept a cached result up to this many hours old, at no
                    cost; its `cachedAt` says when it was fetched. Without one
                    that recent, fresh data is fetched at the normal price.
                    Leave it out to always get fresh data, e.g. 24.
                  type: integer
                  exclusiveMinimum: 0
                  maximum: 9007199254740991
                cacheOnly:
                  description: >-
                    Return only a cached result, never fresh data. With
                    `cacheMaxAgeHours`, only one that recent; without it, the
                    latest of any age. Responds 404, at no cost, when there is
                    none, e.g. true.
                  type: boolean
              required:
                - query
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  timeMs:
                    type: number
                    description: >-
                      Wall-clock time the request took to complete, in
                      milliseconds.
                  creditsCost:
                    type: number
                    description: Number of account credits this request consumed.
                  cachedAt:
                    anyOf:
                      - type: string
                        format: date-time
                        pattern: >-
                          ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
                      - type: 'null'
                    description: >-
                      When the returned data was fetched, if it came from the
                      cache. Null when it was fetched fresh for this request.
                  data:
                    type: object
                    properties:
                      nextCursor:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: >-
                          Pass as `cursor` to fetch the next page; null when
                          there are no more results. A page can hold fewer
                          results than asked for, so keep paging until it is
                          null. Fetch the next page soon: a cursor starting with
                          `bridgly_page_` stays valid for 30 days, and a list
                          that changes in between can shift results across
                          pages.
                      results:
                        type: array
                        items:
                          oneOf:
                            - type: object
                              properties:
                                id:
                                  type: string
                                  description: >-
                                    The 11-character video ID, e.g.
                                    "dQw4w9WgXcQ".
                                url:
                                  type: string
                                  description: >-
                                    Link to the video: a watch link, or a Shorts
                                    link for a Short.
                                title:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Video title.
                                descriptionSnippet:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: >-
                                    The start of the video description, as shown
                                    in the list.
                                thumbnails:
                                  anyOf:
                                    - type: array
                                      items:
                                        type: object
                                        properties:
                                          url:
                                            type: string
                                            description: >-
                                              Direct image URL for this thumbnail
                                              size.
                                          width:
                                            anyOf:
                                              - type: number
                                              - type: 'null'
                                            description: Thumbnail width in pixels.
                                          height:
                                            anyOf:
                                              - type: number
                                              - type: 'null'
                                            description: Thumbnail height in pixels.
                                        required:
                                          - url
                                          - width
                                          - height
                                        additionalProperties: false
                                    - type: 'null'
                                  description: Available thumbnail sizes, smallest first.
                                durationSeconds:
                                  anyOf:
                                    - type: number
                                    - type: 'null'
                                  description: >-
                                    Video length in seconds. Null for live
                                    streams and Shorts.
                                viewCount:
                                  anyOf:
                                    - type: number
                                    - type: 'null'
                                  description: >-
                                    View count, or the number watching a live
                                    stream or waiting for a scheduled one.
                                    Rounded when YouTube only shows an
                                    abbreviated figure such as "1.2M views".
                                publishedText:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: >-
                                    When the video was published, as YouTube
                                    shows it, e.g. "3 days ago", "2d ago" or
                                    "Streamed 2 years ago", or when a scheduled
                                    stream starts.
                                channel:
                                  anyOf:
                                    - type: object
                                      properties:
                                        id:
                                          type: string
                                          description: >-
                                            Channel ID that owns the video, e.g.
                                            "UCuAXFkgsw1L7xaCfnd5JJOw".
                                        name:
                                          anyOf:
                                            - type: string
                                            - type: 'null'
                                          description: >-
                                            Channel display name, e.g. "Rick
                                            Astley".
                                        url:
                                          anyOf:
                                            - type: string
                                            - type: 'null'
                                          description: >-
                                            Channel page URL, e.g.
                                            "https://www.youtube.com/@RickAstleyYT".
                                        handle:
                                          anyOf:
                                            - type: string
                                            - type: 'null'
                                          description: >-
                                            Channel handle without the "@", e.g.
                                            "RickAstleyYT".
                                      required:
                                        - id
                                        - name
                                        - url
                                        - handle
                                      additionalProperties: false
                                    - type: 'null'
                                  description: >-
                                    The channel that published the video, when
                                    the list shows it. For some Shorts only the
                                    channel's ID and link are known.
                                isShort:
                                  anyOf:
                                    - type: boolean
                                    - type: 'null'
                                  description: True when the video is a Short.
                                isLive:
                                  anyOf:
                                    - type: boolean
                                    - type: 'null'
                                  description: >-
                                    True when the video is a live stream on air
                                    right now.
                                isUpcoming:
                                  anyOf:
                                    - type: boolean
                                    - type: 'null'
                                  description: >-
                                    True when the video is a scheduled premiere
                                    or stream.
                                badges:
                                  type: array
                                  items:
                                    type: string
                                  description: >-
                                    The labels YouTube shows on the video in the
                                    list, e.g. "4K", "CC", "New" or "3
                                    products".
                                type:
                                  type: string
                                  description: A video or Short.
                                  enum:
                                    - video
                              required:
                                - id
                                - url
                                - title
                                - descriptionSnippet
                                - thumbnails
                                - durationSeconds
                                - viewCount
                                - publishedText
                                - channel
                                - isShort
                                - isLive
                                - isUpcoming
                                - badges
                                - type
                              additionalProperties: false
                            - type: object
                              properties:
                                id:
                                  type: string
                                  description: Channel ID, e.g. "UCuAXFkgsw1L7xaCfnd5JJOw".
                                url:
                                  type: string
                                  description: >-
                                    Channel page URL, e.g.
                                    "https://www.youtube.com/@RickAstleyYT".
                                handle:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: >-
                                    Channel handle without the "@", e.g.
                                    "RickAstleyYT".
                                name:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Channel display name, e.g. "Rick Astley".
                                descriptionSnippet:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: >-
                                    The start of the channel description, as
                                    shown in the list.
                                avatars:
                                  anyOf:
                                    - type: array
                                      items:
                                        type: object
                                        properties:
                                          url:
                                            type: string
                                            description: >-
                                              Direct image URL for this thumbnail
                                              size.
                                          width:
                                            anyOf:
                                              - type: number
                                              - type: 'null'
                                            description: Thumbnail width in pixels.
                                          height:
                                            anyOf:
                                              - type: number
                                              - type: 'null'
                                            description: Thumbnail height in pixels.
                                        required:
                                          - url
                                          - width
                                          - height
                                        additionalProperties: false
                                    - type: 'null'
                                  description: >-
                                    Channel profile picture sizes, smallest
                                    first.
                                subscriberCount:
                                  anyOf:
                                    - type: number
                                    - type: 'null'
                                  description: >-
                                    Subscriber count, rounded as YouTube shows
                                    it, e.g. 4200000 for "4.2M subscribers".
                                isVerified:
                                  anyOf:
                                    - type: boolean
                                    - type: 'null'
                                  description: True when the channel has a verified badge.
                                type:
                                  type: string
                                  description: A channel.
                                  enum:
                                    - channel
                              required:
                                - id
                                - url
                                - handle
                                - name
                                - descriptionSnippet
                                - avatars
                                - subscriberCount
                                - isVerified
                                - type
                              additionalProperties: false
                            - type: object
                              properties:
                                id:
                                  type: string
                                  description: >-
                                    Playlist ID, e.g.
                                    "PLFgquLnL59alCl_2TQvOiD5Vgm1hCaGSI".
                                url:
                                  type: string
                                  description: Playlist page URL.
                                title:
                                  anyOf:
                                    - type: string
                                    - type: 'null'
                                  description: Playlist title.
                                thumbnails:
                                  anyOf:
                                    - type: array
                                      items:
                                        type: object
                                        properties:
                                          url:
                                            type: string
                                            description: >-
                                              Direct image URL for this thumbnail
                                              size.
                                          width:
                                            anyOf:
                                              - type: number
                                              - type: 'null'
                                            description: Thumbnail width in pixels.
                                          height:
                                            anyOf:
                                              - type: number
                                              - type: 'null'
                                            description: Thumbnail height in pixels.
                                        required:
                                          - url
                                          - width
                                          - height
                                        additionalProperties: false
                                    - type: 'null'
                                  description: Playlist cover image sizes, smallest first.
                                videoCount:
                                  anyOf:
                                    - type: number
                                    - type: 'null'
                                  description: >-
                                    Number of videos in the playlist, when the
                                    list shows it.
                                channel:
                                  anyOf:
                                    - type: object
                                      properties:
                                        id:
                                          type: string
                                          description: >-
                                            Channel ID that owns the video, e.g.
                                            "UCuAXFkgsw1L7xaCfnd5JJOw".
                                        name:
                                          anyOf:
                                            - type: string
                                            - type: 'null'
                                          description: >-
                                            Channel display name, e.g. "Rick
                                            Astley".
                                        url:
                                          anyOf:
                                            - type: string
                                            - type: 'null'
                                          description: >-
                                            Channel page URL, e.g.
                                            "https://www.youtube.com/@RickAstleyYT".
                                        handle:
                                          anyOf:
                                            - type: string
                                            - type: 'null'
                                          description: >-
                                            Channel handle without the "@", e.g.
                                            "RickAstleyYT".
                                      required:
                                        - id
                                        - name
                                        - url
                                        - handle
                                      additionalProperties: false
                                    - type: 'null'
                                  description: >-
                                    The channel that owns the playlist, when the
                                    list shows it.
                                type:
                                  type: string
                                  description: A playlist or mix.
                                  enum:
                                    - playlist
                              required:
                                - id
                                - url
                                - title
                                - thumbnails
                                - videoCount
                                - channel
                                - type
                              additionalProperties: false
                        description: >-
                          Matching videos, Shorts, channels and playlists, in
                          YouTube's order. Each has a `type` saying which it is.
                      warning:
                        anyOf:
                          - type: string
                          - type: 'null'
                        description: >-
                          Why the list is empty when there is a reason to know,
                          e.g. "Comments are turned off for this video." or "No
                          YouTube channel found for the given input". Null
                          otherwise.
                    required:
                      - nextCursor
                      - results
                      - warning
                    additionalProperties: false
                required:
                  - timeMs
                  - creditsCost
                  - cachedAt
                  - data
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '402':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
                    description: Human-readable description of what went wrong.
                required:
                  - status
                  - message
                additionalProperties: false
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: typescript
          label: Bridgly SDK
          source: |-
            import { Bridgly } from '@bridgly/sdk';

            const client = new Bridgly({ apiKey: process.env.BRIDGLY_API_KEY });

            const res = await client.youtube.search({
              query: "string",
              count: 20,
            });
            if (res.type === 'success') console.log(res.data);
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A Bridgly API key (`bgly_…`). Metered endpoints deduct credits from the
        resolved account.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.