How can I filter the results by date?
Last updated: August 6, 2025
Using the time_range Parameter
The time_range parameter in Tavily allows you to filter search results based on a specific time period back from the current date. It accepts the following options:
dayordweekorwmonthormyearory
You can use this parameter to specify how far back in time you want to search for results.
Filtering News Results Using topic: "news" and days Parameters
When topic is set to news, you can use the days parameter to define the number of days back from the current date to include results.
days(integer)Default:
3Description: Specifies the number of days back from the current date to include.
Required Range:
x >= 0
This allows more precise filtering, especially for retrieving recent news articles.
Filtering Using start_date and end_date
For more precise control over the date range, you can use the start_date and end_date parameters. These allow filtering results published after or before specific dates.
start_date (string)
Returns all results published after the specified start date.
Must be written in the format:
YYYY-MM-DDExample:
"2025-02-09"
end_date (string)
Returns all results published before the specified end date.
Must be written in the format:
YYYY-MM-DDExample:
"2000-01-28"