Skip to content
OperationsYouTube

Search videos

One page of a YouTube search, about 20 videos in the order youtube.com shows them, each with its channel, views, duration, date, badges, chapters and thumbnails.

youtube/videos/search1 credit a callv1.0.1

When to use it

You need the videos YouTube finds for some words, as its search shows them to a visitor: their title, channel, views, duration, when they were published, whether they are live, upcoming or shorts, their badges (4K, CC, New), the chapters the result shows (the one matching the words marked), YouTube's AI summary of the video when the result shows one, and their thumbnails. Filter as the search's panel does: by type (videos or shorts), upload date (today to this year), duration and features (live, 4K, HD, subtitles, Creative Commons, 360°, VR180, 3D, HDR, location, purchased); sort by relevance or popularity. Ask in another language and country (language, country) for what YouTube shows there. A result's position is its rank in the search, across pages. Follow next for the following page. For one video whole (its description, likes, tags), use youtube/videos/get; for a channel's own videos, youtube/videos/list; for channels by name, youtube/channels/search.

Try it

The options on the left write the call; the answer on the right is the contract's example. With your API key, the same call returns live data.

1Request
Words to search for, as typed in YouTube's search box.
How recently the videos were uploaded, as the panel's "Upload date" filter.
The videos' length, as the panel's "Duration" filter.
1 credit a call
Code, from the fields above
curl https://api.lobstr.io/v2/run \
  -H "Authorization: Bearer $LOBSTR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source": "youtube",
    "operation": "videos/search",
    "options": {
      "query": "n8n tutorial",
      "upload_date": "this_month",
      "duration": "over_20_minutes"
    }
  }'
2Response

An example answer. Run it on your own input.

{
  "object": "run",
  "id": "run_4rsl3cx4t6t25g5ngbm5ssccua",
  "livemode": true,
  "source": "youtube",
  "operation": "videos/search",
  "version": "1.0.1",
  "schema_url": "https://api.lobstr.io/v2/catalog/youtube/videos/search",
  "options": {
    "query": "n8n tutorial",
    "upload_date": "this_month",
    "duration": "over_20_minutes"
  },
  "fields": null,
  "status": "succeeded",
  "count": 1,
  "has_more": false,
  "next": null,
  "cost": {
    "credits": 1
  },
  "results": [
    {
      "object": "video",
      "position": 1,
      "id": "n8nTutor1al",
      "ids": {
        "video_id": "n8nTutor1al",
        "channel_id": "UCa1b2c3d4e5f6g7h8i9j0kL"
      },
      "url": "https://www.youtube.com/watch?v=n8nTutor1al",
      "title": "n8n Tutorial for Beginners: Build Your First Workflow",
      "description_snippet": "Learn n8n from scratch and build your first automation in under an hour ...",
      "duration_seconds": 2843,
      "duration_text": "47:23",
      "views": 18342,
      "watching": null,
      "published_text": "2 weeks ago",
      "is_live": false,
      "is_upcoming": false,
      "scheduled_at": null,
      "is_short": false,
      "badges": [
        "4K",
        "CC"
      ],
      "channel": {
        "id": "UCa1b2c3d4e5f6g7h8i9j0kL",
        "title": "Automation Academy",
        "handle": "@automationacademy",
        "url": "https://www.youtube.com/@automationacademy",
        "is_verified": true,
        "is_artist": false,
        "thumbnails": [
          {
            "url": "https://yt3.ggpht.com/automation-academy=s68-c-k-c0x00ffffff-no-rj",
            "width": 68,
            "height": 68
          }
        ]
      },
      "collaborators": [],
      "chapters": [
        {
          "title": "Introduction",
          "start_seconds": 0,
          "time_text": "0:00",
          "is_match": false,
          "thumbnails": [
            {
              "url": "https://i.ytimg.com/vi/n8nTutor1al/hqdefault_0.jpg",
              "width": 336,
              "height": 188
            }
          ]
        },
        {
          "title": "Your first trigger",
          "start_seconds": 312,
          "time_text": "5:12",
          "is_match": true,
          "thumbnails": [
            {
              "url": "https://i.ytimg.com/vi/n8nTutor1al/hqdefault_312000.jpg",
              "width": 336,
              "height": 188
            }
          ]
        }
      ],
      "ai_summary": null,
      "thumbnails": [
        {
          "url": "https://i.ytimg.com/vi/n8nTutor1al/hq720.jpg",
          "width": 360,
          "height": 202
        },
        {
          "url": "https://i.ytimg.com/vi/n8nTutor1al/hq720.jpg",
          "width": 720,
          "height": 404
        }
      ],
      "moving_thumbnail": {
        "url": "https://i.ytimg.com/an_webp/n8nTutor1al/mqdefault_6s.webp",
        "width": 320,
        "height": 180
      },
      "source_url": "https://www.youtube.com/results?search_query=n8n+tutorial&sp=EgQIBBgC",
      "observed_at": "2026-12-03T12:00:00Z"
    }
  ]
}

Options

