# X (Twitter) Data Scraper — Tweets, Profiles, Search, Followers (`socialapitech/x-twitter-data-scraper`) Actor

Twitter (X) scraper for tweets, user profiles, advanced search, followers and following. Free to try with no signup: run it as-is for a live @elonmusk profile. Read-only, no X developer account needed. Bring a free SocialAPI key to scrape any account.

- **URL**: https://apify.com/socialapitech/x-twitter-data-scraper.md
- **Developed by:** [Socialapi Tech](https://apify.com/socialapitech) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.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) Data Scraper — Tweets, Profiles, Search, Followers

Read-only X (Twitter) data as structured JSON. No X account, no developer-portal application, no browser automation.

Give it a username or a search query, get back clean records in your Apify dataset.

***

### What it does

| Mode | Returns |
|---|---|
| **User tweets** | Recent posts from an account |
| **User profile** | Bio, follower/following counts, verification, join date, avatar |
| **Search** | Full X search syntax — `from:`, `to:`, `since:`, `until:`, `min_faves:`, `#hashtag`, `$cashtag` |
| **Followers** | Who follows an account |
| **Following** | Who an account follows |
| **User replies** | An account's replies |

Pagination, retries and rate-limit backoff are handled for you.

***

### Why this one

**Read-only by design.** It never posts, follows, likes, or logs in as anyone. It reads data that is already public — the same thing a logged-out browser sees. It never asks for your X credentials, so **your X account is never involved and can never be the thing that gets restricted.**

**Only X, maintained accordingly.** This isn't one connector among hundreds. When X changes its internals, that's the whole emergency rather than a ticket in a queue.

**Free to try, no signup.** Run it with the key field blank and you get a live @elonmusk profile — real data, real response shape, zero credits. When you want any other account, you bring your own key.

***

### Pricing — this Actor is free

**This Actor charges you nothing on Apify.** There is no per-result fee and no subscription here. You only ever pay Apify's own platform compute, same as any Actor.

#### 1. Free demo — no key, no signup

Leave **"Your SocialAPI key"** blank. You get the **@elonmusk profile**, live, for free. It's rate limited per IP and fixed to that one account — it exists so you can see the exact response shape before committing to anything.

#### 2. Your own key — everything else

Every other mode (any username, search, followers, following, replies) needs a key from **[socialapi.tech](https://socialapi.tech/?utm_source=apify\&utm_medium=marketplace)**. **Sign up with Google for $0.20 in free credits — no credit card, no X Developer account.**

Then:

- You're billed by SocialAPI directly at **per-call pricing** (1 credit = $0.00001), with **no subscription and no monthly minimum**
- **No marketplace margin** — you pay us directly, so there's nothing stacked on top
- You get the full API too: 40+ endpoints, a real-time WebSocket stream (1–4 second typical detection lag), and webhooks — things a batch Actor can't express

***

### Input

```json
{
  "mode": "user_tweets",
  "usernames": ["elonmusk", "naval"],
  "maxItems": 100,
  "socialApiKey": "xm_your_key_here"
}
```

Search instead:

```json
{
  "mode": "search",
  "searchQuery": "bitcoin min_faves:100 since:2026-10-01",
  "maxItems": 200
}
```

| Field | Type | Notes |
|---|---|---|
| `mode` | string | One of the modes in the table above |
| `usernames` | array | Handles without `@`. Used by every mode except Search |
| `searchQuery` | string | Search mode only. Full X search syntax |
| `maxItems` | integer | Per username/query. Higher costs more |
| `socialApiKey` | string | Blank = free @elonmusk demo. Your own key unlocks every mode |

***

### Output

One record per tweet or profile, pushed to the dataset. Each record carries `_target` (which username or query produced it) and `_mode`, so merged datasets stay traceable.

***

### What it can't do

Worth stating plainly, because other tools are vague about it:

- **Protected accounts** — not accessible. That data isn't exposed to anyone.
- **Direct messages** — same.
- **Who viewed a profile / who blocked you** — X doesn't publish this, so nothing can read it.
- **Posting, following, liking** — this is read-only. Those need the official X API and an authenticated account.

If a tool claims any of the first three, it's doing something other than what it says.

***

### Legal and acceptable use

This reads publicly visible data. The lines that matter in practice: don't use anyone's credentials, don't try to reach protected content, and don't generate load that looks like an attack. What you do with the data afterwards may carry its own obligations depending on your jurisdiction and use case.

***

### Links

- **Get a free API key** — https://socialapi.tech/?utm_source=apify\&utm_medium=marketplace (Google sign-up includes $0.20 in credits)
- **Full API docs (40+ endpoints)** — https://socialapi.tech/docs?utm_source=apify\&utm_medium=marketplace
- **Pricing** — per call, no subscription: https://socialapi.tech/?utm_source=apify\&utm_medium=marketplace

Built and maintained by the SocialAPI team.

# Actor input Schema

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

Pick the kind of data. Each mode uses a different field below. Without an API key, only "User profile" works and it is fixed to @elonmusk (free demo).

## `usernames` (type: `array`):

Handles without @ (e.g. elonmusk). Used by every mode except Search. Requires your own API key — the free demo is fixed to @elonmusk.

## `searchQuery` (type: `string`):

Full X search syntax is supported: from:, to:, since:, until:, min_faves:, #hashtag, $cashtag.

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

Stops once this many items are collected. Higher values cost more.

## `socialApiKey` (type: `string`):

Leave blank to run the FREE demo: @elonmusk profile only, no credits, no signup, rate limited per IP. To query any account — plus search, followers, replies and the real-time stream — paste your own key from https://socialapi.tech. Pricing is per call with no monthly subscription. Sign up with Google for $0.20 in free credits, no card required.

## Actor input object example

```json
{
  "mode": "user_profile",
  "usernames": [
    "elonmusk"
  ],
  "searchQuery": "bitcoin min_faves:100",
  "maxItems": 50
}
```

# Actor output Schema

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

All scraped tweets / profiles in this run.

# 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 = {
    "usernames": [
        "elonmusk"
    ],
    "searchQuery": "bitcoin min_faves:100"
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialapitech/x-twitter-data-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 = {
    "usernames": ["elonmusk"],
    "searchQuery": "bitcoin min_faves:100",
}

# Run the Actor and wait for it to finish
run = client.actor("socialapitech/x-twitter-data-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 '{
  "usernames": [
    "elonmusk"
  ],
  "searchQuery": "bitcoin min_faves:100"
}' |
apify call socialapitech/x-twitter-data-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialapitech/x-twitter-data-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/1JjxtTGzZhali3imf/builds/z3AdjgXfdkg9HLkvs/openapi.json
