blog · guide · real-time monitoring

How to Monitor Twitter Accounts for New Tweets in Real-Time

published May 3, 2026

> REAL-TIME ACCOUNT MONITORINGSIGNAL: LIVE

Staying up-to-date with specific Twitter accounts is essential for market intelligence, competitive analysis, and trend spotting. This guide shows you how to set up automated monitoring for new tweets from any Twitter account using TwitterAPI.io's powerful Advanced Search API.

[ section_01 ]

Why Monitor Specific Twitter Accounts?

Real-time monitoring of Twitter accounts offers numerous advantages:

  • Track competitors' product announcements
  • Monitor industry influencers for breaking news
  • Get instant alerts when key stakeholders mention your brand
  • Automate responses to customer service tweets
  • Identify trending topics within your niche

Let's see how you can implement this with just a few lines of code.

[ section_02 ]

Implementation Guide: Monitoring New Tweets

[ step_01 ] set up your project

First, you'll need to create an account on TwitterAPI.io and get your API key. New accounts receive $1 in free credits to test the service.

For Python users, ensure you have the requests library installed:

pip install requests

[ step_02 ] create the monitoring script

Set Time Windowsince_time / until_timeMake API Requestadvanced_searchProcess TweetsParse ResponseUpdate Last CheckStore timestampTake ActionAlert / Store / ProcessWait IntervalSleep until next checkTWEET MONITORING PROCESS FLOWoptimize cycle frequency to balance timely updates and API costs

Here's a complete script that checks for new tweets from a specific account:

import requests
import time
from datetime import datetime, timedelta, timezone

# Configuration
API_KEY = "Your API Key"  # TODO Replace with your TwitterAPI.io API key. You can find it in https://twitterapi.io/dashboard.
TARGET_ACCOUNT = "elonmusk"  # The account you want to monitor
CHECK_INTERVAL = 300  # Check every 5 minutes (300 seconds)
LAST_CHECKED_TIME = datetime.now(timezone.utc) - timedelta(hours=1)  # Start by checking the last hour

def check_for_new_tweets():
    global LAST_CHECKED_TIME

    # Compute the time window. The backend expects since_time / until_time
    # as Unix second timestamps in the query params (since:/until: in the
    # query string is no longer supported).
    until_time = datetime.now(timezone.utc)
    since_time = LAST_CHECKED_TIME

    # Construct the query
    query = f"from:{TARGET_ACCOUNT} include:nativeretweets"
    # Please refer to this document for detailed Twitter advanced search syntax.
    # https://github.com/igorbrigadir/twitter-advanced-search

    # API endpoint
    url = "https://api.twitterapi.io/twitter/tweet/advanced_search"

    # Request parameters
    params = {
        "query": query,
        "queryType": "Latest",
        "since_time": int(since_time.timestamp()),   # Unix seconds
        "until_time": int(until_time.timestamp()),
    }

    # Headers with API key
    headers = {
        "X-API-Key": API_KEY
    }

    # Make the request and handle pagination
    all_tweets = []
    next_cursor = None

    while True:
        # Add cursor to params if we have one
        if next_cursor:
            params["cursor"] = next_cursor

        response = requests.get(url, headers=headers, params=params)

        # Parse the response
        if response.status_code == 200:
            data = response.json()
            tweets = data.get("tweets", [])

            if tweets:
                all_tweets.extend(tweets)

            # Check if there are more pages
            if data.get("has_next_page", False) and data.get("next_cursor", "") != "":
                next_cursor = data.get("next_cursor")
                continue
            else:
                break
        else:
            print(f"Error: {response.status_code} - {response.text}")
            break

    # Process all collected tweets
    if all_tweets:
        print(f"Found {len(all_tweets)} total tweets from {TARGET_ACCOUNT}!")
        for tweet in all_tweets:
            print(f"[{tweet['createdAt']}] {tweet['text']}")
            # Here you could send notifications, save to database, etc.
    else:
        print(f"No new tweets from {TARGET_ACCOUNT} since last check.")

    # Update the last checked time
    LAST_CHECKED_TIME = until_time

# Main monitoring loop
def main():
    print(f"Starting to monitor tweets from @{TARGET_ACCOUNT}")
    print(f"Checking every {CHECK_INTERVAL} seconds")

    try:
        while True:
            check_for_new_tweets()
            time.sleep(CHECK_INTERVAL)
    except KeyboardInterrupt:
        print("Monitoring stopped.")

if __name__ == "__main__":
    main()
[ section_03 ]

Beyond Account Monitoring: Advanced Queries

