~ / endpoints / Search API

Twitter / X Search Scraper API

Our Twitter search scraper takes a keyword, hashtag, or query and a search tab, then returns the tweets X embeds for that query as structured JSON: text, author, language, and engagement per result. This endpoint is in beta because X aggressively walls logged-out search, so we return what is available and report clearly when a query comes back empty.

Get a free API keyView endpoints
1,000
free requests / mo
2.6s
median response
JSON
structured output
beta
endpoint status
the wall

Why Twitter / X Search data sits behind a login wall

X search is one of the hardest surfaces on the public web to read: a logged-out request to the search page returns a JavaScript shell with a login gate and, most of the time, no tweet data embedded at all. The official API can search, but only behind a paid developer plan that starts around 100 dollars a month.

quick start

One request to the Twitter / X Search Scraper API

cURL
curl "https://api.twitterscraperapi.com/api/v1/xtwitter/search?q=nasa&f=top&api_key=$API_KEY"
Python
import requests, os

BASE = "https://api.twitterscraperapi.com"
API_KEY = os.environ["API_KEY"]

# Query plus a search tab: top | live | user | image | video.
resp = requests.get(
    f"{BASE}/api/v1/xtwitter/search",
    params={
        "q": "nasa",
        "f": "top",
        "limit": 20,
        "api_key": API_KEY,
    },
    timeout=30,
)
data = resp.json()

# X walls logged-out search hard, so always check results_count first.
print(data["query"], "->", data["results_count"], "tweets")
for t in data["results"]:
    print(t["position"], t["author"], "-", t["full_text"])
arguments

Parameters

ParameterRequiredDefaultNotes
qrequired-The search query X accepts on /search. A keyword, phrase, @handle, or #hashtag, e.g. nasa or #space.
foptionaltopSearch tab: top, live, user, image, or video. Maps to X's own f parameter. Defaults to top.
limitoptional-Max number of tweets to return, 1 to 250. We slice the parsed list to this size.
urloptional-Alternatively pass a full x.com/search URL and we read the q and f from it instead of the separate params.
api_keyrequired-Your API key, passed as a query parameter. Get one free at signup.
what you get

The Twitter / X Search Scraper API response, field by field

200 OK
{
  "query": "nasa",
  "page": 1,
  "results_count": 1,
  "total_results": 1,
  "results": [
    {
      "position": 1,
      "id": "20",
      "title": "just setting up my twttr",
      "url": "https://x.com/jack/status/20",
      "price": null,
      "currency": "USD",
      "rating": null,
      "reviews_count": null,
      "thumbnail": null,
      "author": "jack",
      "full_text": "just setting up my twttr",
      "lang": "en",
      "retweet_count": null,
      "favorite_count": 308537,
      "reply_count": 17947,
      "created_at": "2006-03-21T20:50:14.000Z"
    }
  ]
}
FieldTypeDescription
querystringThe query that was searched, echoed back from your q input.
pageintegerThe result page number, currently 1 per request.
results_countintegerNumber of tweets returned in this response. Check this first, since a walled query can return 0.
total_resultsintegerTotal tweets parsed from the page before any limit slice was applied.
resultsarrayThe matched tweets. Each item carries position, id, title, url, author, full_text, lang, created_at, and engagement counts.
results[].authorstringThe screen_name of the tweet's author.
results[].full_textstringThe tweet body. title carries the same text for cross-category consistency.
results[].favorite_countinteger or nullLikes on the tweet when X embeds the figure, otherwise null.
results[].reply_countinteger or nullReplies on the tweet when present in the embedded data, otherwise null.
results[].created_atstring or nullWhen the tweet was posted, when X includes it in the embedded payload.
in practice

Where this Twitter / X Search data goes to work

>

Keyword and brand monitoring

Search a brand name or phrase on a schedule to catch the tweets X surfaces for it, then route text and author into your alerting.
>

Hashtag tracking

Query a #hashtag to collect the posts X returns for a campaign or event and store text, author, and engagement as JSON.
>

Topic and trend sampling

Pull the top or live tab for a topic to sample what is being said, feeding the text into sentiment or clustering.
>

Media discovery

Use the image or video tab to find tweets carrying media for a query when X embeds them in the search payload.
>

Enrich a query list

Run a batch of queries and keep only the responses where results_count is above zero, building a dataset from what is reachable.
>

