Docs


Twitter Advanced Search Parameters in the Search Text Field


Twitter's advanced search functionality offers powerful options to refine your queries directly in the search text field. By appending specific parameters, users can retrieve precise data based on various filters. Here’s a guide to the most commonly used advanced search parameters:


Commonly Used Parameters

  • from:[username]
    Fetches tweets from a specific user.
    Example: from:elonmusk retrieves tweets only from the user @elonmusk.
  • to:[username]
    Finds tweets directed to a specific user.
    Example: to:NASA retrieves tweets addressed to @NASA.
  • since:[YYYY-MM-DD]
    Filters tweets created on or after a specific date.
    Example: since:2023-01-01 fetches tweets from January 1, 2023, onward.
  • until:[YYYY-MM-DD]
    Filters tweets created before a specific date.
    Example: until:2023-12-31 retrieves tweets before December 31, 2023.
  • since_time:[UNIX_TIMESTAMP]
    Retrieves tweets from a specific time, defined as a UNIX timestamp.
    Example: since_time:1672444800 fetches tweets from January 1, 2023, 00:00 UTC.
  • until_time:[UNIX_TIMESTAMP]
    Retrieves tweets up to a specific time, defined as a UNIX timestamp.
    Example: until_time:1672531200 fetches tweets up to January 2, 2023, 00:00 UTC.
  • filter:[type]
    Filters tweets by specific content types:
    • filter:images retrieves tweets with images.
    • filter:videos retrieves tweets with videos.
    • filter:links retrieves tweets containing links.
    • filter:replies retrieves tweets that are replies to other tweets.
      Example: from:elonmusk filter:replies retrieves all reply tweets from @elonmusk.
  • lang:[language_code]
    Filters tweets by language using two-letter codes (e.g., en for English, es for Spanish).
    Example: lang:en fetches tweets in English.

Excluding Words or Filters

You can exclude specific words, phrases, or filters from your search results by using the - (minus) operator before a parameter or word:

  • Exclude Words:
    To exclude tweets containing a specific word or phrase:
    Example: from:NASA -Mars retrieves tweets from @NASA that do not mention "Mars."
  • Exclude Filters:
    To exclude tweets with a specific content type or parameter:
    Example: from:elonmusk -filter:replies retrieves all tweets from @elonmusk that are not replies.

Combining Parameters

You can combine multiple parameters in a single search query for highly specific results. For instance:

from:elonmusk since:2025-01-01 until:2025-01-07 Tesla -filter:replies

This query retrieves tweets by @elonmusk mentioning "Tesla" between January 1 and January 7, 2025, excluding replies.


Practical Examples

  1. Event Monitoring
    #WorldCup2022 since:2022-11-20 until:2022-12-18
    Retrieves tweets about the 2022 World Cup during the event dates.
  2. Topic Tracking
    from:NASA Mars filter:images -filter:replies
    Finds tweets from NASA about Mars that include images but are not replies.
  3. Historical Analysis
    from:BillGates lang:en since:2022-01-01 -filter:links
    Retrieves English tweets from Bill Gates starting January 1, 2022, excluding those with links.

Tips for Effective Search

  • Be Specific: Combine parameters for more precise results.
  • Understand Time Zones: Use since_time and until_time for exact timing in UTC.
  • Exclude Noise: Use the - operator to filter out irrelevant data.
  • Experiment: Adjust and mix parameters to refine searches.

These advanced search parameters provide unparalleled control over the data you retrieve, helping you locate exactly what you need on Twitter with ease.