# X (Twitter) Scraper — Tweets, Profiles, Followers, Lists (`relayxapi/x-twitter-scraper`) Actor

Scrape X/Twitter without logins or proxies: advanced search, timelines, mentions, profiles, user search, followers, followings, replies, quotes, retweeters, tweets by ID and Lists. Powered by the RelayX API.

- **URL**: https://apify.com/relayxapi/x-twitter-scraper.md
- **Developed by:** [RelayX](https://apify.com/relayxapi) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## X (Twitter) Scraper — tweets, profiles, followers, retweeters, lists & search

Scrape public **X (Twitter)** data **without logins, cookies, proxies or a headless browser**:

- 🔎 **Search tweets** with X's full search syntax (`from:`, `"exact phrase"`, `#hashtag`, `lang:`, `min_faves:`, `since:`/`until:` …)
- 🧵 **User tweets**: an account's latest posts
- 📣 **Mentions**: tweets mentioning an account
- 👤 **User profiles**: bio, follower/following counts, verification, join date
- 🔍 **Search users** by keyword
- 👥 **Followers** and **followings** of any public account
- 💬 **Replies**, 🔁 **quote tweets** and ♻️ **retweeters** of any tweet
- 🆔 **Tweets by ID or URL**: fill in full data for a list of tweets
- 📋 **X Lists**: a list's tweets and its members

Results come back as clean JSON (or CSV/Excel from the dataset), ready for spreadsheets, databases or LLM pipelines.

Powered by the [RelayX X/Twitter data API](https://relayxapi.com/?utm_source=apify\&utm_medium=actor\&utm_campaign=x-twitter-scraper).

### How to use it

1. Pick **What to scrape**.

2. Fill in the matching list:

   | Mode | Fill in |
   | --- | --- |
   | Search tweets, Search users by keyword | **Search queries / keywords** |
   | User tweets, Mentions, User profiles, Followers, Followings | **X usernames** |
   | Replies, Quote tweets, Retweeters, Tweets by ID | **Tweet IDs or URLs** |
   | List tweets, List members | **List IDs or URLs** |

3. Set **Max items** (per query / user / tweet / list) and run.

#### Examples

Latest tweets from NASA with 1,000+ likes:

```json
{ "mode": "search", "searchTerms": ["from:nasa"], "minLikes": 1000, "maxItems": 200 }
```

Everything mentioning a brand in English in September 2026:

```json
{ "mode": "search", "searchTerms": ["\"relayx\" OR #relayx"], "language": "en",
  "sinceDate": "2026-09-01", "untilDate": "2026-09-30", "maxItems": 1000 }
```

Profiles for a list of accounts:

```json
{ "mode": "profiles", "handles": ["nasa", "SpaceX", "https://x.com/elonmusk"] }
```

Followers of an account:

```json
{ "mode": "followers", "handles": ["nasa"], "maxItems": 5000 }
```

Who retweeted and who quoted a viral post:

```json
{ "mode": "retweeters", "tweetIds": ["https://x.com/NASA/status/2103610284464316469"], "maxItems": 1000 }
```

```json
{ "mode": "quotes", "tweetIds": ["https://x.com/NASA/status/2103610284464316469"], "maxItems": 500 }
```

Monitor mentions of your brand account:

```json
{ "mode": "mentions", "handles": ["yourbrand"], "maxItems": 200 }
```

Fill in full data for tweet IDs you already have:

```json
{ "mode": "tweetsById", "tweetIds": ["2103610284464316469", "https://x.com/elonmusk/status/1519480761749016577"] }
```

Everyone on an X List:

```json
{ "mode": "listMembers", "listIds": ["https://x.com/i/lists/2102949137243357237"], "maxItems": 1000 }
```

### Output

Each tweet looks like this (trimmed):

```json
{
  "type": "tweet",
  "id": "2103610284464316469",
  "url": "https://x.com/i/status/2103610284464316469",
  "text": "With @BoeingSpace, we'll provide an update on Starliner …",
  "createdAt": "Fri Sep 25 22:19:09 +0000 2026",
  "likeCount": 4024, "retweetCount": 487, "replyCount": 184, "viewCount": "878309",
  "author": { "userName": "NASA", "name": "NASA", "followers": 92375699, "isBlueVerified": true },
  "source_query": "from:nasa"
}
```

Users include `userName`, `name`, `description`, `location`, `followers`, `following`, `isBlueVerified`, `createdAt`, `profilePicture` and more. `source_query` tells you which query, username or tweet produced each row.

### How to use your own RelayX key

Using your own key means you pay RelayX's own rates, which are the cheapest option for big or recurring jobs.

1. **Get a key.** Sign in at [relayxapi.com/app](https://relayxapi.com/app/?utm_source=apify\&utm_medium=actor\&utm_campaign=x-twitter-scraper) with Google or email, then create an API key (it looks like `rk_live_…`). New accounts get **$1 of free trial credits** (100,000 credits, about 7,700 tweets), so you can try it before paying.
2. **Paste it into this Actor.** In the **Input** tab, scroll to **Billing** and paste the key into **RelayX API key**. The field is encrypted: Apify stores it securely and it doesn't show in run logs.
3. **Run.** Results are billed to your RelayX credits at $0.13 per 1,000 tweets and $0.15 per 1,000 profiles. When the credits run out, the run stops with a link to top up.

Calling the Actor through the Apify API? Pass the key in the input JSON:

```json
{ "mode": "search", "searchTerms": ["from:nasa"], "maxItems": 100, "relayxApiKey": "rk_live_..." }
```

### Pricing

You can pay either way:

- **Pay per result on Apify** (default): leave the RelayX key empty and pay per result through Apify. Use the run's **maximum charge** setting to cap spend; the scraper stops as soon as the limit is reached.
- **Use your own RelayX key**: paste a key from [relayxapi.com](https://relayxapi.com/app/?utm_source=apify\&utm_medium=actor\&utm_campaign=x-twitter-scraper) and usage is billed to your RelayX credits instead. That's **$0.13 per 1,000 tweets** and **$0.15 per 1,000 profiles**, and new keys include free trial credits. This is the cheaper choice for large or recurring jobs.

### Tips

- The **Search queries** field accepts X's advanced search operators. Combining them (for example `from:nasa -filter:replies min_faves:500`) is the cheapest way to get exactly what you need.
- `sinceDate`, `untilDate`, `minLikes` and `language` are added to **every** search query.
- The scraper stops a query early when X has no more results, so a high `maxItems` is safe.

### FAQ

**Do I need an X account or developer access?** No. There are no logins, cookies or X developer account.

**Can it scrape private (protected) accounts or DMs?** No. It reads public data only.

**Is there an API instead of an Actor?** Yes: the same data is available over REST with SDKs for Python and Node, and as an MCP server for AI assistants. See [relayxapi.com](https://relayxapi.com/?utm_source=apify\&utm_medium=actor\&utm_campaign=x-twitter-scraper).

*This Actor is not affiliated with, endorsed by or operated by X Corp. "X" and "Twitter" are trademarks of their respective owners. Only publicly available data is collected; use it in line with applicable laws and X's terms.*

# Actor input Schema

## `mode` (type: `string`):

What to collect. Each mode reads one of the lists below: search queries, usernames, tweet IDs/URLs or list IDs/URLs.

## `searchTerms` (type: `array`):

For 'Search tweets' (full X search syntax works: from:nasa, "exact phrase", #tag, lang:en, min\_faves:100, -filter:replies …) and 'Search users by keyword' (plain keywords).

## `handles` (type: `array`):

For user tweets, mentions, profiles, followers and followings. Without the @ (a full x.com/… URL also works).

## `tweetIds` (type: `array`):

For replies, quote tweets, retweeters and 'Tweets by ID'. Numeric IDs or x.com/…/status/… URLs.

## `listIds` (type: `array`):

For 'List tweets' and 'List members'. Numeric list IDs or x.com/i/lists/… URLs.

## `maxItems` (type: `integer`):

Stop after this many results for each search query, username, tweet or list. (Ignored by 'User profiles' and 'Tweets by ID', which return one item per input.)

## `queryType` (type: `string`):

Latest = newest first. Top = most engaged first.

## `sinceDate` (type: `string`):

Only tweets on or after this date (adds since: to each search query).

## `untilDate` (type: `string`):

Only tweets up to this date (adds until: to each search query).

## `minLikes` (type: `integer`):

Only tweets with at least this many likes (adds min\_faves:).

## `language` (type: `string`):

ISO code such as en, ja, es (adds lang:).

## `relayxApiKey` (type: `string`):

Your key from https://relayxapi.com/app/ . Leave empty to be billed through Apify.

## Actor input object example

```json
{
  "mode": "search",
  "searchTerms": [
    "from:nasa min_faves:1000"
  ],
  "handles": [
    "nasa"
  ],
  "maxItems": 100,
  "queryType": "Latest"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `tweets` (type: `string`):

No description

## `users` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchTerms": [
        "from:nasa min_faves:1000"
    ],
    "handles": [
        "nasa"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("relayxapi/x-twitter-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchTerms": ["from:nasa min_faves:1000"],
    "handles": ["nasa"],
}

# Run the Actor and wait for it to finish
run = client.actor("relayxapi/x-twitter-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchTerms": [
    "from:nasa min_faves:1000"
  ],
  "handles": [
    "nasa"
  ]
}' |
apify call relayxapi/x-twitter-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,relayxapi/x-twitter-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/IcnMnT9lspKIS6mD6/builds/G9ZJOJsw3uwSSkJsc/openapi.json
