Skip to content

How do you search tweets by date?

Last updated August 3, 2026

You bound the query with date operators rather than filtering afterwards. Add since and until in YYYY-MM-DD form to the query string, where since is inclusive and until is exclusive, and pass it to advanced search. For finer control use a timestamp form with an hour and a UTC marker, or epoch seconds, at $0.0008 per call.

Every rate here is the pricing TwitterAPIs publishes, $0.0008 per call and $0.04 per 1,000 tweets (source: twitterapis.com/pricing).

Which operators bound a query to a date range?

The pair to reach for first is since and until, each taking a YYYY-MM-DD value. The since bound includes the day you name and the until bound excludes it, which trips people who expect both ends to behave the same way. So a query bounded by January the first and March the first covers January and February in full and returns nothing dated on the first of March.

How do you narrow a window to hours rather than days?

Three finer forms exist. A timestamp form extends the same since operator with an hour, minute, second and a UTC marker for timezone-aware bounds. An epoch form takes raw Unix seconds. And an identifier form bounds by post id instead, which works because those ids increase monotonically over time, so an id is itself a position on the clock.

Is there a rolling window for recent activity?

Yes, expressed as a duration rather than a fixed point: two days, three hours, five minutes, thirty seconds. It is measured from the moment the query runs, which makes it convenient for monitoring and unsuitable for anything that has to be reproducible. Run the same rolling query tomorrow and it covers a different span, so archive work should always use fixed bounds.

Why does a date-only query return nothing?

Because a time bound is a filter, not a subject. On its own it describes a slice of the timeline with no topic attached, and the response comes back empty. Every date operator has to ride alongside something to match: a keyword, a handle, or a hashtag. Add the subject back and the same bounds start returning results immediately.

How should a deep historical pull be structured?

Slice it rather than paging it. Results carry a cursor you feed back until it comes back empty, but a single chain grows unreliable past roughly ten pages, where repeats and early stops appear. The fix is to cut the range into consecutive windows with the date operators and run each as its own query, dropping to hourly slices with the timestamp form wherever a window is dense.

Date operators and what each is for

FormValue it takesBest used for
Day boundsA YYYY-MM-DD date, start inclusive, end exclusiveEveryday range queries
Timestamp boundsA date with hour, minute, second and a UTC markerSlicing a dense day into hours
Epoch boundsRaw Unix secondsMachine-generated ranges
Identifier boundsA post id, which increases over timeResuming exactly where a job stopped
Rolling windowA duration such as two days or three hoursMonitoring, never reproducible pulls
The search endpoints accept a single query with a GET request and return a set of historical Posts that match the query.
X Developer Platform, build a query documentation. Source

Questions and answers

What is the syntax for searching between two dates?
Add the since and until operators to the query, each with a YYYY-MM-DD value, alongside whatever you are actually searching for. The since bound includes its day and the until bound excludes its day, so name the day after the last one you want.
Is the end date included in the results?
No. The until bound is exclusive, so nothing dated on that day comes back. The since bound is inclusive and does return its own day. Naming the same day for both therefore returns nothing at all, which is the usual explanation for an unexpectedly empty response.
Can you filter to a specific hour?
Yes. The timestamp form extends the same operator with an hour, minute and second plus a UTC marker, and an epoch form accepts raw Unix seconds. Both are the right tool when a single day holds more results than one range query can walk cleanly.
Why does my date query return zero results?
Almost always because the query is nothing but bounds. A time filter needs a subject to filter, so it must accompany a keyword, a handle or a hashtag. Add the subject and the identical bounds begin returning matches straight away.
How far back can a query reach?
On the official API the cheaper tiers are restricted to recent search with a seven day lookback, which is what stops most historical work there. Where a deeper archive is reachable, the practical limit is how carefully the range is sliced rather than a single stated cutoff.
How do you pull a very large date range?
Split it. Feed the cursor back until it empties, but do not lean on one chain past about ten pages, where repeats and early stops start appearing. Break the range into consecutive windows and run each separately, going hourly wherever the volume is heavy.

Start with $0.50 in free credits

No credit card. Roughly 12,500 tweets to test every endpoint.