# Twitter X User Scraper (`socialdataapi/twitter-x-user-scraper`) Actor

Scrape public X (Twitter) user profiles and the users that appear in their recent posts: name, bio, follower and post counts, verification and account details. No login needed.

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

## Pricing

from $0.40 / 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 User Scraper — Bio, Followers, Verification, Related Users

Twitter X User Scraper returns public X (Twitter) user profiles for any list of handles: display name, bio, follower and following counts, post and media counts, verification, avatar, banner and account creation date, plus **the users that appear in each profile's recent posts**. Every response is structured JSON — ready to pass directly to an LLM, index into a vector store, or feed a social listening pipeline. It works without login; your own session cookies add related users from the whole timeline. Start with one account, then scale up.

***

### What data can I extract with Twitter X User Scraper?

Using this X User API, you will be able to extract the following X user data:

| 👤 Username | 🏷️ Display name | 🆔 User ID | 🔗 Profile URL |
|---|---|---|---|
| 📝 Bio (with full links) | 📍 Location | 👥 Follower count | ➡️ Following count |
| 🗨️ Post count | 🖼️ Media count | ✅ Verified badge | 🔒 Protected account |
| 🧑 Profile picture | 🌄 Cover picture | 📅 Account creation date | 💼 Professional account type |
| 📌 Pinned post IDs | 🏢 Affiliate label | ⚠️ Possibly sensitive flag | 🔗 Bio and website links |
| 🌍 Account based in (about block) | 🕰️ Verified since (about block) | 🔁 Related to (input profile) | 🚫 Unavailable reason (suspended accounts) |

***

### How to use Twitter X User Scraper

Twitter X User Scraper is for social media analysts, marketers and researchers who need clean X account details for a list of handles, plus the accounts those profiles quote and repost, in one run.

**Copy to your AI assistant:**

```text
`socialdataapi/twitter-x-user-scraper` (Apify Actor ID: socialdataapi/twitter-x-user-scraper, https://apify.com/socialdataapi/twitter-x-user-scraper) is an Apify Actor that returns public X (Twitter) user profiles, and the users that appear in each profile's recent posts, as structured JSON: username, display name, bio, follower and following counts, post and media counts, verification badge, profile and cover pictures, account creation date and an optional about block. Use it whenever someone needs X account details without cookies, a login, or a browser - building an influencer list, checking follower counts for a watchlist, or mapping which accounts a profile quotes and reposts. Run it with curl: curl -X POST "https://api.apify.com/v2/acts/socialdataapi~twitter-x-user-scraper/run-sync-get-dataset-items?token=APIFY_TOKEN" -H "Content-Type: application/json" -d '{"startUrls":["https://x.com/NASA","elonmusk"],"maxItems":10,"getAbout":true}'. Or in Python: ApifyClient("APIFY_TOKEN").actor("socialdataapi/twitter-x-user-scraper").call(run_input={"startUrls":["https://x.com/NASA"],"maxItems":10}) then client.dataset(run["defaultDatasetId"]).list_items().items. Inputs: startUrls (array of profile URLs or handles, required), maxItems (integer, rows per input profile including the profile itself, 1-10000, default 10), authToken (string, optional secret x.com auth_token cookie), csrfToken (string, optional secret x.com ct0 cookie, needed together with authToken), getRetweeters (boolean, also return the users that appear in the profile's recent posts, default true), getFollowers (boolean, keep the follower count, default true), getFollowing (boolean, keep the following count, default true), getAbout (boolean, add the about block with verification date, profile image shape, account source and location, default false), includeUnavailableUsers (boolean, add rows for suspended or unavailable accounts, default false), proxyConfiguration (object, optional proxy settings). Every row has type "user"; related-user rows carry followerOf with the input profile; suspended accounts come back with isUnavailable true and unavailableReason when includeUnavailableUsers is on. Each saved row is billed as one result. Without session cookies a profile usually gives 1-9 rows (the profile plus the users in its few recent posts); with both cookies the whole timeline is read up to maxItems. Full input schema, every enum and default, and the complete output field list: GET https://api.apify.com/v2/acts/socialdataapi~twitter-x-user-scraper/builds/default
```

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

Point your AI assistant at this Actor and it can read X on its own: user profiles, follower and post counts, verification and the accounts each profile quotes or reposts. No glue code, no scraping logic in your prompts.

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

#### Step by step