Feed matches to an LLM

Pass the returned tweet text straight into a summarization or classification step as flat JSON, no HTML parsing first.
why this api

What sets our Twitter / X Search Scraper API apart

Point the endpoint at a query and tab and we fetch X's search page through rotating proxies, parse the tweet objects embedded in its bootstrap state, and return them as validated JSON with no login and no paid X plan. Because X hard-walls logged-out search, we are honest about it: the endpoint is beta, every response carries a results_count so you can tell a real hit from an empty one, and a fully walled query returns a clear diagnostic rather than a fabricated feed.

*

Query and tab input

One call takes the q query plus the f tab (top, live, user, image, or video) that X itself accepts on /search.
*

No login or paid X plan

We fetch the public search page for you, so there is no OAuth, no X developer account, and no paid API tier to run a query.
*

Honest, classifiable results

Every response includes results_count and total_results. When X returns only a login shell, the endpoint reports a clear diagnostic instead of inventing tweets.
*

Anti-bot and proxy rotation

Rotating residential and datacenter proxies with retries and tier escalation give a query the best chance of reaching embedded results.
*

Consistent result shape

Each tweet maps to the same fields as the rest of our social endpoints: position, id, url, author, full_text, lang, and engagement counts.
*

Pay for success

Failed fetches retry across proxy tiers first, and you are billed only for responses that come back.
side by side

Twitter / X Search Scraper API or the official X API

Our APIDIY (requests / headless)Official X API v2
Search by keyword or hashtagYes, q plus a search tabFetch and dig the page state yourselfRecent and full-archive search, paid tiers
SetupAPI key onlyProxies, headless browser, parserDeveloper account plus paid tier
Logged-out accessBest-effort, results_count tells youLogin shell, usually no tweets embeddedAuth token required on every call
CostFree tier, then per successful requestFree code, but you run the proxiesPlans start around 100 dollars a month
Reliability on X searchBeta, X walls this surface hardBrittle, breaks on every markup changeStable, but gated and metered
OutputStable flat JSON per tweetWhatever you parse from the shellNested JSON you map yourself
what it costs

Start free, pay as you grow

PlanPriceBest for
Free1,000 requestsTesting and small jobs
Pro$0.60 / 1kProduction workloads
Pay-as-you-go$0.90 / 1kSpiky or one-off volume

Median response 2.6s. You only pay for successful requests.

FAQ

What is a Twitter search scraper?

A Twitter search scraper is a tool that runs a keyword, hashtag, or query against X's search and returns the matching tweets in a structured format. Our search endpoint takes a q query and an f tab, fetches X's public search page, parses the tweet objects embedded in its state, and returns them as JSON with text, author, language, and engagement per result.

Why is the search endpoint marked beta?

Because X is one of the most aggressive logged-out walls on the web. A guest request to the search page usually returns a JavaScript shell with a login gate and no tweet data embedded, since results stream in later over X's authenticated API. Our endpoint parses whatever tweets X does embed in the initial page and reports a clear diagnostic when a query comes back empty, so we keep it labelled beta rather than promising a full public search feed.

How do I know if a query returned real results?

Check results_count on the response before reading results. It is the number of tweets we parsed for that query. When X serves only a login shell, results_count is 0 and the response includes a diagnostic noting the page length and which markers were present, so you can tell an empty result apart from a genuine no-match.

Which search tabs are supported?

The f parameter accepts the same tabs X uses on /search: top, live, user, image, and video. It defaults to top. The tab is passed straight through to X, so image and video bias the query toward tweets with media when X embeds them.

Do I need an X developer account or paid API to search?

No. You authenticate with a single twitterscraperapi key. There is no X developer account and no paid X API tier, which for search starts around 100 dollars a month. The free tier includes 1,000 requests. For a reliable single-tweet read, the tweet endpoint is far more consistent than search because it uses X's public syndication payload.

Can I get every tweet for a hashtag?

No tool can guarantee that from logged-out access, and we do not claim to. X only exposes a slice of matching tweets to guests, and often none, so this endpoint returns the tweets embedded in the search page up to your limit rather than a complete historical set. For exhaustive archive search you would need X's paid full-archive API tier.

Start pulling search api data
Start free with 1,000 requests, no card required.
Get a free API key View endpoints