Skip to Content

Search YouTube

Search YouTube for videos using AI analysis and ranking with optional filters.

Process:

  1. Search for relevant videos
  2. AI analysis of video content and transcripts
  3. Intelligent ranking based on query relevance
  4. Structured results with rich metadata

Set include_usage=true to receive the usage block, with the request's token counts.

Partial results: if credits run out mid-search, the endpoint returns HTTP 402 with status: "partial", the videos analyzed so far in data.results, and error_code: "insufficient_credits_video_search".

POST
/youtube/search

Search YouTube for videos using AI-powered analysis and ranking with optional filters.

This endpoint was previously /search/video; that old path has been removed. Use /youtube/search, which is dedicated to searching YouTube. To search TikTok, use the TikTok Search endpoint. To search your own uploaded files, use Search Files.

Overview

Find the most relevant YouTube videos using natural language queries. Our AI analyzes video content, transcripts, and metadata to deliver precisely ranked results.

Search Process

  1. Enhanced query processing: AI expands and optimizes your search query
  2. Content analysis: per-video fetch + per-video AI analysis
  3. Intelligent ranking: results ranked by relevance, not just keyword matching
  4. Rich results: video details, a summary of each transcript, and the passage that matches your query

Billing

Unlike a flat search_request, YouTube search bills for the work it actually does:

  • One residential_request per candidate video fetched, whether or not it has a transcript. Use max_results to cap how many candidates are processed — that directly caps how many residential charges fire.
  • One consolidated analysis_request charge after all per-video analyses and the ranking step complete, with quantity = ceil(total_tokens / 15000) where total_tokens is the sum of LLM input + output tokens across every video analyzed plus the ranking call.
  • No search_request is billed — the residential fetches + analysis fully cover the workflow.
  • If no candidate video is found, nothing is billed.

Set include_usage: true to receive the full per-charge breakdown. The consolidated analysis_request entry also carries a nested tokens object reporting prompt_tokens / completion_tokens / total_tokens.

Partial results: if your credits run out mid-search, the endpoint returns HTTP 402 with status: "partial", the videos analyzed so far in data.results, and error_code: "insufficient_credits_video_search". The usage block (when include_usage=true) reflects only the charges that succeeded.

Search Options

Enhanced Search

AI-powered query expansion and optimization (recommended)

Year Filtering

Filter results by publication date range

Duration Filtering

Limit results by maximum video duration

Focus Types

Put the best matches, the most recent, the most viewed or the shortest videos first

Request Parameters

ParameterTypeRequiredDescription
querystringYesSearch query
use_enhanced_searchbooleanNoWhether to use enhanced search (default false)
start_yearintegerNoOnly videos published in or after this year
end_yearintegerNoOnly videos published in or before this year
focusstringNoWhat comes first among the videos that match the query: relevance (default, the best matches), recency (the most recent), popularity (the most viewed) or brevity (the shortest). With a value other than relevance, explanation is empty.
durationintegerNoMaximum duration in seconds: longer videos are left out
max_resultsintegerNoMaximum number of videos to analyse and return. Each candidate triggers one residential_request and contributes tokens to the consolidated analysis_request charge, so lowering this caps the per-call cost. Defaults to your plan ceiling; values above it are silently clamped.
include_usagebooleanNoWhen true, the response includes a usage block listing every meter charged, the total credits deducted, and credits_remaining_after: the credits left on the account once this request is charged.

Example Usage

curl -X POST "https://api.vidnavigator.com/v1/youtube/search" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What are the best practices for React development?",
    "use_enhanced_search": true,
    "start_year": 2020,
    "end_year": 2024,
    "focus": "relevance",
    "duration": 1800,
    "max_results": 5
  }'

Response Example

