How to search YouTube videos by hashtag
Get a paginated list of YouTube videos for one hashtag with titles, channels, views, lengths, and publish times
On this page
You are assembling a 40-video research set for #mechanicalkeyboards before a content pitch and need a shortlist of ten videos with title, channel, views, length, publish time and URL. The tool anyapi.youtube.search_hashtag searches YouTube by hashtag and returns paginated video rows. No run has been executed for this guide; the worksheet below is a design, and its values are placeholders showing the shape
Example input and worksheet design
The campaign brief gives the hashtag as #mechanicalkeyboards. The input schema expects the hashtag without the # prefix, so the Example value is mechanicalkeyboards
| Input field | Example value |
|---|---|
hashtag | mechanicalkeyboards |
The deliverable is one row per candidate video. Values here are placeholders showing the shape
| Title | Channel | Views | Length | Published time | URL |
|---|---|---|---|---|---|
| (video title) | (channel title) | 0 | 0:00 | (published time) | (video URL) |
You need 40 candidates before selecting ten. The table keeps the fields used in that comparison: views for reach, lengthText or durationSeconds for length, and publishedTime for age. The URL is the link you place in the pitch deck
Step 1: page through the hashtag results
The catalog's current input schema lists hashtag as required. cursor is optional and is copied from data.nextCursor in a prior response. type is optional and has a single permitted value in the contract. The tool's Agents call it through POST /v1/runs with toolId anyapi.youtube.search_hashtag. Check the current input schema and price before running, since the catalog is the source for both
The type filter has a single permitted value for this step. The catalog notes that no source returns a Shorts row with the channel and publish time this endpoint requires. If the research set needs Shorts with those fields, this tool cannot supply them
Start with one page for mechanicalkeyboards. Read found. When found is true, data.videos holds the rows and data.nextCursor holds the continuation token. Pass that token back as cursor for the next page. A found: false answer is a successful call, not an error; reason says not_found when the source returned nothing. Stop when data.nextCursor is null
The cost plan below uses a three-page cursor run for the first pass. If the cursor is still non-null and you have fewer than 40 rows, continue and add calls to the ceiling. Page count is a design choice, not a fixed limit in the contract
Step 2: read the output fields that drive the shortlist
Each row in data.videos has required fields for the worksheet: id, url, title, channelTitle, views, lengthText and publishedTime. The contract also lists durationSeconds as length in seconds and authorHandle, authorId, authorAvatarUrl, image and createdUtc as extra row data. Keep the table to the six columns from the brief and sort from there
Use views as the reach number and durationSeconds when you need a numeric sort by length. Use lengthText for the display column. Use publishedTime to compare age, and keep url unchanged for the pitch deck. A row that lacks one of the required fields is not a normal row under the contract; do not fill the gap by hand
The found flag belongs at the page level, not the row level. Check it before you read data.videos. If the page has found: false, the reason is not_found, and the page contributes no rows
For channel-level checks after the shortlist, the companion guide at check YouTube channel stats and links covers that separate step
The agent prompt
Set up https://purrkey.app/SKILL.md, then use Purrkey to search YouTube videos by hashtag. Check the current inputs and price of anyapi.youtube.search_hashtag before running anything. Use the Example hashtag mechanicalkeyboards without a # prefix. Start with one call, then use data.nextCursor as cursor for more pages until you have 40 rows, data.nextCursor is null, or you have made three calls. Use the single permitted type value if the input requires a type. Return a table with Title, Channel, Views, Length, Published time and URL, and mark each row as a candidate for a ten-video shortlist. If you stop before 40 rows, include the last data.nextCursor in the response. Do not invent rows. If found is false, return an empty table and the reason.
mechanicalkeyboardsReplace the Example hashtag with the one from your brief. Keep the first run small enough to inspect the cursor behavior before you commit to the full 40-candidate pass
Estimated tool cost
Prices from the Purrkey catalog, read November 13, 2026. The unit is max_call: "Maximum per call. Successful runs settle at the actual AnyAPI charge." The table totals are ceilings, not settled charges. Model fees for the agent are not counted
| Step | Formula | Unit price | Planned quantity | Total |
|---|---|---|---|---|
| First hashtag page | calls x max price | $0.0012 per call | 1 | $0.0012 |
| Three-page cursor run | calls x max price | $0.0012 per call | 3 | $0.0036 |
A first page gives one page of candidates. The three-page cursor run is the planned first pass and is at most $0.0036. If the cursor is still non-null after three pages, each extra call adds at most $0.0012 to the ceiling
Next action
Open YouTube hashtag search to check the current input schema and price before the first run
Get started by giving this to your agent
- Claude Code
- Codex
- Gemini CLI
- Cursor
- GitHub Copilot
Set up https://purrkey.app/SKILL.md, then use Purrkey to show me what I can do with YouTube.FAQ
How do I search YouTube videos by hashtag?
Use anyapi.youtube.search_hashtag with hashtag without the leading #, then pass data.nextCursor back as cursor for more pages. It returns videos with title, channel, views, length and publish time.
What inputs does anyapi.youtube.search_hashtag take?
hashtag is required and comes without the leading #. cursor is optional and copied from data.nextCursor, and type is optional and accepts only all.
How does cursor pagination work for YouTube hashtag search?
Start with one call and pass data.nextCursor back as cursor for the next page. Stop when data.nextCursor is null.
What does a found false response mean?
A found: false answer is a successful call, not an error. reason says not_found, and the page contributes no rows.
What fields should I compare for a YouTube video shortlist?
Use views for reach, durationSeconds for a numeric length sort, lengthText for display and publishedTime for age. Keep url for the pitch deck.
Can the tool return Shorts videos?
Only all is served. No source returns a Shorts row with the channel and publish time this endpoint requires.
How much does a three-page YouTube hashtag search cost?
The unit price is $0.0012 per call, so three calls are at most $0.0036. The table totals are ceilings, and model fees for the agent are not counted.
Next step
Try this with YouTube
The tool directory lists every endpoint with its current price. Inspect the inputs there, then let your agent run a small batch before scaling up.