How to Scrape Twitter (X) Without the Official API

You can scrape Twitter/X without the official API in two ways: use a third-party data API like TwitterAPI.io that returns tweets, users, and search results via simple HTTPS calls with just an API key (no OAuth, no developer approval) — or build your own browser-based scraper (free but ban-prone and high-maintenance). For anything beyond a tiny experiment, the third-party API is the practical choice, and this guide shows working code for both so you can decide.
People look for a no-official-API route for good reasons: the official X API requires a developer-account approval (1-2 weeks), starts at a $200/month floor, and caps reads at 2,000,000/month. If you just need tweets and user data for monitoring, research, or an AI agent, that's a lot of friction and cost for data that's publicly visible on the site.
The honest framing: "scraping without the API" splits into two very different things. One is calling a different API (a third-party SaaS that does the data collection for you) — clean, reliable, paid per call. The other is browser scraping (driving a headless browser or hitting X's web endpoints yourself) — free in theory, but a maintenance and ban treadmill in practice. We'll cover both.
Why avoid the official Twitter (X) API?
The official API isn't bad — it's just heavy for pure data collection. Three friction points push people to alternatives:
Approval delay: you must create an X developer account and get a project approved before your first authenticated call — typically 1-2 weeks, sometimes rejected.
Cost floor: the cheapest paid tier (Basic) is $200/month even if you make ten calls; the next tier (Pro) is $5,000/month. There's no true pay-as-you-go.
Read cap: all tiers below Enterprise share a 2,000,000 Post-reads/month hard cap. Hit it and you're forced into an Enterprise contract ($42,000+/month).
For a startup, researcher, or indie developer who just needs public tweets, that economics rarely makes sense — hence the search for a no-official-API path.
Option 1 — A third-party data API (the practical route)
The cleanest way to get Twitter data without the official API is to call a third-party data API. You don't scrape anything yourself — the provider handles collection and returns structured JSON. TwitterAPI.io is one such service: you sign in with Google, get an API key (no OAuth, no developer approval), and call endpoints like advanced search and user timelines directly.
What you get: ~75 endpoints (tweets, users, followers, mentions, replies, quotes, trends), pay-per-call pricing (~$0.15 per 1,000 tweets, no monthly floor, no read cap), and a $1 trial credit (no card). Setup to first call is about 5 minutes.
Why it's the practical choice: it's reliable (a single vendor maintains the surface, unlike a DIY scraper that breaks on every X change), it's a SaaS API call (cleaner compliance profile than scraping x.com directly), and it scales — you pay only for what you use. The code below is a complete working example.
The catch: it costs money per call (though far less than the official API for most workloads), and it's read-focused — it supports common writes (post/like/retweet/follow) but not DM-send (API DMs trigger account bans).
Option 2 — DIY browser scraping (free but fragile)
The truly-free route is scraping X yourself. Two common tools:
snscrape: a Python library that reads X's web responses without login. It was excellent pre-2023, but X's aggressive anti-scrape measures now mean frequent IP bans and rate-limiting. To stay stable you need a rotating proxy pool — which costs money and erodes the "free" advantage. It also occupies a legal grey area (scraping the site vs. calling a SaaS API have different compliance profiles).
Playwright / Puppeteer (headless browser): drives a real browser to load pages and parse the DOM. It works for small volumes but is slow (seconds per page), brittle (breaks whenever X changes its markup, forcing selector rewrites), and ban-prone (triggers captchas and account locks). Realistic ceiling is well under 1,000 items/day before the bans and maintenance overwhelm the value.
When DIY makes sense: a one-off academic sample, a throwaway proof-of-concept, or a learning exercise — situations where reliability doesn't matter and the budget is exactly zero. For anything ongoing or production-grade, almost every team migrates off DIY onto a maintained API.
How to scrape Twitter data with a third-party API (step-by-step)
Here's the full flow with TwitterAPI.io, the Option-1 route:
1. Get an API key: sign in with Google at twitterapi.io and copy the key from the dashboard. The $1 trial credit (~6,000 calls) needs no card.
2. Search or pull a timeline: call /twitter/tweet/advanced_search with a query (keywords, hashtags, from:user, date ranges), or /twitter/user/last_tweets for a specific account's recent posts. Both return structured JSON.
3. Paginate: responses include a cursor; pass it back to fetch the next page until you've collected what you need.
4. Store: write the JSON to your database, CSV, or data warehouse. That's the whole pipeline — no proxies, no browser, no selector maintenance.
The code snippet below does steps 2-3 end to end in Python.
Is scraping Twitter without the official API legal?
This is the question that matters most for commercial projects, and the answer differs by route.
Calling a third-party SaaS API (Option 1) is the same legal model as using any data vendor — you're making an authorized API call to a service, over HTTPS, governed by that service's terms. It's the cleaner profile. You're still responsible for complying with data-protection law (GDPR, CCPA, PIPL) for any personal data you process and store.
Browser scraping x.com directly (Option 2) is murkier — it may conflict with X's Terms of Service, and the legal treatment of web scraping varies by jurisdiction and purpose (public vs. non-public data, commercial vs. research use). Courts have reached different conclusions in different cases.
Practical guidance: for any commercial or production use, prefer the SaaS-API route and consult your legal team. Collect only the public data you actually need, honor takedown/deletion obligations, and don't store personal data longer than necessary. This is general information, not legal advice.
Which option should you choose?
A quick decision guide:
Choose the third-party API (TwitterAPI.io) if: you need reliability, you're building anything ongoing or production-grade, you want fast setup, you're cost-sensitive but not zero-budget, or you're feeding an AI agent / analytics pipeline. This covers the large majority of real use cases.
Choose DIY scraping if: it's a one-off tiny sample, a learning project, or a throwaway PoC where bans and maintenance don't matter and the budget is exactly $0 — and you accept it'll likely break.
Choose the official X API if: you specifically need write-at-scale, DM-send, the Ads API, or official partner status — none of which the no-official-API routes provide.
For most readers landing on this page, Option 1 is the answer: it removes the official API's friction (no approval, no $200 floor, no read cap) without taking on the fragility of DIY scraping.
# Scrape Twitter (X) without the official API — via TwitterAPI.io
# API key only: no OAuth, no developer-account approval.
import requests
API_KEY = "YOUR_KEY" # from the twitterapi.io dashboard ($1 trial, no card)
HEADERS = {"X-API-Key": API_KEY}
def search_tweets(query, max_pages=5):
"""Collect tweets matching an advanced-search query, with pagination."""
url = "https://api.twitterapi.io/twitter/tweet/advanced_search"
cursor, out = None, []
for _ in range(max_pages):
params = {"query": query, "queryType": "Latest"}
if cursor:
params["cursor"] = cursor
r = requests.get(url, headers=HEADERS, params=params, timeout=30)
r.raise_for_status()
data = r.json()
out.extend(data.get("tweets", []))
cursor = data.get("next_cursor")
if not cursor:
break
return out
def user_recent(username):
"""Pull a single account's most recent tweets."""
url = "https://api.twitterapi.io/twitter/user/last_tweets"
r = requests.get(url, headers=HEADERS, params={"userName": username}, timeout=30)
r.raise_for_status()
return r.json()
if __name__ == "__main__":
tweets = search_tweets('"twitter scraper" lang:en', max_pages=3)
print(f"collected {len(tweets)} tweets")
print(user_recent("openai"))
# No proxies, no headless browser, no selector maintenance.Questions readers ask
Can I scrape Twitter without a developer account?
Yes. A third-party data API like TwitterAPI.io needs only an API key (Google sign-in, no card, $1 trial credit) — no X developer account, no OAuth, no 1-2 week approval. DIY browser scraping (snscrape, Playwright) also needs no developer account, but it's ban-prone and high-maintenance. Either way you skip the official developer-account process.
Is it legal to scrape Twitter without the API?
Calling a third-party SaaS API (you make an authorized HTTPS call to a data vendor) is the cleaner legal model — the same as using any data service, subject to data-protection law for personal data. Scraping x.com directly with a browser is murkier and may conflict with X's Terms; treatment varies by jurisdiction and purpose. For commercial use, prefer the SaaS-API route and consult your legal team. This is general information, not legal advice.
Is snscrape still working in 2026?
snscrape still functions intermittently, but X's anti-scrape measures since 2023 cause frequent IP bans and rate-limiting, so you need a rotating proxy pool to keep it stable — which adds cost and complexity. For reliable, ongoing collection most teams have moved to a maintained third-party API rather than fighting the ban treadmill.
How much does it cost to scrape Twitter without the official API?
A third-party API like TwitterAPI.io is pay-per-call: ~$0.15 per 1,000 tweets ($0.00015/call), no monthly floor, with a $1 trial credit (~6,000 calls) to start. DIY scraping is 'free' in code but needs a proxy pool (often $50-$500/month at any real volume) plus your maintenance time — so it's rarely actually free at scale.
What's the difference between a Twitter scraper and a Twitter API?
A scraper reads X's website (HTML/web responses) and parses it — fragile, because it breaks when X changes its markup, and ban-prone. An API returns structured JSON over a stable contract — reliable and maintained. A third-party data API like TwitterAPI.io gives you API reliability without needing the official API's OAuth/approval/floor.
Can I get historical tweets without the official API?
Yes — TwitterAPI.io's advanced search supports date-range queries (since:/until: or explicit date params), so you can pull historical public tweets via pagination without the official API's full-archive tier. DIY scraping can sometimes reach older tweets too, but rate-limits and bans make large historical pulls impractical.
Can I scrape tweets in real time without the API?
Yes. TwitterAPI.io offers webhook rules (/oapi/tweet_filter/add_rule) that push matching tweets to your endpoint seconds after they're posted — real-time without polling and without the official API's filtered-stream tier. DIY scraping can't do reliable real-time at any scale because of rate-limiting.
Continue
- X — Developer Agreement and Policy (official terms)
- snscrape — open-source scraper (GitHub)
- Playwright for Python — official documentation
- GDPR — overview of EU data-protection obligations
- The best third-party Twitter (X) API in 2026 →
- What does the X API cost in 2026? →
- API docs — search, users, webhooks →
- Pay-per-call pricing →
Stop reading. Start building.
Starter credits cover real testing on real data. Google sign-in, no card, no application queue.
Get an API key