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

Scrape public Twitter / X profile data from profile URLs or usernames. Extracts bio, follower counts, verification, avatar, banner, and related profile fields without requiring a logged-in account.

- **URL**: https://apify.com/datascrapers/twitter-x-profile-scraper.md
- **Developed by:** [Farhan Ali](https://apify.com/datascrapers) (community)
- **Categories:** Social media, News, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.70 / 1,000 tweet scrapeds

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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

**Twitter X Profile Scraper** creates a structured dataset of public X (Twitter) profile records collected from x.com. Each dataset item can include the profile name, username, bio, follower/following/tweet counts, verification status, location, website, avatar and banner images, account creation date, and — when enabled — recent tweets. Query the source using profile URLs, bare usernames, or handles, control the result limit with `maxItems`, and retrieve records through the Apify Dataset API or export them as JSON, CSV, Excel, or XML.

### Dataset at a glance

| Property | Value |
|---|---|
| Source | x.com / twitter.com |
| Record unit | One profile (with optional nested recent tweets) |
| Input methods | Profile URLs, bare usernames or handles |
| Main identifiers | `id`, `username`, `url` |
| Delivery | Apify Dataset and API |
| Export formats | JSON, CSV, Excel, XML |
| Update model | Fresh records per Actor run |
| Pricing | Pay per event — $2 per 1,000 tweets scraped |

### Coverage and available records

- **Supported inputs** — Full profile URLs (`https://x.com/elonmusk`, `https://twitter.com/NASA`) or bare handles (`elonmusk`, `@NASA`).
- **Profile fields** — Bio, display name, follower/following/tweet counts, verification flags, location, website, avatar/banner images, and account creation date.
- **Tweets** — `includeTweets` optionally attaches recent tweets from each profile's timeline via anonymous guest access; capped by `maxTweets` per profile.
- **Verification** — `verifiedType`, `verificationReason`, and `isBlueVerified` distinguish legacy, government, and business verification.
- **Public accounts only** — Protected/suspended accounts are skipped without stopping the run.
- **Not currently collected** — Follower lists, follower details, and full historical timelines beyond `maxTweets`.

### Data dictionary

| Field | Type | Nullable | Description | Example |
|---|---:|---|---|---|
| `id` | string | No | Stable numeric user ID; best deduplication key | `11348282` |
| `url` | string | No | Canonical profile URL | `https://x.com/NASA` |
| `username` | string | No | Screen name without `@` | `NASA` |
| `name` | string | Yes | Display name | `NASA` |
| `description` | string | Yes | Profile bio | `Making the seemingly impossible...` |
| `location` | string | Yes | Self-declared location | `Pale Blue Dot` |
| `website` | string | Yes | Short link shown on profile | `https://t.co/9NkQJKAVks` |
| `websiteExpanded` | string | Yes | Expanded website URL | `http://www.nasa.gov/` |
| `profileImageUrl` | string | Yes | Avatar image URL | `https://pbs.twimg.com/...` |
| `profileBannerUrl` | string | Yes | Banner image URL | `https://pbs.twimg.com/...` |
| `followersCount` | number | Yes | Follower count | `92251042` |
| `followingCount` | number | Yes | Following count | `119` |
| `tweetsCount` | number | Yes | Lifetime tweet count | `74301` |
| `mediaTweetsCount` | number | Yes | Lifetime media tweet count | `28065` |
| `favouritesCount` | number | Yes | Lifetime likes | `16906` |
| `isBlueVerified` | boolean | Yes | Whether the account is Blue-verified | `true` |
| `verifiedType` | string | Yes | Verification category | `Government` |
| `verificationReason` | string | Yes | Explanation of verification | `This account is verified because...` |
| `protected` | boolean | Yes | Whether the account is protected | `false` |
| `createdAt` | string | Yes | Account creation timestamp | `Wed Dec 19 20:20:32 +0000 2007` |
| `tweets` | array | Yes | Recent tweets; only when `includeTweets` is enabled | `[ ... ]` |

Each nested tweet object includes `id`, `url`, `text`, `createdAt`, `lang`, `replyCount`, `retweetCount`, `likeCount`, `quoteCount`, `viewCount`, `isRetweet`, `isReply`, `isQuote`, `media`, `hashtags`, and `urls`.

### Example dataset record

```json
{
  "id": "11348282",
  "url": "https://x.com/NASA",
  "username": "NASA",
  "name": "NASA",
  "description": "Making the seemingly impossible, possible.",
  "location": "Pale Blue Dot",
  "websiteExpanded": "http://www.nasa.gov/",
  "profileImageUrl": "https://pbs.twimg.com/profile_images/1321163587679784960/0ZxKlEKB_400x400.jpg",
  "followersCount": 92251042,
  "followingCount": 119,
  "tweetsCount": 74301,
  "isBlueVerified": true,
  "verifiedType": "Government",
  "protected": false,
  "createdAt": "Wed Dec 19 20:20:32 +0000 2007",
  "tweets": [
    {
      "id": "2085462611575857621",
      "url": "https://x.com/NASA/status/2085462611575857621",
      "text": "It's a great time to tune in and stream space with us!",
      "createdAt": "Thu Aug 06 20:26:47 +0000 2026",
      "retweetCount": 196,
      "likeCount": 1039
    }
  ]
}
```

This record was produced by providing the profile URL `https://x.com/NASA` with `includeTweets` enabled.

### Query and input reference

| Input | Type | Required | Default | Accepted values | Description |
|---|---:|---|---|---|---|
| `profileUrls` | array | No | — | X/Twitter profile URLs or `@` handles | Profiles to scrape |
| `usernames` | array | No | — | Bare handles (`elonmusk`) | Additional profiles to scrape |
| `includeTweets` | boolean | No | `true` | `true` / `false` | Attach recent tweets to each profile |
| `maxTweets` | integer | No | `20` | `0` = none | Max tweets attached per profile |
| `maxConcurrency` | integer | No | `10` | `1`–`50` | Parallel profiles |
| `maxItems` | integer | No | `0` | `0` = unlimited | Max profiles to scrape |
| `proxyConfiguration` | object | No | Residential | Apify proxy config | Residential proxy recommended |

Minimal request:

```json
{ "profileUrls": ["https://x.com/NASA"] }
```

Advanced request:

```json
{
  "usernames": ["NASA", "apify", "elonmusk"],
  "includeTweets": true,
  "maxTweets": 5,
  "maxConcurrency": 5,
  "maxItems": 100,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
```

### Retrieve the data through the API

1. Start the Actor with a JSON input via the Apify API or the Actor's API tab.
2. Wait for the run to finish.
3. Retrieve items from the run's default dataset.
4. Paginate or export the dataset in JSON, CSV, Excel, or XML.

```python
from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("datascrapers/twitter-x-profile-scraper").call(
    run_input={"usernames": ["NASA", "apify"], "includeTweets": True, "maxTweets": 5}
)
items = client.dataset(run["defaultDatasetId"]).list_items().items
```

### Data quality and record handling

- **Completeness** — Core identity and count fields are present on public profiles; `tweets` is present only when `includeTweets` is enabled.
- **Deduplication** — Use `id` (preferred) or `username` as the stable external key across runs.
- **Retries** — Failed profiles are skipped and the run continues; a "profile unavailable" warning means the account does not exist or is suspended.
- **Normalization** — Counts are returned as numbers; `createdAt` uses the source's native timestamp format.
- **Raw vs derived** — All fields come directly from X's public profile/guest data; no AI-generated or computed values are added.

### Export and pipeline examples

| Destination | Recommended method | Typical use |
|---|---|---|
| PostgreSQL/Supabase | Dataset API or webhook consumer | Influencer database keyed by `id` |
| Google Sheets | Apify integration | Follower and verification tracking |
| S3/cloud storage | Scheduled export or integration | Weekly snapshot of profile metrics |

### Pricing and cost examples

Billing is pay-per-event, tiered across Apify plans; the rate below is the free-plan rate.

| Event | Charged when | Free-plan rate |
|---|---|---|
| `tweet` (Tweet scraped) | A tweet is scraped for a profile (only when `includeTweets` is enabled) | $2 per 1,000 tweets |

A fixed one-time Actor Start charge of $0.00005 also applies to each run. Profile records themselves are not billed — the billable unit is the tweet. A run with `includeTweets` disabled produces profile records without per-item charges.

| Tweets scraped | Estimated base cost |
|---:|---:|
| 1,000 | $2 |
| 10,000 | $20 |

Estimates depend on the pricing model and the options enabled.

### Limitations and responsible data use

- Only publicly accessible profile data is collected via X's guest endpoint; no login or API key is used.
- Protected, suspended, or non-existent accounts are skipped and are not returned.
- Tweets are limited to recent timeline items up to `maxTweets`; full historical archives are not collected.
- No historical snapshots are stored unless you persist them yourself across scheduled runs.
- You are responsible for complying with X's terms and applicable privacy and data laws.

### Dataset questions

#### What does one dataset item represent?

One X/Twitter profile. When `includeTweets` is enabled, the item also carries a nested `tweets` array of recent timeline posts.

#### Which field should I use as a unique identifier?

`id` is the stable numeric user ID; `username` is a readable fallback but can change if an account renames itself.

#### Are fields nullable or conditional?

Yes. `tweets` is absent unless `includeTweets` is enabled, and optional profile fields such as `location` or `websiteExpanded` may be empty.

#### Can I retrieve the records as CSV or JSON?

Yes. The default dataset can be exported as JSON, CSV, Excel, or XML from the Apify Console or via the Dataset API.

#### How do I paginate large datasets?

The Actor processes profiles up to `maxItems`. For very large exports, page through the dataset with the Dataset API `offset` and `limit` parameters.

#### What counts as a billable result?

One `tweet` event per tweet scraped. Profile records themselves are not billed; enabling `includeTweets` is what generates charges.

### Related datasets from Data Scrapers

- [Instagram Post Scraper](https://apify.com/datascrapers/instagram-post-scraper) — public Instagram post and reel data for social media research.
- [Instagram Comment Scraper](https://apify.com/datascrapers/my-actor-1) — comment-level engagement data from Instagram.
- [LinkedIn Profile Scraper](https://apify.com/datascrapers/linkedin-profile-scraper) — professional profile data for people and company research.

### Data Scrapers support

Need an additional field, record type, or export workflow? Contact Data Scrapers at stardustspotlight@gmail.com. Include a sample source URL, required fields, expected record volume, and preferred delivery format.

# Actor input Schema

## `profileUrls` (type: `array`):

Twitter / X profile URLs to scrape (e.g. https://x.com/elonmusk or https://twitter.com/NASA). Bare @usernames are also accepted.

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

Optional screen names / handles without a full URL (e.g. elonmusk or @NASA).

## `includeTweets` (type: `boolean`):

If true, also scrape recent tweets from each profile timeline (anonymous guest access — no login).

## `maxTweets` (type: `integer`):

Maximum number of recent tweets to attach to each profile (0 = no tweets).

## `maxConcurrency` (type: `integer`):

How many profiles to scrape in parallel. Higher is faster; keep moderate with residential proxies.

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

Maximum number of profiles to scrape (0 = unlimited)

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

Proxy settings for anti-bot protection. Residential proxies are recommended.

## Actor input object example

```json
{
  "profileUrls": [
    "https://x.com/elonmusk",
    "https://x.com/NASA"
  ],
  "includeTweets": true,
  "maxTweets": 20,
  "maxConcurrency": 10,
  "maxItems": 1,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset containing scraped profile records

## `runStats` (type: `string`):

Aggregate scrape statistics for 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 = {
    "profileUrls": [
        "https://x.com/elonmusk",
        "https://x.com/NASA"
    ],
    "includeTweets": false,
    "maxTweets": 20,
    "maxItems": 1,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("datascrapers/twitter-x-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 = {
    "profileUrls": [
        "https://x.com/elonmusk",
        "https://x.com/NASA",
    ],
    "includeTweets": False,
    "maxTweets": 20,
    "maxItems": 1,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("datascrapers/twitter-x-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 '{
  "profileUrls": [
    "https://x.com/elonmusk",
    "https://x.com/NASA"
  ],
  "includeTweets": false,
  "maxTweets": 20,
  "maxItems": 1,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call datascrapers/twitter-x-profile-scraper --silent --output-dataset

```

## MCP server setup

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