{
  "status": "success",
  "data": {
    "results": [
      {
        "title": "React Best Practices 2024: Clean Code & Performance",
        "description": "Complete guide to writing maintainable React code...",
        "url": "https://youtube.com/watch?v=example123",
        "thumbnail": "https://img.youtube.com/vi/example123/maxresdefault.jpg",
        "channel": "React Mastery",
        "published_date": "2024-01-15",
        "duration": 930,
        "views": 125000,
        "likes": 4200,
        "relevance_score": 0.95,
        "transcript_summary": "A walkthrough of clean component design, hooks and rendering performance in React.",
        "people": ["Dan Abramov"],
        "places": [],
        "key_subjects": ["React hooks", "Performance optimization", "Code organization"],
        "timestamp": 312.5,
        "relevant_text": "Keep your components small and give each one a single job.",
        "query_relevance": "The video lists React best practices for clean code and performance."
      }
    ],
    "query": "What are the best practices for React development?",
    "total_found": 1,
    "explanation": "Found videos discussing React development best practices, focusing on recent content and high relevance."
  },
  "usage": {
    "charges": [
      { "service_type": "residential_request", "quantity": 5, "credits": 0.025 },
      {
        "service_type": "analysis_request",
        "quantity": 2,
        "credits": 0.02,
        "tokens": { "prompt_tokens": 24000, "completion_tokens": 4200, "total_tokens": 28200 }
      }
    ],
    "total_credits": 0.045,
    "credits_remaining_after": 87.955
  }
}

The usage block is only included when include_usage=true in the request.

Partial Results (402)

{
  "status": "partial",
  "error_code": "insufficient_credits_video_search",
  "message": "Ran out of credits after analyzing some videos.",
  "data": {
    "results": [ ... ],
    "query": "...",
    "total_found": 3,
    "explanation": "..."
  },
  "usage": { "charges": [ ... ], "total_credits": 0.02 }
}

Use Cases

Research & Learning

Find educational content on specific topics or technologies

Content Curation

Build curated lists of videos for courses or documentation

Competitive Analysis

Analyze what content exists in your industry or niche

Trend Discovery

Identify trending topics and popular content creators

API reference

Authorization

ApiKeyAuth
headerX-API-Key<token>

API key authentication. Include your VidNavigator API key in the X-API-Key header.

Request Body

application/json
  1. body
query*string

Search query

use_enhanced_search?boolean

Whether to use enhanced search

Defaultfalse
start_year?integer

Only videos published in or after this year

end_year?integer

Only videos published in or before this year

focus?string

What comes first among the videos that match the query: the best matches (relevance), the most recent (recency), the most viewed (popularity) or the shortest (brevity). With a value other than relevance, explanation is empty.

Default"relevance"
Value in"relevance""recency""popularity""brevity"
duration?integer

Maximum duration in seconds: longer videos are left out

max_results?integer

Maximum number of videos to analyse and return. When omitted, defaults to your plan's limit; higher values are clamped to it.

Range1 <= value
include_usage?boolean

When true, the response includes the usage block of this request.

Defaultfalse

Response Body

Search completed successfully

application/json
  1. response
status?"success"
Value in"success"
data?
usage?

Per-call usage, returned only when the request sets include_usage=true: the charges of this request, one entry per service_type, the total credits deducted, and the credits left on the account. A waived charge carries waived: true and credits_saved, with a top-level waived.credits_saved summary.

For endpoints that run an AI analysis (/extract/video, /extract/file, /youtube/search), the analysis_request entry carries a nested tokens object with the request's token counts.

Example Request
curl -X POST 'https://api.vidnavigator.com/v1/youtube/search' \  -H 'Content-Type: application/json' \  -d '{  "query": "What are the best practices for React development?"}'
Example Response
{  "status": "success",  "data": {    "results": [      {        "title": "string",        "url": "http://example.com",        "description": "string",        "thumbnail": "http://example.com",        "channel": "string",        "published_date": "string",        "duration": 0,        "views": 0,        "likes": 0,        "relevance_score": 0,        "transcript_summary": "string",        "people": [          "Sam Altman"        ],        "places": [          "San Francisco"        ],        "key_subjects": [          "AI regulation",          "Model pricing"        ],        "timestamp": 0,        "relevant_text": "string",        "query_relevance": "string"      }    ],    "query": "string",    "total_found": 0,    "explanation": "string"  },  "usage": {    "charges": [      {        "service_type": "standard_request",        "quantity": 0,        "credits": 0,        "waived": true,        "credits_saved": 0,        "tokens": {          "prompt_tokens": 0,          "completion_tokens": 0,          "total_tokens": 0        }      }    ],    "total_credits": 0,    "waived": {      "credits_saved": 0    },    "credits_remaining_after": 0  }}

On this page