Corsair
PluginsTavily

Tavily API Endpoints

Complete reference for all Tavily API endpoints

The Tavily plugin provides AI-powered web search capabilities through a single search endpoint.

New to Corsair? Learn about core concepts like API access, authentication, and error handling.

Full Implementation: For the complete, up-to-date list, see the Tavily plugin source code.

search

search

Search the web using Tavily's AI-powered search engine.

const results = await corsair.tavily.api.search({
    query: "latest TypeScript features 2024", 
    max_results: 5,
});

Parameters:

NameTypeRequiredDescription
querystringYesSearch query
search_depthstringNobasic (default) or advanced for deeper search
topicstringNogeneral (default) or news
max_resultsnumberNoMax results to return (1-20, default: 5)
include_answerboolean | stringNoInclude AI-generated answer (true, false, or basic/advanced)
include_raw_contentboolean | stringNoInclude raw page content
include_imagesbooleanNoInclude image results
include_domainsstring[]NoOnly include results from these domains
exclude_domainsstring[]NoExclude results from these domains
time_rangestringNoFilter by time: day, week, month, year

Returns:

{
    query: string;
    answer?: string;      // AI-generated answer if requested
    results: Array<{
        title: string;
        url: string;
        content: string;  // Extracted page content
        score: number;    // Relevance score
        published_date?: string;
    }>;
    images?: Array<{
        url: string;
        description?: string;
    }>;
    response_time: number;
}

Example — Advanced search with answer:

const result = await corsair.tavily.api.search({
    query: "How does React Server Components work?",
    search_depth: "advanced", 
    include_answer: true,     
    max_results: 10,
});

console.log("Answer:", result.data.answer);
console.log("Sources:", result.data.results.map(r => r.url));

Example — News search:

const news = await corsair.tavily.api.search({
    query: "AI funding news",
    topic: "news",       
    time_range: "week",  
    max_results: 10,
});

Example — Domain-filtered search:

const docs = await corsair.tavily.api.search({
    query: "useState hook",
    include_domains: ["react.dev", "developer.mozilla.org"], 
});

On this page