Skip to content
NewIntroducing lobstr.io API v2: Web Data for AI Agents
YouTube: Search videosTry it

YouTube: 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.

1 credita callWorks today
Try itDocs
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"
    }
  ]
}

32 fields per video

Every call returns them for each record, in the results of its JSON answer.

Search videos

32 fields
object
text
video
position
number
The video's rank in the search, across pages.
1
id
id
The video's id on YouTube, 11 characters, as in its address.
n8nTutor1al
ids.video_id
id
n8nTutor1al
ids.channel_id
id
Its channel's id (UC...).
UCa1b2c3d4e5f6g7h8i9j0kL

What it costs

Billed by the call: 1 credits, whatever the page holds (up to 20 videos). Pick how many calls a month.

Every plan

1 credit a call

Calls a month

100

Per 100 calls

Free

On the free plan, up to 100 calls a month.

Live

Built to run

Every call counts; a day is green at 95% successful.

Successful calls
100.00%
Median call
1.9 s
90 days agoToday
95% or more (SLA)90 to 95%75 to 90%Under 75%

A call fails when the site does not answer or we cannot read its answer; a wrong input is not counted.

Frequently asked questions

What people ask before calling youtube/videos/search.

Search videos

When do I 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.

What do I give it?
  • query (required): Words to search for, as typed in YouTube's search box.
  • type: 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: How recently the videos were uploaded, as the panel's "Upload date" filter.
  • duration: The videos' length, as the panel's "Duration" filter.
  • features: 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: 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.
  • language: 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.
  • country: The visitor's country, two letters (US, GB, FR, IN...), whose people YouTube searches for.
What does it return?

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. Every record has the same fields, empty ones included: they are all listed above.

How do I get the next page?

Each answer ends with next: the following call, whole. Send it as it is; it is null after the last page. A page holds 20 records at most.

Pricing

What does a call cost?

1 credit a call, one page of about 20 videos. An empty page and a failed call are free.

When is a call free?
  • an empty page (past the end, or nothing found)
  • a call that fails

Errors

What can go wrong?
  • ip_blocked (503, retry): YouTube slowed down the IPs the call tried (429). Retry in a minute; failed calls are free.
  • invalid_input (422): Pass 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_unavailable (503, retry): YouTube did not answer properly; retry later (not charged).
  • unexpected_answer (424): YouTube answered in a shape we do not read yet; we are told and fix it (not charged).
How long can a call take?

30 seconds at most by default, up to 60 with timeout_s. A call past it answers timeout (408), is not charged, and can be sent again.

API and agents

Can my AI agent run it?

Yes: connect the lobstr.io MCP server (https://api.lobstr.io/v2/mcp, your API key as a Bearer token); its run_operation tool runs youtube/videos/search. Its page for agents, in Markdown: youtube/videos/search.md.

Where is its full description?

The contract, as JSON: https://api.lobstr.io/v2/catalog/youtube/videos/search: every option, every field, the price and the errors. This page is drawn from it.

Ready to call it?

An API key in a minute, then the call above, from your code or your agent.