# Twitter/X Profile Scraper (`socialdataapi/twitter-profile-scraper`) Actor

Twitter/X Profile Scraper extracts public profile data from X (Twitter) accounts by username or URL: name, bio, followers, following, tweet count, verification, location and links. No login or cookies needed. Export to JSON, CSV or Excel, or use the API.

- **URL**: https://apify.com/socialdataapi/twitter-profile-scraper.md
- **Developed by:** [Social Data API](https://apify.com/socialdataapi) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.67 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## 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

### Twitter/X Profile Scraper — Tweets, Replies and Profile Stats

Twitter/X Profile Scraper extracts a public X account's tweets and profile stats using your own login cookies, returning tweet text, like, retweet and view counts, plus flattened profile fields such as follower count and bio for one or many profiles in one run. Every row comes back as structured JSON, ready to pass directly to an LLM, index into a vector store, or feed a social-listening pipeline. **Built-in rate-limit handling and retries** keep one blocked request from failing a whole profile. Point it at a handle or URL to start.

![Twitter/X Profile Scraper output as JSON: tweet text, likes, retweets, views and profile stats](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/a-twitter-profile-hero.webp)

***

### What data can I extract with Twitter/X Profile Scraper?

Using this Twitter/X Profile API, you will be able to extract the following Twitter/X profile data:

| 📝 Tweet text | ❤️ Likes, retweets, replies, quotes, bookmarks, views | 👤 Flattened profile stats (about row) | 🔁 Replies (optional) |
| --- | --- | --- | --- |
| 🆔 Tweet, conversation and author IDs | 📅 Creation date | 🔗 Direct tweet URL | 🌍 Detected language |
| 🖼️ Media and entity data (hashtags, mentions, links) | 👁️ View count | 🔖 Bookmarked / liked / retweeted by the session | ✅ Legacy and Blue verification flags |
| 📍 Location and bio | 📊 Follower, following, tweet and listed counts | 🗓️ Account creation date | ⏱️ Scraped timestamp |

Twitter/X Profile Scraper only returns data that is already visible on a public profile page or public tweet — what any visitor sees. Your own login cookies are used only to make the requests, not to unlock anything behind X's login wall.

***

### How to use Twitter/X Profile Scraper

**What this Actor does:** Twitter/X Profile Scraper is an Apify Actor that returns a public X profile's tweets as structured JSON — full text, likes, retweets, replies, quotes, bookmarks, views — plus, on request, a flattened profile-stats row with follower/following counts, bio and verification flags. Use it whenever you need to scrape Twitter profile data and tweets without building your own login flow or browser automation — competitor and influencer monitoring, sentiment or engagement analysis, and audience research. Inputs: one or many profile URLs or handles, a date range, image/retweet filters, optional replies and about-data toggles, your own login cookies, and an optional proxy. A reply row or the about row is billed the same as a tweet row — one row, one charge.

#### Twitter/X Profile Scraper MCP Server: use these Actors from ChatGPT, Claude or Cursor

Point your AI assistant at the Apify MCP server and it can find and call this Actor on its own — no glue code, no scraping logic in your prompts.

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/twitter-profile-scraper"
```

#### Step by step

1. [Create a free Apify account](https://console.apify.com/sign-up) if you don't already have one.
2. Open [Twitter/X Profile Scraper](https://apify.com/socialdataapi/twitter-profile-scraper) in the Apify Store.
3. Provide at least one profile — paste full URLs into Profile URLs (e.g. `https://x.com/nasa`) or bare usernames into Twitter Handles (e.g. `nasa`).
4. Provide your own Auth Token and CSRF Token login cookies (see "How to get your X auth_token and ct0 cookies" below) — required for every run.
5. Click **Start** (or send your API request).
6. Download or stream your results in JSON, CSV or Excel once the run finishes.

#### How to get your X auth_token and ct0 cookies

1. Log in to x.com in your browser.
2. Open your browser's developer tools and go to the Application (Chrome/Edge) or Storage (Firefox) panel.
3. Under Cookies for `x.com`, find the cookie named `auth_token` and copy its value into the Auth Token field.
4. In the same list, find the cookie named `ct0` and copy its value into the CSRF Token field.
5. Keep both values private — treat them like a password for your X account.

#### How to scale to bulk Twitter/X profile extraction

Both Profile URLs and Twitter Handles accept arrays, so a single run can process many profiles at once — mix full URLs and bare handles freely in the same list. Maximum Items caps rows across the entire run, not per profile, so raise it in step with your target profile count. For very large profile lists you want to run on a recurring basis, split them across separate scheduled runs rather than one unbounded run.

***

### ✨ Features

Twitter/X Profile Scraper fetches clean, structured tweets and profile stats from X, acting as both an x profile scraper and a twitter profile stats scraper in the same run. It's ideal for competitor and influencer monitoring, sentiment and engagement analysis, audience research, and feeding tweet content into an LLM or RAG pipeline.

It extracts, per tweet:

- **Full text** – the tweet's complete text
- **Engagement counts** – likes, retweets, replies, quotes, bookmarks and views
- **Flattened profile stats** – follower, following, tweet and listed counts, bio, location and verification, as plain top-level columns instead of a nested object — effectively a built-in twitter bio scraper whenever the about-data toggle is on
- **Reply rows** – optional replies to each qualifying tweet, tagged to their parent tweet
- **Date and media filters** – keep only tweets in a date range, with images, or excluding native retweets

⚡ Re-discovers X's current API configuration on every run, so the same output columns keep working even after X changes its page.

***

### Use cases 💡

- **Growth marketer** — track competitor tweet performance by likes, retweets and views.
- **Social listening analyst** — scrape Twitter followers count, bio and location from the about row.
- **Research team** — build a posting-activity timeline from tweet and account creation dates.
- **Outreach specialist** — use it as a twitter account profile scraper for niche contact lists.
- **AI engineer** — feed tweet text and engagement counts into a RAG pipeline or an LLM classifier.

Building an AI agent? [Connect Twitter/X Profile Scraper over MCP](#twitterx-profile-scraper-mcp-server-use-these-actors-from-chatgpt-claude-or-cursor) and let it call the actor on its own.

***

### Why choose this actor?

1. **One profile, three row shapes.** Every run can return a profile's tweets, optional replies to each tweet, and a flattened profile-stats row — all under the same output schema.
2. **27 columns on every tweet row.** Each tweet comes back with its full text, five engagement counts, the author object, media and entity data, and a direct tweet URL — no column is ever dropped between runs.
3. **Five filters, one run.** Date range, image-only, native-retweet and minimum-reply-count filters, plus an optional about-data toggle, all combine in a single run against the same login cookies.

***

### ⬇️ Input

![Input fields of the Twitter/X Profile Scraper](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/a-twitter-profile-input.webp)

Provide at least one profile (a URL or a bare handle) and your own login cookies; everything else is optional.

| Parameter | Required | Type | Description | Example Value |
| --- | --- | --- | --- | --- |
| `startUrls` | No | array | List of Twitter/X profile URLs (e.g., `https://x.com/elonmusk`). Required if `twitterHandles` is empty. | `["https://x.com/nasa"]` |
| `twitterHandles` | No | array | List of usernames without the `@` (e.g., `elonmusk`). Required if `startUrls` is empty. | `["nasa"]` |
| `maxItems` | No | integer | Hard cap on total items written across the whole run. Free plan: up to 20 per run (all profiles together) and 200 per month; paid plans have no limit. Default `10`. | `100` |
| `start` | No | string | Lower bound for tweet date. Absolute date (`YYYY-MM-DD`) or relative value (e.g. `7 days`). Empty = no lower bound. | `"7 days"` |
| `end` | No | string | Upper bound for tweet date. Absolute date (`YYYY-MM-DD`) or relative value (e.g. `1 day`). Empty = no upper bound. | `""` |
| `includeNativeRetweets` | No | boolean | When false, native retweets are dropped. Only effective for the last ~7-10 days. Default `false`. | `false` |
| `onlyImages` | No | boolean | Keep only tweets that contain at least one photo. Default `false`. | `false` |
| `getAboutData` | No | boolean | Emit one profile-about record per user (flattened follower/following/tweet-count stats). Default `false`. | `true` |
| `getReplies` | No | boolean | Fetch replies to each qualifying tweet. Default `false`. | `false` |
| `minReplyCount` | No | integer | Only fetch replies for tweets whose reply count is at least this value. Default `0`. | `5` |
| `authToken` | **Yes** | string (secret) | Value of the `auth_token` cookie from x.com. Required for every run. | *(your own cookie value)* |
| `csrfToken` | **Yes** | string (secret) | Value of the `ct0` cookie from x.com. Required for every run. | *(your own cookie value)* |
| `proxyConfiguration` | No | object | Apify proxy configuration. Recommended for reliability against rate limits. Off by default. | `{"useApifyProxy": true}` |

#### Free plan limits

Free plan: up to 20 items per run (all profiles together) and 200 per month; paid plans have no limit. A free-plan run with several profiles shares that same 20-item ceiling across all of them, not 20 per profile — the Actor stops the whole run once the run total is reached and tells you so in the log and status message. Paid plans, local `apify run`s and Apify's own test runs are never limited.

#### Example input

```json
{
  "startUrls": ["https://x.com/nasa"],
  "twitterHandles": ["elonmusk"],
  "maxItems": 100,
  "start": "7 days",
  "end": "",
  "includeNativeRetweets": false,
  "onlyImages": false,
  "getAboutData": true,
  "getReplies": false,
  "minReplyCount": 0,
  "authToken": "YOUR_OWN_AUTH_TOKEN_COOKIE_VALUE",
  "csrfToken": "YOUR_OWN_CT0_COOKIE_VALUE",
  "proxyConfiguration": { "useApifyProxy": true }
}
```

***

### ⬆️ Output

![Output fields of the Twitter/X Profile Scraper](https://api.apify.com/v2/key-value-stores/WYkyEfqs10huyXYxr/records/a-twitter-profile-output.webp)

Results are written to the Actor's default dataset as typed, normalized JSON rows — one per tweet, plus an optional per-user about row and optional reply rows — with a consistent schema across runs. Export directly from the Apify Console as JSON, CSV, Excel, or XML, or pull rows via the Apify API/dataset client — the fastest way to export Twitter profile data at scale.

#### Example output

```json
{
  "user": {
    "screen_name": "nasa",
    "name": "NASA",
    "followers_count": 98230451,
    "friends_count": 470,
    "statuses_count": 76210,
    "favourites_count": 3812,
    "listed_count": 152400,
    "created_at": "Wed Dec 06 16:07:57 +0000 2007",
    "verified": true,
    "is_blue_verified": true,
    "profile_image_url_https": "https://pbs.twimg.com/profile_images/.../nasa_400x400.jpg",
    "profile_banner_url": "https://pbs.twimg.com/profile_banners/.../1600000000",
    "location": "",
    "description": "Explore the universe and discover our home planet."
  },
  "bookmark_count": 214,
  "bookmarked": false,
  "created_at": "Fri Jul 18 14:32:05 +0000 2026",
  "conversation_id_str": "1943821004552192000",
  "display_text_range": [0, 187],
  "entities": {
    "hashtags": [{ "text": "Artemis" }],
    "user_mentions": [],
    "urls": [],
    "timestamps": []
  },
  "extended_entities": {
    "media": [{ "type": "photo", "media_url_https": "https://pbs.twimg.com/media/example.jpg" }]
  },
  "favorite_count": 15420,
  "favorited": false,
  "full_text": "New images from the Artemis mission show the lunar south pole in stunning detail. #Artemis",
  "is_quote_status": false,
  "lang": "en",
  "quote_count": 88,
  "reply_count": 342,
  "retweet_count": 3190,
  "retweeted": false,
  "user_id_str": "11348282",
  "id_str": "1943821004552192001",
  "possibly_sensitive": false,
  "views_count": 1284730,
  "screen_name": "nasa",
  "tweetUrl": "https://x.com/nasa/status/1943821004552192001",
  "scrapedAt": "2026-07-25T09:12:44Z"
}
```

***

### How does it work?

Twitter/X Profile Scraper doesn't use a browser. It talks to the same internal API the X web app calls when you're signed in, using your own login cookies for every request, and re-discovers the current API configuration directly from X's web app on each run instead of relying on hardcoded values that break the moment X ships an update. It resolves a handle to a numeric user ID the same way the signed-in web app does, with a profile-page fallback for the rare case that lookup doesn't succeed, then pages through the timeline, applying your date, retweet and image filters as it writes rows. When a request is rate-limited, the run waits out the limit instead of failing; a failed request is retried a few times before that page is given up on and the run moves to the next profile. The output schema stays the same even when X changes its page layout.

***

### How do you integrate Twitter/X Profile Scraper into your stack?

As an x profile data scraper, Twitter/X Profile Scraper works with the tools you already use for automation and data pipelines: a REST API from any language, MCP for AI agents, and no-code tools.

#### Using Twitter/X Profile Scraper with the Apify API

Call the Twitter profile scraper API from any language: start a run with a `POST` request to the Apify API using your Apify API token and an input JSON matching the schema above, then poll the run or stream the finished dataset's items. *Works in Go, Ruby, Node.js, Python, cURL — any language that can make an HTTP request.*

#### MCP integration for AI agents

Register Twitter/X Profile Scraper (Apify Actor ID: socialdataapi/twitter-profile-scraper, https://apify.com/socialdataapi/twitter-profile-scraper) as a tool your AI agent can call directly — no glue code, no scraping logic in your prompts.

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=socialdataapi/twitter-profile-scraper"
```

This works in Claude Code, Cursor and Windsurf; any AI agent framework that can call an HTTP endpoint can also call the Apify API directly.

#### No-code tools (n8n, Make)

In n8n, use the Apify node (or a generic HTTP Request node) to call this Actor's run endpoint with your input JSON and Apify API token, then feed the returned dataset items into downstream nodes. In Make, use the Apify app's "Run Actor" module with the same JSON input and iterate over the resulting dataset items in your scenario.

***

### Is it legal to scrape Twitter/X profiles?

Scraping publicly available social media data is generally lawful — courts (e.g., *hiQ v. LinkedIn* in the US) have repeatedly held that accessing public, non-login-walled pages is not itself prohibited. Twitter/X Profile Scraper only returns data already visible on a public profile page or public tweet — the same data any visitor can see; your own login cookies are used only to make the requests, not to unlock anything behind X's login wall, and reply scraping still only surfaces public replies. Because tweets and profile fields (bio, location, handle) can be personal data about identifiable people, GDPR and CCPA still govern how you store, process and retain what you collect, even though the collection itself targets public data. Consult legal counsel before any bulk storage or commercial use of personal data scraped this way.

***

### Frequently asked questions

#### What fields does Twitter/X Profile Scraper return?

It returns the tweet's full text, like, retweet and view counts, and creation date on every tweet row, plus follower and bio fields when the about-data option is enabled — see [What data can I extract](#what-data-can-i-extract-with-twitterx-profile-scraper) above for the full field list.

#### Does Twitter/X Profile Scraper require a Twitter/X account or login?

Yes — every run needs your own login cookie pair (an auth token and a CSRF token) from a logged-in x.com session, whether or not you enable replies. Both are stored as secret input fields.

#### What happens if a profile is private, suspended, or doesn't exist?

No row is written for that profile. The Actor logs a "User not found" warning and moves on to the next target in your list rather than failing the whole run.

#### Can I scrape multiple Twitter/X profiles at once?

Yes — both Profile URLs and Twitter Handles accept arrays, so you can list many profile URLs and/or bare handles in a single run and they'll be processed in order until Maximum Items is reached.

#### Does Twitter/X Profile Scraper work with Claude, ChatGPT, and other AI agent tools?

Yes, as a callable HTTP endpoint through the Apify API, and as an MCP tool through the Apify MCP server — any agent framework that can make an authenticated HTTP request can trigger a run and read back the resulting dataset items.

#### Does Twitter/X Profile Scraper return data in a format LLMs can use directly?

Yes. Output is typed, normalized JSON with consistent field names across runs — no HTML parsing or CSS selectors needed. Pass it directly to an LLM, index it into a vector store, or feed it to an agent tool.

#### What happens when Twitter/X changes its layout or anti-bot system?

The Actor is maintained and re-discovers its API configuration fresh on every run, so the output schema stays stable through most front-end changes. No specific fix turnaround time is promised for deeper changes.

#### Can I use Twitter/X Profile Scraper without managing proxies or browser infrastructure?

Yes. It makes direct HTTP calls with no browser involved, and proxy support is optional — you can run it with no proxy configured at all. You do still need to supply your own login cookies for every run.

#### Which Twitter/X fields work best for AI training data and RAG indexing?

For RAG, index the tweet text alongside hashtags/mentions and the profile bio for author context. For consistent-structure training data, like, retweet, view and follower counts return as typed numeric primitives across every row.

***

### Your feedback

Found a bug or missing a field? Let us know so we can fix it — reach out through the Actor's Issues tab on Apify Console. Reports get looked at as part of ongoing maintenance.

# Actor input Schema

## `startUrls` (type: `array`):

List of Twitter/X profile URLs (e.g., https://x.com/elonmusk). Required if Twitter Handles is empty.

## `twitterHandles` (type: `array`):

List of usernames without the @ (e.g., elonmusk). Required if Profile URLs is empty.

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

Hard cap on total items written across the whole run. Free plan: up to 20 per run (all profiles together) and 200 per month; paid plans have no limit. See the run log for your current usage.

## `start` (type: `string`):

Lower bound for tweet date. Use absolute date (YYYY-MM-DD) or relative value (for example, 7 days). Empty = no lower bound.

## `end` (type: `string`):

Upper bound for tweet date. Use absolute date (YYYY-MM-DD) or relative value (for example, 1 day). Empty = no upper bound.

## `includeNativeRetweets` (type: `boolean`):

When false, native retweets (full_text starts with 'RT @') are dropped. Only effective for the last ~7-10 days.

## `onlyImages` (type: `boolean`):

Keep only tweets that contain at least one photo.

## `getAboutData` (type: `boolean`):

Emit one profile-about record per user, with follower/following/tweet counts and bio/verification fields flattened to top-level columns.

## `getReplies` (type: `boolean`):

Fetch replies to each qualifying tweet.

## `minReplyCount` (type: `integer`):

Only fetch replies for tweets whose reply count is at least this value. Only used when Scrape Replies is on.

## `authToken` (type: `string`):

Value of the auth_token cookie from x.com (browser devtools > Application > Cookies). Required for every run.

## `csrfToken` (type: `string`):

Value of the ct0 cookie from x.com. Required for every run.

## `proxyConfiguration` (type: `object`):

Apify proxy configuration. Recommended for reliability against rate limits.

## Actor input object example

```json
{
  "startUrls": [
    "https://x.com/elonmusk"
  ],
  "twitterHandles": [],
  "maxItems": 10,
  "start": "",
  "end": "",
  "includeNativeRetweets": false,
  "onlyImages": false,
  "getAboutData": false,
  "getReplies": false,
  "minReplyCount": 0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

All scraped items in the Actor's default dataset.

# 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 = {
    "startUrls": [
        "https://x.com/elonmusk"
    ],
    "twitterHandles": [],
    "proxyConfiguration": {
        "useApifyProxy": false
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("socialdataapi/twitter-profile-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 = {
    "startUrls": ["https://x.com/elonmusk"],
    "twitterHandles": [],
    "proxyConfiguration": { "useApifyProxy": False },
}

# Run the Actor and wait for it to finish
run = client.actor("socialdataapi/twitter-profile-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 '{
  "startUrls": [
    "https://x.com/elonmusk"
  ],
  "twitterHandles": [],
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}' |
apify call socialdataapi/twitter-profile-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,socialdataapi/twitter-profile-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/CKRuyGhw3iRieDPXk/builds/qK0OP124cISFcgBpr/openapi.json
