All posts

How to Scrape Twitter (X) Data: Tweets, Search and Followers

November 9, 2026

Short answer

To scrape Twitter (X) data, the cleanest route is the official X API: it is pay-per-use at $0.005 per post read and $0.010 per user read, recent search covers the last 7 days, and full-archive search goes back to March 2006. Open-source tools such as twscrape skip the API but need logged-in X accounts, so most teams that want tweets, profiles and search without that risk use a hosted API.

Scraping tweets usually means one of five jobs: pull a user's timeline, search posts by keyword, read the replies to a post, look up profiles, or list followers. Each has a different cheapest route. This guide covers the official API with code and real costs, the open-source option and its limits, and a hosted API. For collecting a single thread in order, see how to scrape an X thread.

What Twitter data you can collect

JobOfficial X APICost on the official API
ProfilesUser lookup$0.010 per user
A user's timelineUser posts timeline$0.005 per post
Keyword search, last 7 daysRecent search, 100 posts per call$0.005 per post
Keyword search, since 2006Full-archive search, 500 posts per call$0.005 per post
Replies and threadsSearch on conversation_id$0.005 per post
Followers and followingFollowers lookup, up to 1,000 per page$0.010 per user

Prices are from X's pricing page. Search limits are from the search introduction: recent search takes queries up to 512 characters, full-archive up to 1,024, and full-archive is open to pay-per-use and Enterprise customers. Followers paging uses max_results from 1 to 1,000 and a pagination_token (followers reference).

How the official X API bills you

  • Prepaid, per resource. There is no free tier for new developers. Save a card and make a first purchase and X adds $20 in credits.
  • A monthly cap. Pay-per-use plans stop at 3 million post reads per billing cycle; more needs Enterprise.
  • Free repeats within a day. Reading the same post again inside one UTC day is not charged twice. X calls this a "soft guarantee".

More on tiers and history in Is the X API free?

A Python tweet scraper on the official API

This pulls up to 500 recent posts for a query and writes a CSV. Create an app in the X Developer Console and copy its bearer token first.

import csv, requests

TOKEN = "YOUR_BEARER_TOKEN"
URL = "https://api.x.com/2/tweets/search/recent"
params = {"query": "from:NASA -is:retweet", "max_results": 100,
          "tweet.fields": "created_at,public_metrics,lang,conversation_id"}

with open("tweets.csv", "w", newline="", encoding="utf-8-sig") as f:
    w = csv.writer(f)
    w.writerow(["id", "created_at", "text", "likes", "reposts", "replies", "views"])
    for _ in range(5):
        r = requests.get(URL, params=params, timeout=30,
                         headers={"Authorization": "Bearer " + TOKEN}).json()
        for t in r.get("data", []):
            m = t["public_metrics"]
            w.writerow(["'" + t["id"], t["created_at"], t["text"], m["like_count"],
                        m["retweet_count"], m["reply_count"], m.get("impression_count")])
        token = r.get("meta", {}).get("next_token")
        if not token:
            break
        params["next_token"] = token

Five full pages is 500 posts, or $2.50. Swap the URL for /2/tweets/search/all and add start_time to go further back.

What common jobs cost

JobOfficial X APIScrapeIO at $1.88 per 1,000 credits
10,000 posts from keyword search10,000 x $0.005 = $50About 500 calls, assuming 20 posts a page = $0.94
100 profiles checked daily for 30 days3,000 x $0.010 = $303,000 calls = $5.64
Last 200 posts from 50 accounts10,000 x $0.005 = $50About 500 calls = $0.94
Full follower list of a 50,000-follower account50,000 x $0.010 = $500Not offered; use the official API

Posts per call on hosted APIs vary by endpoint and page, so treat the right column as an estimate and test on your own queries. The follower row is a real gap: ScrapeIO does not sell X follower lists, and the official API is the clean way to get them.

Open-source Twitter scrapers

twscrape (MIT, about 2,900 stars, last push 6 November 2026) is the most active Python option. It supports search, user lookup, followers, replies, timelines and trends through X's web API. The catch is in its README: it needs "authorized X accounts", ideally through the auth_token and ct0 cookies, and it warns that "X/Twitter's Terms of Service discourage using multiple accounts." Every request runs under an account you control and that has agreed to X's terms. This guide does not cover account pools or ways around rate limits.

Whatever tool you pick, check its last commit and open issues before you build on it. X changes its web API often, and unmaintained scrapers fail without warning.

Search operators that save money

Whatever route you use, a tighter query means fewer posts to pay for and read:

  • from:handle and to:handle for one account's posts or replies to it.
  • -is:retweet to drop reposts on the official API.
  • lang:en for one language.
  • Quoted phrases for exact matches.

The full list, with the differences between the official API and X's website search, is in Twitter search operators for scrapers.

A hosted API: the same jobs without X credits

curl "https://scrapeio.com/v1/twitter/search?query=from%3ANASA&type=latest" \
  -H "x-api-key: YOUR_KEY"

Search takes X's own operators and returns posts with likes, views in plays, created_at and the author. Page with data.cursor until has_more is false.

Which route fits

  • Official API: follower lists, full-archive history, anything your product must show with X's blessing.
  • twscrape: personal research from your own account, where you accept the terms risk.
  • Hosted API: timelines, search, replies and profiles at volume, without accounts or prepaid credits.

X's terms and the court cases about scraping it are covered in Is scraping X legal?

This is not legal advice. Terms and law change, and the answer depends on where you are and what you do with the data. Our guide to the main web scraping cases has the background.

Doing it with ScrapeIO

ScrapeIO's X search API, X user posts API, X profile API and X replies API cost 1 credit a call, and repeats that hit the cache are free. The X platform page lists every endpoint, and the X MCP server connects them to AI agents.

FAQ

Can you still scrape Twitter in 2026?

Yes. The official API sells reads per post and per user, open-source tools work with logged-in accounts, and hosted APIs return public posts and profiles.

How much does the X API cost?

$0.005 per post read and $0.010 per user read, prepaid, with a cap of 3 million post reads a month on pay-per-use.

Can I scrape tweets without the API?

Yes, with a tool such as twscrape that uses your own X accounts, or with a hosted API that needs only its own key.

Can you scrape Twitter followers?

The official followers endpoint returns up to 1,000 users per page at $0.010 per user. Open-source tools can also list followers through a logged-in account.

How far back can you search tweets?

Recent search covers 7 days. Full-archive search on the official API goes back to March 2006.

Sources

Checked on 9 November 2026 from each vendor's own pages. Prices and limits change; follow the links before you decide.

100 free credits, no card. Credits never expire.

Get API key