← Back to Tavily

Tavily Search

Execute a search query using Tavily Search.

Tavily·Dynamic pricing

Dynamic pricing

body.auto_parameters ? 0.02 : (lower(body.search_depth) == 'advanced' ? 0.02 : 0.01)

Example code

// Using @orth/sdk - The simplest way to call APIs // Install: npm install @orth/sdk import Orthogonal from "@orth/sdk"; const orthogonal = new Orthogonal({ apiKey: process.env.ORTHOGONAL_API_KEY, }); const output = await orthogonal.run({ api: "tavily", path: "/search", body: { "query": "example" } }); console.log(output);

Body parameters

queryrequired
string

The search query to execute with Tavily.

search_depth
enum<string>

Controls the latency vs. relevance tradeoff and how results[].content is generated: advanced: Highest relevance with increased latency. Best for detailed, high-precision queries. Returns multiple semantically relevant snippets per URL (configurable via chunks_per_source). basic: A balanced option for relevance and latency. Ideal for general-purpose searches. Returns one NLP summary per URL. fast: Prioritizes lower latency while maintaining good relevance. Returns multiple semantically relevant snippets per URL (configurable via chunks_per_source). ultra-fast: Minimizes latency above all else. Best for time-critical use cases. Returns one NLP summary per URL. Cost: basic, fast, ultra-fast: 1 API Credit advanced: 2 API Credits See Search Best Practices for guidance on choosing the right search depth.

chunks_per_source
integer

Chunks are short content snippets (maximum 500 characters each) pulled directly from the source. Use chunks_per_source to define the maximum number of relevant chunks returned per source and to control the content length. Chunks will appear in the content field as: <chunk 1> [...] <chunk 2> [...] <chunk 3>. Available only when search_depth is advanced.

max_results
integer

The maximum number of search results to return.

topic
enum<string>

The category of the search.news is useful for retrieving real-time updates, particularly about politics, sports, and major current events covered by mainstream media sources. general is for broader, more general-purpose searches that may include a wide range of sources.

time_range
enum<string>

The time range back from the current date to filter results based on publish date or last updated date. Useful when looking for sources that have published or updated data.

start_date
string

Will return all results after the specified start date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD

end_date
string

Will return all results before the specified end date based on publish date or last updated date. Required to be written in the format YYYY-MM-DD

include_answer
boolean

Include an LLM-generated answer to the provided query. basic or true returns a quick answer. advanced returns a more detailed answer.

include_raw_content
boolean

Include the cleaned and parsed HTML content of each search result. markdown or true returns search result content in markdown format. text returns the plain text from the results and may increase latency.

include_images
boolean

Also perform an image search and include the results in the response.

include_image_descriptions
boolean

When include_images is true, also add a descriptive text for each image.

include_favicon
boolean

Whether to include the favicon URL for each result.

include_domains
string

A list of domains to specifically include in the search results. Maximum 300 domains.

exclude_domains
string

A list of domains to specifically exclude from the search results. Maximum 150 domains.

country
enum<string>

Boost search results from a specific country. This will prioritize content from the selected country in the search results. Available only if topic is general.

auto_parameters
boolean

When auto_parameters is enabled, Tavily automatically configures search parameters based on your query's content and intent. You can still set other parameters manually, and your explicit values will override the automatic ones. The parameters include_answer, include_raw_content, and max_results must always be set manually, as they directly affect response size. Note: search_depth may be automatically set to advanced when it's likely to improve results. This uses 2 API credits per request. To avoid the extra cost, you can explicitly set search_depth to basic.

Response

query
string
answer
null
images
array
results.0.url
string
results.0.score
number
results.0.title
string
results.0.content
string
results.0.raw_content
null
request_id
string
response_time
number
follow_up_questions
null
    Orthogonal - Giving AI agents the tools they need.