How to Scrape Twitter (X) Without the Official API

- Two routes without the official API: a third-party data API (TwitterAPI.io) or DIY browser scraping (snscrape / Playwright)
- Third-party API: API key only, no OAuth or X developer account, pay-per-result (~$0.15/1,000 tweets), reliable — good for production
- DIY scraping: free but breaks on every X change, gets IP-banned, needs a proxy pool — only for tiny experiments
- Neither needs an X developer account or a payment card saved on X
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 X developer account) — 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 an X developer account and a saved payment card, bills $0.005 for every post read (1M posts = $5,000), and caps pay-per-use at 3,000,000 Post reads per monthly billing cycle, with Enterprise above that. 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.
DIY browser scraping realistically tops out well under 1,000 items/day before X's anti-scrape systems (IP bans, captchas, markup changes) make it unworkable — and that's before counting the proxy-pool cost and ongoing selector maintenance. A third-party API like TwitterAPI.io has no such ceiling: pay-per-result with no 15-minute windows (20 requests/s once paid, up to 500 on Business), so the same pipeline scales from a hundred to millions of tweets with no code changes.
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:
Account setup: you must create an X developer account and save a payment card before your first authenticated call. X does not publish how long approval takes, and it varies.
Per-read cost: there's no subscription, but every post read costs $0.005 and every user read $0.010, so 100,000 posts read is $500 and 1M is $5,000.
Read cap: pay-per-use stops at 3,000,000 post reads per monthly billing cycle. Above that you need Enterprise, requested through an interest form with no public price.
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 X developer account), and call endpoints like advanced search and user timelines directly.
What you get: 75+ endpoints (tweets, users, followers, mentions, replies, quotes, trends), pay-per-result pricing (~$0.15 per 1,000 tweets, no monthly floor, no read cap), and free starter credits on signup (for new accounts that pass the automatic bot check, one per person and network, no card, expires after 31 days). 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 about 33x less per read than the official X API pay-per-use rate), 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. Cloud automation tools that run on your own X session cookie carry the same account dependency; our PhantomBuster alternatives for X data page measures how far their published X caps go on real follower lists.
twint: the other once-standard Python scraper met the same fate. Its repository was archived in March 2023 and the guest endpoints it read no longer answer, so a twint job needs a replacement rather than a patch; the twint flag-by-flag migration guide linked below maps each flag to a working endpoint.
snscrape's guest-token flow has returned blocked (404) since X's 2023 login wall; the snscrape migration guide maps every scraper and Tweet field to a working endpoint.
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 free starter credits (for new accounts that pass the automatic bot check, one per person and network, expiring after 31 days) need 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 above all 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 the majority of readers landing on this page, Option 1 is the answer: it removes the official API's friction (no developer account, no $0.005-per-post bill, 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 X developer account.
import requests
API_KEY = "YOUR_KEY" # from the twitterapi.io dashboard (free starter credits for new accounts: bot check, one per person or network, expires after 31 days, 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 latest 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.Researching this?Free starter credits cover end-to-end testing — Google sign-in, no card. Get a key.
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; free starter credits for new accounts that pass the bot check, one per person or network, expiring after 31 days) — no X developer account, no OAuth, no payment card saved on X. 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?
Not for X. snscrape's Twitter module relies on a guest-token flow that X closed with its 2023 login wall, and the project's own issue tracker (issue #996) has tracked the resulting blocked (404) errors ever since; other networks in snscrape are unaffected. Teams that still need X data have moved to a maintained API; see the snscrape migration guide for a field-by-field mapping.
How much does it cost to scrape Twitter without the official API?
A third-party API like TwitterAPI.io is pay-per-result: ~$0.15 per 1,000 tweets ($0.00015 per tweet; a full 20-tweet page costs $0.003), no monthly floor, with free starter credits (for new accounts that pass the automatic bot check, one per person and network, no card, expires after 31 days) 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, developer account, or per-read billing.
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 paying the official API's $0.005 per post read for full-archive search. 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, usually within minutes, without polling and without the official API's filtered stream. For a fixed list of accounts there is also Twitter Stream account monitoring, where the majority of tweets arrive within seconds. DIY scraping can't do reliable push delivery 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
- Unofficial Twitter API options compared, with GitHub data
- The best third-party Twitter (X) API in 2026 →
- What does the X API cost in 2026? →
- API docs — search, users, webhooks →
- Pay-per-use pricing →
- Twint flag-by-flag migration guide: every flag mapped to a working endpoint
- snscrape migration guide
- PhantomBuster alternatives for X data
- Twitter scraper API: endpoints, Python examples and costs
- 01Soft Block on Twitter (X): What It Is, What They See, and When to Use Remove Follower Instead
- 02Twitter (X) 2FA: How to Turn On Two-Factor Authentication
- 03Twitter (X) API + Streamlit: Build a Live Hashtag Dashboard
- 04X API 402 Payment Required: What It Means on Twitter (X) Pay-Per-Use and How to Fix It
- 05x-rate-limit-reset and the Other Twitter (X) API Rate-Limit Headers, Decoded
- 06TwitterAPI.io vs the Official X (Twitter) API — A 2026 Comparison
- 07"Please Use the Official X App" When Signing In to Twitter (X): Why It Happens and How to Get Back In
- 08Twitter (X) Profile Analytics — How to Pull User Metrics via API
Writing about something you built with TwitterAPI.io? Our community rewards program pays API credits for honest tutorials, build logs and videos.
Stop reading. Start building.
Starter credits cover real testing on real data. Google sign-in, no card, no application queue.
Get an API keyAlready building with TwitterAPI.io? Publish an honest tutorial or build log about it and earn up to $200 a month in API credits.