querystringrequired
Words to search for, as typed in YouTube's search box.
type"all" | "videos" | "shorts"Default all
What the search finds: all, the search's own mix of videos and shorts (the shorts among the results say is_short); videos, videos only; shorts, shorts only. Channels are searched with youtube/channels/search.
upload_date"any" | "today" | "this_week" | "this_month" | "this_year"Default any
How recently the videos were uploaded, as the panel's "Upload date" filter.
duration"any" | "under_3_minutes" | "3_to_20_minutes" | "over_20_minutes"Default any
The videos' length, as the panel's "Duration" filter.
featuresstring[]
What the videos must have, all of them, as the panel's "Features": live (live now), 4k, hd, subtitles (subtitles or closed captions), creative_commons (under a Creative Commons licence), 360 (360°), vr180, 3d, hdr, location (with a place), purchased (bought by the visitor: signed out, none).
sort"relevance" | "popularity"Default relevance
The order of the videos: relevance, YouTube's own search order; popularity, YouTube's ranking of the most popular, not views alone. The panel's old order by upload date is gone, and the API answers it in relevance's order (03/12): for the latest videos, filter by upload_date.
languagestringDefault en
The language YouTube speaks to the visitor (en, fr, de, es, pt-BR, ja...): the texts of the records, dates, counts and badges, are written in it ("11 months ago", "il y a 11 mois"); the counts are read in it.
countrystringDefault US
The visitor's country, two letters (US, GB, FR, IN...), whose people YouTube searches for.
cursorstring
Where to go on, from next in an answer, as it is: opaque, and only for the search it was given with (otherwise invalid_cursor).

Record

Each record of results, in the envelope every call returns (Run an operation).

objectstring
positioninteger
The video's rank in the search, across pages.
idstring
The video's id on YouTube, 11 characters, as in its address.
ids.video_idstring
ids.channel_idstring
Its channel's id (UC...).
urlstring
The video's page; a short's is its /shorts/ address.
titlestring
description_snippetstring
The lines of its description the result shows (its start, or the part holding the words searched), cut by YouTube with "..."; null when the result shows none. The whole description is youtube/videos/get's.
duration_secondsinteger
Its length; null for a live in progress, and for a short of a shorts search answered as a grid.
duration_textstring
Its length as shown (3:35:08).
viewsinteger
Its views, as the result writes them in full ("1,352,247 views"); null for a live in progress, whose viewers are watching. A short of a shorts search answered as a grid has them rounded ("52K views" is 52000).
watchinginteger
The viewers of a live in progress, now; null otherwise.
published_textstring
When it was put online, as YouTube tells a visitor, in language ("11 months ago", "Streamed 2 days ago"); null for a live in progress. A short of a shorts search answered as a grid says it shorter ("19h ago").
is_liveboolean
A live in progress.
is_upcomingboolean
A live or a premiere to come.
scheduled_atdate
When an upcoming one starts.
is_shortboolean
A YouTube Short.
badgeslist
The labels under the result (4K, CC, New, LIVE...), in language: two at most (03/12), so a video filtered by subtitles can show "New" and "4K" without "CC".
channel.idstring
The channel's id (UC...).
channel.titlestring
channel.handlestring
Its @handle.
channel.urlstring
Its page.
channel.is_verifiedboolean
YouTube's verified badge.
channel.is_artistboolean
An official artist channel's badge.
channel.thumbnailslist
Its avatar.
collaboratorslist
The channels that made the video together, when YouTube says there are several (a collaboration), each with its subscribers; empty otherwise.
chapterslist
The chapters the result shows, for the videos YouTube shows them for; empty otherwise. YouTube shows either the chapters or ai_summary, not both.
ai_summarystring
YouTube's own AI-generated summary of the video, as the result shows it in place of the chapters ("AI-generated video summary", which YouTube says to check: its AI can be wrong), its paragraphs apart; null when it shows none (5 videos of 34 on two pages, 03/12).
thumbnailslist
The video's thumbnail in its sizes, the largest last.
moving_thumbnailstring
The few seconds of the video the result plays on hover (an animated WebP), when it has them.
source_urlstring
The results page of youtube.com for this search.
observed_atdate

Errors

Its own, besides those of every call (Errors). A failed call is free.

CodeStatusWhat it means
ip_blocked503YouTube slowed down the IPs the call tried (429). Retry in a minute; failed calls are free. Retryable.
invalid_input422Pass the words to search for, and the filters as the search's panel offers them: a type, an upload date, a duration, features, an order, a language (en) and a country (US).
site_unavailable503YouTube did not answer properly; retry later (not charged). Retryable.
unexpected_answer424YouTube answered in a shape we do not read yet; we are told and fix it (not charged).

Price

1 credit a call, one page of about 20 videos. An empty page and a failed call are free. What a credit costs on each plan: Credits and pricing.

Changelog

1.0.12026-12-03
A shorts search (type: shorts) gave empty pages when YouTube answered it as a grid of shorts, 25 a page, one of its two layouts that day: the grid's shorts are now the results, each with its title, views (rounded), age, badge and thumbnails, without its channel or duration, which the grid does not show (youtube/videos/get has them).
1.0.02026-12-03
First version: one page of a YouTube search, signed out, by words, type (videos or shorts), upload date, duration and features, sorted by relevance or popularity, in a language and a country; each video with its channel and collaborators, views or viewers, duration, date, live, upcoming and short marks, badges, chapters (the one matching the words marked), YouTube's AI summary when it shows one, and thumbnails.