The example above targets a single account via from:<account>, but the underlying endpoint is the Advanced Search API — the same endpoint that powers X's own search UI. You can combine much richer filters to monitor exactly what matters to your use case: keywords, hashtags, cashtags, time windows, geography, language, engagement thresholds, media type, and more.

[ common_operators ]
  • keywords / phrases"product launch" OR "token drop"
  • hashtags / cashtags#ai OR $NVDA
  • time windowssince_time / until_time (Unix seconds, request params)
  • geographynear:"San Francisco" within:50mi
  • languagelang:en
  • engagement thresholdsmin_faves:100 min_retweets:20
  • media typefilter:images filter:videos -filter:replies

Swap the query string in the script above for any combination of these operators and the rest of the monitoring loop (pagination, time-window tracking, billing) keeps working unchanged — only the shape of the match set changes.

[ syntax_reference ]

For the complete, up-to-date operator list — including less common operators like conversation_id:, card_name:, and list: — see the community-maintained reference at igorbrigadir/twitter-advanced-search.

[ section_04 ]

Optimize Your Monitoring Frequency

The script above checks for new tweets every 5 minutes. You can adjust the CHECK_INTERVAL variable based on your needs:

[ high_priority ]
High-Priority Accounts
1–5 minutes
[ regular ]
Regular Monitoring
15–30 minutes
[ casual ]
Casual Tracking
1–2 hours

Remember that more frequent checks will increase your API usage and costs.

[ advanced ]

Advanced Implementation: Using Pagination

If the account you're monitoring posts many tweets, you may need to handle pagination. The API returns has_next_page and next_cursor fields to help you navigate through multiple pages of results.

[ section_05 ]

Cost Considerations and Optimization

TwitterAPI.io's pricing is straightforward, but it's important to understand how your monitoring strategy affects costs:

COST COMPARISON BY MONITORING FREQUENCY$0$1$2$3$4$5$6$7Every hourEvery 30 minEvery 15 minEvery 5 minEvery 1 min$0.11$0.22$0.43$1.30$6.48Higher Frequency Costs:Every 10 seconds: $39/monthEvery 1 second: $389/monthMONITORING FREQUENCYMONTHLY COST ($)
[ api_pricing ]
  • When tweets are found: $0.00015 per tweet returned
  • When no tweets are found: $0.00015 per API call
[ optimization_tips ]
  • Adjust monitoring frequency based on account activity
  • Use smart time windows for efficient checking
  • Implement batch processing for multiple accounts

[ cost_example_calculations ]

Let's compare different monitoring strategies for a 30-day month:

[ scenario_01 ]

Checking every 5 minutes

  • ·288 checks per day × 30 days = 8,640 API calls per month
  • ·If 20% of calls find tweets (average 2 tweets each):
  • 1,728 calls with tweets: 1,728 × 2 tweets × $0.00015 = $0.5184
  • 6,912 calls without tweets: 6,912 × $0.00015 = $1.0368
  • =Total monthly cost: $1.5552
[ scenario_02 ]

Checking every 30 minutes

  • ·48 checks per day × 30 days = 1,440 API calls per month
  • ·If 60% of calls find tweets (average 3 tweets each):
  • 864 calls with tweets: 864 × 3 tweets × $0.00015 = $0.3888
  • 576 calls without tweets: 576 × $0.00015 = $0.0864
  • =Total monthly cost: $0.4752

By optimizing your check frequency, you can significantly reduce costs while still capturing the tweets you need.

[ section_06 ]

Real-World Applications

[ customer_service ]

Customer Service

Automatically detect when customers mention your brand for quick response

[ competitive_intel ]

Competitive Intelligence

Track product launches and marketing campaigns from competitors

[ crypto_trends ]

Cryptocurrency Trends

Monitor crypto KOLs for token launches and market sentiment signals

[ financial_markets ]

Financial Markets

Track influential traders and get early signals for investment opportunities

Each of these applications can be implemented using the monitoring script we've provided, with minor modifications to handle the specific requirements of your use case.

[ section_07 ]

Conclusion

Setting up automated monitoring for Twitter accounts is straightforward with TwitterAPI.io's Advanced Search API. With just a few lines of code, you can create a robust system that keeps you informed about new tweets from any account in near real-time.

By carefully optimizing your monitoring frequency and implementing smart pagination handling, you can build a cost-effective solution that meets your specific needs.

[ get_started ]

Ready to start?

Sign up for TwitterAPI.io today and get $1 in free credits to begin monitoring Twitter accounts immediately.

start free trial