Data Analysis

    How to Find Old Tweets by Keyword on X (With and Without Code)

    By Desearch Editorial Team7 min read

    To find old tweets by keyword, search X for the keyword plus a date range: "your keyword" since:2025-01-01 until:2025-02-01. Add from:username to limit it to one account, then open the Latest tab to see results in date order. To collect the same posts in code, send the same query to an X search API with a start and end date.

    This guide covers both: the search operators that work in the X search box, and a Python script that pulls matching posts through the Desearch X API.

    Build the search query

    X search accepts operators inside the query itself. These are the ones that matter most for finding older posts:

    OperatorWhat it doesExample
    "exact phrase"Matches the exact words in order"search api"
    ORMatches either termagents OR agentic
    -wordExcludes a termbittensor -price
    from:usernamePosts sent by one accountfrom:NASA
    to:usernameReplies sent to one accountto:NASA
    since:YYYY-MM-DDOn or after this date (inclusive)since:2025-01-01
    until:YYYY-MM-DDBefore this date (not inclusive)until:2025-02-01
    lang:xxPosts in one languagelang:en
    min_faves:NAt least N likesmin_faves:50
    -filter:repliesLeaves out replies-filter:replies

    Because until: is not inclusive, since:2025-01-01 until:2025-01-02 returns posts from January 1 only. The full operator list is in the X query syntax guide.

    A complete query looks like this:

    "decentralized search" from:desearch_ai since:2025-01-01 until:2025-07-01 -filter:replies
    

    Find old tweets on X without code

    1. Open X and click the search box.
    2. Type the query, for example "product launch" since:2024-03-01 until:2024-04-01.
    3. Press Enter and select Latest to sort by date instead of engagement.
    4. Narrow the range if the results are too broad, or add from: to focus on one account.

    X also has an Advanced Search form at x.com/search-advanced that builds the same operators from input fields.

    Old posts can still be missing. Posts that were deleted, or that belong to protected or suspended accounts, don't appear in public search results.

    Collect old tweets with the Desearch X API

    Manual search works for a few posts. For analysis, you need the results as data. The Desearch X API accepts the same query syntax through GET /twitter, plus dedicated date parameters:

    ParameterMeaning
    queryThe search query, including operators
    start_dateStart date in UTC, YYYY-MM-DD
    end_dateEnd date in UTC, YYYY-MM-DD
    sortTop or Latest
    countPosts to return, 1 to 100 (default 20)
    langLanguage code, such as en
    min_likesMinimum number of likes

    A single request:

    curl --request GET 'https://api.desearch.ai/twitter?query=%22decentralized%20search%22&start_date=2025-01-01&end_date=2025-02-01&sort=Latest&count=100' \
      --header "Authorization: $DESEARCH_API_KEY"
    

    Get an API key from Desearch Console. You don't need an X developer account.

    Search a long period in date windows

    Each request returns up to 100 posts. To cover several months, split the range into smaller windows and make one request per window:

    import os
    from datetime import date, datetime, timedelta
    
    import requests
    
    API_KEY = os.environ["DESEARCH_API_KEY"]
    
    def search_window(query, start, end):
        response = requests.get(
            "https://api.desearch.ai/twitter",
            headers={"Authorization": API_KEY},
            params={
                "query": query,
                "start_date": start.isoformat(),
                "end_date": end.isoformat(),
                "sort": "Latest",
                "count": 100,
            },
        )
        response.raise_for_status()
        return response.json()
    
    def find_old_tweets(query, start, end, days_per_window=7):
        posts = {}
        window_start = start
        while window_start < end:
            window_end = min(window_start + timedelta(days=days_per_window), end)
            for post in search_window(query, window_start, window_end):
                posts[post["id"]] = post  # de-duplicate across windows
            window_start = window_end
        return list(posts.values())
    
    def posted_at(post):
        # created_at looks like "Mon May 26 12:53:11 +0000 2025"
        return datetime.strptime(post["created_at"], "%a %b %d %H:%M:%S %z %Y")
    
    tweets = find_old_tweets('"decentralized search"', date(2025, 1, 1), date(2025, 4, 1))
    for post in sorted(tweets, key=posted_at):
        print(posted_at(post).date(), post["user"]["username"], post["text"][:80])
    

    If a window returns 100 posts, it probably has more matches than one request can return. Make that window smaller, for example one day instead of seven.

    Each post includes id, text, created_at, url, engagement counts such as like_count, retweet_count, and reply_count, and the author in user. The list drops straight into a pandas DataFrame, as shown in Twitter API data analysis with Python.

    What it costs

    X Search is billed at $0.15 per 1,000 posts (reference rate as of 7 May 2026, see pricing). Every billable response reports its exact cost in the X-Desearch-Cost-Usd header, so you can log the cost of each window as the script runs.

    Frequently asked questions

    How do I search tweets from a specific date?

    Use since: and until: together. For posts from March 5, 2025, search your keyword since:2025-03-05 until:2025-03-06. Through the API, set start_date and end_date instead.

    How do I find old tweets from one account?

    Combine from: with a keyword and a date range, for example from:NASA moon since:2024-01-01 until:2024-06-01. To get an account's most recent posts without a keyword, use GET /twitter/user/posts in the Desearch X API.

    Why can't I find a tweet I know exists?

    It may have been deleted, or the account may be protected or suspended. Check the date range too: until: excludes the end date, so a range that ends on the day of the post misses it.

    Put your next idea to work.

    Try a query in the playground, then use the docs to bring Desearch into your application.

    Browse more articles