1. [Create a free Apify account](https://console.apify.com/sign-up).
2. Open [Twitter X User Scraper](https://apify.com/socialdataapi/twitter-x-user-scraper) in the Apify Store.
3. Enter the X handles or profile URLs (with or without @), one per line.
4. Click **Start** (or send your API request).
5. Download or stream your results in JSON, CSV or Excel.

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

The cookies are optional. Add them only when you want related users from the whole timeline instead of the few recent posts X shows to visitors.

1. Log in to x.com in your browser.
2. Open DevTools (F12) and go to Application > Cookies > https://x.com.
3. Copy the value of `auth_token` into **X auth_token cookie**.
4. Copy the value of `ct0` into **X ct0 cookie**. Both fields are stored as secrets and never shown in logs.

#### How to scale Twitter X User Scraper to bulk

To scrape X profiles in bulk, put every handle into `startUrls`; three profiles are read at the same time and each row is saved as soon as it is ready. Use **Max items per profile** to control how many related users you get per account. To export Twitter users to CSV on a schedule, schedule the run in Apify Console or loop the API call over your watchlist; a recorded local run read 74 profiles and saved 120 rows in 22.0 seconds.

***

### ✨ Features

Twitter X User Scraper fetches clean, structured X user data from public profiles ⚡. It's ideal for influencer research, audience mapping, brand and competitor watchlists, and checking X account data before outreach — a Twitter user scraper and Twitter bio scraper in one run.

It extracts, per user:

- **Username and display name** – the @handle, the name shown on the profile and the numeric user ID
- **Follower and following counts** – the Twitter followers count and how many accounts the user follows
- **Bio and location** – the bio text with full links instead of short links, and the profile location
- **Activity counts** – number of posts and of photos and videos
- **Verification** – blue badge, protected flag and, with the about block, the date the account was verified
- **Pictures** – profile picture and cover picture URLs
- **Related users** – the accounts quoted or reposted in the profile's recent posts, each with its own full row

⚡ Fields X does not show to visitors come back as null, never as a made-up 0.

***

### Use cases 💡

- **Influencer marketer** — scrape Twitter users from a shortlist and rank them by follower count.
- **Social media analyst** — track bio, post count and verification changes across a watchlist.
- **PR team** — see which accounts a brand profile quotes and reposts most often.
- **Researcher** — collect Twitter user data and account creation dates for a study sample.
- **AI agent builder** — give an agent live X account details as context before it drafts outreach.

Building an AI agent? [Connect Twitter X User Scraper over MCP](#mcp-integration-for-ai-agents) and let it call the actor on its own.

***

### Why choose this actor?

- **Many accounts in one run.** A recorded local run read 74 X profiles and saved 120 user rows in 22.0 seconds, three profiles at a time.
- **Full numbers behind each account.** A recorded row for SpaceX came back with 41,956,210 followers, 128 following, 11,996 posts, 4,807 media items and a verification date.
- **39 fields per user.** From username and bio to professional account type, pinned post IDs and the optional about block.

***

### ⬇️ Input

The actor takes a list of X handles or profile URLs (`startUrls`, required); `@jack`, `jack`, `https://x.com/jack` and `https://twitter.com/jack` all work. Session cookies are optional.

| Parameter | Required | Type | Description | Example value |
|---|---|---|---|---|
| `startUrls` | Yes | array | X / Twitter profile URLs or handles, one per line. | `["https://x.com/NASA", "elonmusk"]` |
| `maxItems` | No | integer | Rows per input profile; the profile itself counts as one. Default 10, 1 to 10,000. | `10` |
| `authToken` | No | string | Your own x.com `auth_token` cookie (secret). With `csrfToken`, related users come from the whole timeline. | `"<your auth_token>"` |
| `csrfToken` | No | string | The `ct0` cookie that belongs to the `auth_token` above (secret). | `"<your ct0>"` |
| `getRetweeters` | No | boolean | Also return the users that appear in the profile's recent posts (quoted and reposted authors). Default true. | `true` |
| `getFollowers` | No | boolean | Keep the follower count in each row. Default true. | `true` |
| `getFollowing` | No | boolean | Keep the following count in each row. Default true. | `true` |
| `getAbout` | No | boolean | Add the about block: verification date, profile image shape, account source and location. Default false. | `true` |
| `includeUnavailableUsers` | No | boolean | Add rows for suspended or unavailable accounts. Default false. | `false` |
| `proxyConfiguration` | No | object | Optional proxy settings. By default the actor connects directly and retries on a fresh connection when a request is refused. | `{"useApifyProxy": false}` |

#### Free plan limits

Users on the Apify free plan can fetch up to 20 rows per run (all profiles together) and 200 rows per month. When the limit is reached, the run finishes successfully with a status message explaining the limit. Upgrade to any paid Apify plan to remove these limits.

#### Example input

```json
{
  "startUrls": [
    "https://x.com/NASA",
    "elonmusk",
    "https://twitter.com/openai"
  ],
  "maxItems": 10,
  "authToken": "",
  "csrfToken": "",
  "getRetweeters": true,
  "getFollowers": true,
  "getFollowing": true,
  "getAbout": true,
  "includeUnavailableUsers": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

***

### ⬆️ Output

Every user is one typed, normalized JSON item with the same schema on every run; export it as JSON (default), CSV or Excel. Related-user rows name the input profile they came from, and suspended accounts (when you ask for them) come back as a short row with the reason; a copy of all rows grouped by display name is also saved in the run's key-value store.

#### Example output

```json
{
  "inputSource": "https://x.com/elonmusk",
  "type": "user",
  "userName": "SpaceX",
  "url": "https://x.com/SpaceX",
  "twitterUrl": "https://twitter.com/SpaceX",
  "id": "34743251",
  "name": "SpaceX",
  "isVerified": true,
  "hasNftAvatar": false,
  "profilePicture": "https://pbs.twimg.com/profile_images/1697749409851985920/HbrI04tM_normal.jpg",
  "coverPicture": "https://pbs.twimg.com/profile_banners/34743251/1681251194",
  "description": "SpaceX designs, manufactures and launches the world’s most advanced rockets and spacecraft",
  "location": "Earth",
  "followers": 41956210,
  "following": 128,
  "protected": false,
  "status": "",
  "canDm": null,
  "canMediaTag": null,
  "createdAt": "Thu Apr 23 21:53:30 +0000 2009",
  "entities": {
    "description": {},
    "url": {
      "urls": [
        {
          "display_url": "spacex.com",
          "expanded_url": "http://spacex.com",
          "url": "https://t.co/VOJ6qEctND"
        }
      ]
    }
  },
  "fastFollowersCount": null,
  "favouritesCount": null,
  "listedCount": null,
  "hasCustomTimelines": null,
  "isTranslator": null,
  "mediaCount": 4807,
  "statusesCount": 11996,
  "affiliatesHighlightedLabel": {},
  "professional": {
    "category": [],
    "id": "UHJvZmVzc2lvbmFsOjE2ODE4MzkzMjIwMjk1MDI0NjQ=",
    "professional_type": "Business"
  },
  "possiblySensitive": false,
  "pinnedTweetIds": [],
  "profileInterstitialType": "",
  "hasGraduatedAccess": false,
  "about": {
    "accountBasedIn": "Earth",
    "locationAccurate": false,
    "profileImageShape": "Square",
    "avatarUrl": "https://pbs.twimg.com/profile_images/1697749409851985920/HbrI04tM_normal.jpg",
    "usernameChangeCount": "0",
    "accountCreatedAt": "Thu Apr 23 21:53:30 +0000 2009",
    "accountSource": "",
    "verifiedSince": "1326298354088"
  },
  "followerOf": "elonmusk"
}
```

***

### How does it work?

For each handle, the actor reads the public profile page any visitor can open, using plain HTTP requests and no browser. It takes the profile details from that page, then the users that appear in the profile's recent posts, and reads each of those users' own public profile so their rows are just as complete. When you add your own session cookies, related users come from the whole timeline instead. If X refuses a request, the actor retries on a fresh connection and, on the Apify platform, through a residential proxy. It returns only publicly visible data, and the output schema stays the same across runs.

***

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

Twitter X User Scraper works with what you already use: the REST API from any language, MCP for AI agents, and no-code tools.

#### Using Twitter X User Scraper with the Apify API

```python
import requests

resp = requests.post(
    "https://api.apify.com/v2/acts/socialdataapi~twitter-x-user-scraper/run-sync-get-dataset-items",
    params={"token": "APIFY_TOKEN"},
    json={"startUrls": ["https://x.com/NASA", "elonmusk"], "maxItems": 10},
)
for user in resp.json():
    print(user["userName"], user.get("followers"), user.get("followerOf"))
```

*Works in Go, Ruby, Node.js, cURL — any language that can make an HTTP request.*

#### MCP integration for AI agents

Register the actor once and your agent gets a tool that returns X account details, follower counts and related users for any handle:

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

This registers Twitter X User Scraper as a tool your agent can call directly. It works in Claude Code, Cursor and Windsurf, so an agent can do a Twitter account lookup in the middle of a task.

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

**n8n:** add the Apify node with "Run an Actor", pick `socialdataapi/twitter-x-user-scraper`, or use the HTTP Request node pointed at the run-sync endpoint with your token.

**Make:** use the Apify app's "Run an Actor" module, then "Get Dataset Items" to send each user row to your sheet or CRM.

**LangChain:** install `langchain-apify` and load `ApifyActorsTool("socialdataapi/twitter-x-user-scraper")` as an agent tool.

***

### Is it legal to scrape X (Twitter) data?

Scraping publicly available X profile data is generally legal when you collect only what any visitor can see without logging in. Twitter X User Scraper returns only public profile details; the optional session cookies are your own and only change which related users are found. Under GDPR, collecting public data is generally permissible, but storing and using it must comply with local data-protection law. Consult legal counsel if your use case involves bulk storage of personal data.

***

### Frequently asked questions

#### What fields does Twitter X User Scraper return?

It returns the username, display name, bio, follower count and following count, plus post and media counts, verification, pictures and the account creation date. See [the data fields section](#what-data-can-i-extract-with-twitter-x-user-scraper).

#### Does Twitter X User Scraper require an X account or login?

No. Profiles and the users in their recent posts are read without a login. Your own `auth_token` and `ct0` cookies are optional and only make related users come from the whole timeline.

#### How fast does Twitter X User Scraper run?

A recorded local run read 74 profiles and saved 120 rows in 22.0 seconds; 3 profiles gave 9 rows in 2.6 seconds. Data is fetched live on every run, not cached.

#### What happens if a user is private or doesn't exist?

A handle that does not exist gives no row, and text that is not a valid handle is skipped with a warning; the run still finishes successfully. Suspended accounts give a row with an unavailable flag and the reason when **Include unavailable users** is on. Protected accounts still return their public profile details, with the protected flag set to true.

#### Can I scrape multiple X users at once?

Yes. Put every handle or profile URL into `startUrls`; three profiles are read at the same time and **Max items per profile** applies to each one.

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

Yes — Twitter X User Scraper is available as an MCP tool. Register it in Claude Code, Cursor or Windsurf with:

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

Any agent that can call an HTTP endpoint can use the REST API directly.

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

Yes. Every row is typed, normalized JSON with consistent field names. No HTML parsing, no selectors: pass it straight to an LLM, index it into a vector store, or feed it to an agent tool.

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

The actor is maintained. When X changes, the actor is updated, and your calls keep returning the same JSON schema with no changes on your end.

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

Yes. Retries on a fresh connection and the residential proxy fallback run on the actor's side, and no browser is needed. You send one request and get structured JSON back.

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

For RAG, use the bio, display name, location and professional account category. For training data, use the follower, following, post and media counts, the verified and protected flags and the account creation date. All fields are typed strings, integers, booleans, lists and objects — no normalization needed.

***

### Related scrapers

| Scraper | What it extracts |
|---|---|
| [Twitter X Tweets Scraper](https://apify.com/socialdataapi/twitter-x-tweets-scraper) | Posts from X profiles, newest first |
| [Twitter Profile Scraper](https://apify.com/socialdataapi/twitter-profile-scraper) | Profile details of X accounts |
| [Twitter User Following Scraper](https://apify.com/socialdataapi/twitter-user-following-scraper) | Accounts an X user follows |
| [Twitter Email Scraper](https://apify.com/socialdataapi/twitter-email-scraper) | Public emails linked to X accounts |

***

### Your feedback

Found a bug or missing a field? Let us know through the actor's Issues tab in Apify Console. The team reads every report and ships fixes.

# Actor input Schema

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

X / Twitter profile URLs or handles, e.g. https://x.com/elonmusk, https://twitter.com/openai or elonmusk.

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

Maximum rows per input profile (the profile itself counts as one). Without session cookies a profile usually gives 1-9 rows. Free plan: up to 20 rows per run (all profiles together) and 200 per month; paid plans have no limit.

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

Optional. Your own x.com auth_token cookie (DevTools > Application > Cookies). With it and ct0, related users are collected from the whole timeline instead of only the recent posts shown to visitors.

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

Optional. The ct0 cookie that belongs to the auth_token above.

## `getRetweeters` (type: `boolean`):

Also collect the users that appear in the profile's recent posts (quoted and reposted authors). Without a session this is the few recent posts X shows to visitors; with a session the whole timeline is paged.

## `getFollowers` (type: `boolean`):

Include `followers` (follower count) in each output record.

## `getFollowing` (type: `boolean`):

Include `following` (friends count) in each output record.

## `getAbout` (type: `boolean`):

Add the 'about' block: verification date, profile image shape, account source and location details.

## `includeUnavailableUsers` (type: `boolean`):

Add rows for suspended or unavailable accounts, with isUnavailable: true and unavailableReason.

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

Optional. By default the actor connects directly and switches to a fresh connection automatically when a request is refused.

## Actor input object example

```json
{
  "startUrls": [
    "https://twitter.com/elonmusk"
  ],
  "maxItems": 10,
  "getRetweeters": true,
  "getFollowers": true,
  "getFollowing": true,
  "getAbout": false,
  "includeUnavailableUsers": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

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

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

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

```

## MCP server setup

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