youtube

Search

Returns YouTube search results for a keyword: videos, channels, playlists, shorts, and live streams, each with title, thumbnail, views, and channel.

Use it for a general keyword search across every content kind; search/advanced returns videos only but adds date, license, and country filters.

Metered: 10–150 credits. We reserve the ceiling when the call starts and charge what it actually used when it finishes.

Paginates by cursor: see Pagination.

get/v1/youtube/search

Request

  • Base URL: https://api.insightsocial.app
  • URL: https://api.insightsocial.app/v1/youtube/search
  • Auth: API key in header x-api-key

Query parameters

querystring required
Example:javascript tutorial

Search keyword or phrase.

uploadDate'today' | 'this_week' | 'this_month' | 'this_year'

Upload date filter. Reliable on its own (no type). With type=shorts, windows narrower than this_year are rejected with a 400 because YouTube returns an empty set for them; this_year is accepted but measured to return ~5x fewer unique Shorts across a paginated walk (the platform re-serves the same items under an advancing continuationToken), so the recommended pattern for Shorts recency is no uploadDate at all plus includeExtras=true and a client-side filter on post.published_at. With other type values the platform currently ignores the date filter and may mix content kinds; filter client-side there too. For an EXACT date window rather than these coarse buckets, use /v1/youtube/search/advanced, whose published_after/published_before take RFC-3339 bounds and are genuinely applied.

sortBy'relevance' | 'popular'

Sort order: relevance or popular. popular cannot be combined with type=shorts (rejected with a 400. YouTube serves that combination unreliably); it also caps the page at ~20 results. It is also NOT a strict view-count sort: popular is a popularity-weighted ranking, and results do not come back in descending view order. Measured on 4 of 4 test keywords: a new york search returned 9.5M, then 502.9M, then 66K views in that order. If you need a view-faithful ordering, use /v1/youtube/search/advanced with order=viewCount and includeExtras=true: its ranking leads with the true top results, and the returned engagement.views lets you sort the page exactly client-side.

type'videos' | 'shorts' | 'channels' | 'playlists'
Example:videos

Type of content to return. NOTE on Shorts results (type=shorts, and the Shorts an untyped search mixes in): the Shorts shelf item carries no channel object (includeExtras=true does not add it). By default the free per-video lookup that supplies the exact date also fills author.id and post.author.display_name on those rows, at no extra credit. post.author.username (the @handle) and post.author.avatar_url stay null on them: send include=engagement,channel to fill both and the subscriber count. With exact_dates=false no lookup runs and the whole author stays null on Shorts. Video results are unaffected (20/20 carry the full author). /v1/youtube/search/advanced also carries channel_id on every result, though it has no Shorts filter.

duration'under_3_min' | 'between_3_and_20_min' | 'over_20_min'

Video duration filter. Known issue: currently not applied by the platform and it can degrade the type filter; prefer filtering client-side on post.content.duration_seconds.

regionstring

Two-letter country code that localises the results, such as US or GB.

includeExtrasstring

Set to true to add the like count and comment count (post.engagement.likes / .comments) and the video description (post.ext.description) to each video result. Left off, those three are null. Dates do not need it: post.published_at is exact by default either way (see exact_dates). For Shorts results it additionally supplies post.content.duration_seconds, which those items never carry otherwise. It does NOT add channel identity to Shorts results (see type) and it never adds a subscriber count. For both, send include=engagement,channel instead: the video join supplies every row's channel id, and the channel join adds the subscriber count, in this same call. For full per-video details use /v1/youtube/video.

includestring

Set to engagement, channel, or both (engagement,channel) to fill more of every row in this one call. engagement fills post.engagement.views, .likes and .comments, post.content.duration_seconds, author.id and post.author.display_name where the row lacks them, and replaces a date derived from a label such as "4 months ago" with the exact publish time (removing post.ext.published_precision). channel puts the channel's subscriber count on post.ext.author_followers (YouTube's own figure, which it rounds to three significant figures above 1,000) and fills the channel's post.author.display_name, .avatar_url and .username where missing. Send both to cover rows that arrive without a channel id: the video join supplies it and the channel join then uses it. Channel and playlist result rows are not videos: the video join skips them. Each join adds 0.2 to 0.7 seconds on a fresh page (one lookup per 50 ids, never more than 8 seconds).

exact_dates'true' | 'false'

Exact publish dates are on by default and free. Set to false to skip the lookup: rows then carry YouTube's own date estimate (a day-granular or coarser label truncated to midnight UTC), marked by post.ext.published_precision and post.ext.published_label, and the listing title, marked by post.ext.title_maybe_translated.

dry_run'1'

Set to 1 to get the price of this call without making it: data.dry_run carries credits_min and credits_max. Nothing is charged.

sincestring

Only rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Rows older than it are left off each page. This list is not in date order, so the walk does not stop at the date: keep following next_cursor, and each page costs what a page costs even when every row on it is filtered out. A row with no date is kept.

untilstring

Only rows published on or before this date: YYYY-MM-DD (that whole UTC day is included) or an ISO 8601 timestamp. Newer rows are left off each page and the walk does not stop, so older pages follow. A row with no date is kept.

min_viewsinteger

Keep only rows with at least this many views (post.engagement.views). A row whose view count is unknown is discarded, so every returned row meets the floor.

max_age_daysinteger

Keep only rows published within this many days (post.published_at), 1 to 3650. A row with no date is discarded.

sort_rows'views'

views: return the kept rows ordered by view count, highest first, across every page walked. Rows without a view count go last.

max_pagesinteger

1 to 5 (default 1). Walk up to this many pages in one call and return the rows from all of them (after any filter). Each page walked is billed as one call to this endpoint; the whole walk counts once against your rate limit.

cursorstring

The pagination.next_cursor from the previous page, sent back unchanged. Omit it for the first page.

Response

Success.

successtrue required
platformstring required
endpointstring required
schema_version'2' required
unavailablestring[] required
credits_usedinteger required
credits_remaininginteger required
request_idstring required
cachedboolean required
idempotent_replayboolean required
charge_reasonstring required
free_callboolean required

Changes

No recorded changes to this operation across all 1 revision of this API.